Skip to content

Commit d6ec4e7

Browse files
committed
build: add fragmenter script and specify version
Co-authored-by: Benjamin Dupont <[email protected]> change: check against tag name fix: remove old version name for release fix: improve only for tag name vX.X.X
1 parent 94300ba commit d6ec4e7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

scripts/fragment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const fs = require('fs');
44
const execute = async () => {
55
try {
66
const result = await fragmenter.pack({
7+
version: require('./fragmenter_version').version,
78
baseDir: './build',
89
outDir: './build-modules',
910
packOptions: { splitFileSize: 102_760_448, keepCompleteModulesAfterSplit: false },

scripts/fragmenter_version.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const buildInfo = require('./git_build_info').getGitBuildInfo();
2+
const packageInfo = require('../package.json');
3+
4+
let version;
5+
if (buildInfo?.tag && /^v\d+\.\d+\.\d+$/.test(buildInfo.tag)) {
6+
version = buildInfo.tag;
7+
} else {
8+
const hash = buildInfo?.shortHash;
9+
10+
if (!hash) {
11+
console.error('[!] buildInfo.shortHash is falsy');
12+
process.exit(-1);
13+
}
14+
15+
version = buildInfo.shortHash;
16+
}
17+
18+
module.exports = { version };

0 commit comments

Comments
 (0)