Installations
npm install @yummy/app-version
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
20.8.0
NPM Version
10.1.0
Score
68.5
Supply Chain
96
Quality
78.6
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
rudionrails
Download Statistics
Total Downloads
330
Last Day
1
Last Week
7
Last Month
9
Last Year
330
GitHub Statistics
14 Commits
1 Branches
1 Contributors
Package Meta Information
Latest Version
3.0.2
Package Id
@yummy/app-version@3.0.2
Unpacked Size
10.85 kB
Size
4.11 kB
File Count
8
NPM Version
10.1.0
Node Version
20.8.0
Publised On
31 May 2024
Total Downloads
Cumulative downloads
Total Downloads
330
Last day
0%
1
Compared to previous day
Last week
0%
7
Compared to previous week
Last month
-10%
9
Compared to previous month
Last year
0%
330
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
A yummy app version library
An opinionated utility to generate a version of the current library / application.
Installation
1# npm i -D @yummy/app-version
Usage
The library needs a working git repository to run. It uses the git describe command to generate the output.
By default, appVersion
uses the last found git tag and appends the branch, date, distance to the last git tag and git hash:
1import { appVersion } from "@yummy/app-version"; 2 3appVersion(); 4// => 1.2.3+main.20240608+7.g6cef876 5 ^ ^ ^ ^ ^ 6 | | | | | 7 git tag | date | git hash 8 git branch distance to last git commit
All parts can be disabled individually:
branch = false
to omit the git branchdate = false
to omit the current datedistance = false
to omit the distance to the last git taghash = false
to omit the current git hash
1import { appVersion } from "@yummy/app-version"; 2 3appVersion({ branch: false }); 4// => 1.2.3+20240608+7.g6cef876 5 6appVersion({ date: false }); 7// => 1.2.3+main+7.g6cef876 8 9appVersion({ distance: false }); 10// => 1.2.3+main.20240608+g6cef876 11 12appVersion({ hash: false }); 13// => 1.2.3+main.20240608+7 14 15// => 1.2.3+main.20240608+7.g6cef876
Additionally, you can pass a prefix
:
1import { appVersion } from "@yummy/app-version"; 2 3appVersion({ prefix: "my-custom-prefix" }); 4// => my-custom-prefix+1.2.3+20240608+7.g6cef876
Example with esbuild
This is useful for when you want to transpile your code into a specific directory.
1import * as esbuild from "esbuild"; 2import { appVersion } from "@yummy/app-version"; 3 4// assume that @ is the project root 5import app from "@/package.json" assert { type: "json" }; 6 7const version = appVersion({ prefix: app.name }); 8 9await esbuild.build({ 10 entryPoints: ["src/index.ts"], 11 outdir: `dist/${version}`; 12 bundle: true, 13});
Development
To release the package, follow those steps
1# generate changelog and provide git version tag 2# @see https://github.com/absolute-version/commit-and-tag-version for details 3npm run release
No vulnerabilities found.
No security vulnerabilities found.