Mercurial > obsidian-remember-file-state
annotate version-bump.mjs @ 51:e932f1b73133
Pass `this` as the context for various callbacks.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 02 Oct 2023 10:04:13 -0700 |
parents | 712761e7625b |
children |
rev | line source |
---|---|
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import { readFileSync, writeFileSync } from "fs"; |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 const targetVersion = process.env.npm_package_version; |
45 | 4 console.log(`Bumping version to ${targetVersion}`); |
19
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 // read minAppVersion from manifest.json and bump version to target version |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 let manifest = JSON.parse(readFileSync("manifest.json", "utf8")); |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 const { minAppVersion } = manifest; |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 manifest.version = targetVersion; |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t")); |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 // update versions.json with target version and minAppVersion from manifest.json |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 let versions = JSON.parse(readFileSync("versions.json", "utf8")); |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
14 versions[targetVersion] = minAppVersion; |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
15 writeFileSync("versions.json", JSON.stringify(versions, null, "\t")); |
2a9e941c96ee
Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 |