Skip to content

Commit

Permalink
use package.json import for version
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Nov 19, 2022
1 parent 11e1c60 commit def323f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"test": "npm run build && npm run test:clean && npm run test:jest",
"test:clean": "shx rm -rf tests/artifacts/ && shx mkdir -p tests/artifacts/",
"test:jest": "jest",
"version": "node scripts/sync-version.js && git add src/DeputyVersion.ts",
"clean": "shx rm -rf build .rollup.cache",
"prebuild": "shx mkdir -p build/i18n/ && shx cp -Rf i18n/* build/i18n/",
"build": "npm run prebuild && rollup -c",
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ function getPlugins() {
// Transpiles TypeScript
typescript(),
// Allows JSON imports (i18n files)
json(),
json( {
preferConst: true
} ),
// Transform CSS to standard JS strings
cssString(),
// Bundle analysis
Expand Down
15 changes: 0 additions & 15 deletions scripts/sync-version.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/DeputyVersion.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { version } from '../package.json';
/**
* Deputy's current version, exported as a string.
*
Expand All @@ -9,8 +10,7 @@
*
* This ensures that the version is available, even if the core is not loaded.
* It also keeps standalone versions lightweight to avoid too much additional code.
*
* This file is automatically modified by npm when running `npm version ...`. Avoid
* modifying it manually.
*/
export default /* v */'0.2.2'/* v */;
export default version;

export const deputyVersion = version;

0 comments on commit def323f

Please sign in to comment.