-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathpublish.js
More file actions
21 lines (16 loc) · 862 Bytes
/
publish.js
File metadata and controls
21 lines (16 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { execSync } from 'node:child_process';
import fs from 'node:fs';
const packageJson = fs.readFileSync('package.json', 'utf8');
const packageVersion = JSON.parse(packageJson).version;
const majorminor = packageVersion.split('.').slice(0, 2).join('.');
const patch = parseInt(packageVersion.split('.')[2].split(/[^0-9\-]/)[0]) + 1;
const version = `${majorminor}.${patch}`;
fs.writeFileSync('package.json', packageJson.replace(`"${packageVersion}"`, `"${version}"`));
const jsrJson = fs.readFileSync('jsr.json', 'utf8');
fs.writeFileSync('jsr.json', jsrJson.replace(`"${packageVersion}"`, `"${version}"`));
fs.writeFileSync(
'runtime/index.js',
fs.readFileSync('runtime/index.js', 'utf8')
.replace(/globalThis\.version = '.*?';/, `globalThis.version = '${version}';`)
);
execSync('node test262/generateHistoricalData.js', { stdio: 'inherit' });