-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
version-bump.mjs
30 lines (26 loc) · 959 Bytes
/
version-bump.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { readFileSync, writeFileSync } from 'fs';
const targetVersion = process.env.npm_package_version;
const pluginMetadataFolder = './';
const manifestFile = 'manifest.json';
const versionsFile = 'versions.json';
// read minAppVersion from manifest.json and bump version to target version
console.log('Generating manifest');
let manifest = JSON.parse(
readFileSync(`${pluginMetadataFolder}/${manifestFile}`, 'utf8')
);
const { minAppVersion } = manifest;
manifest.version = targetVersion;
writeFileSync(
`${pluginMetadataFolder}/${manifestFile}`,
JSON.stringify(manifest, null, '\t')
);
// update versions.json with target version and minAppVersion from manifest.json
console.log('Updating versions file');
let versions = JSON.parse(
readFileSync(`${pluginMetadataFolder}/${versionsFile}`, 'utf8')
);
versions[targetVersion] = minAppVersion;
writeFileSync(
`${pluginMetadataFolder}/${versionsFile}`,
JSON.stringify(versions, null, '\t')
);