Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bin/updateMaxVersion.ts')
-rw-r--r--bin/updateMaxVersion.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/updateMaxVersion.ts b/bin/updateMaxVersion.ts
new file mode 100644
index 0000000..3ef240d
--- /dev/null
+++ b/bin/updateMaxVersion.ts
@@ -0,0 +1,21 @@
+import toml from 'toml';
+import fs from 'fs';
+
+const newMaxVersion = process.argv[2];
+
+const updateMaxVersion = async (newMaxVersion: string) => {
+ console.log('newMaxVersion', newMaxVersion)
+ try {
+ const configDoc = fs.readFileSync('./config.toml', 'utf8');
+ const e2eWorkflowDoc = fs.readFileSync('./.github/workflows/e2e.yml', 'utf8');
+
+ const currentMax = toml.parse(configDoc).module.hugoVersion.max
+
+ await fs.writeFileSync('./config.toml', configDoc.replace(currentMax, newMaxVersion))
+ await fs.writeFileSync('./.github/workflows/e2e.yml', e2eWorkflowDoc.replace(currentMax, newMaxVersion))
+ } catch (e) {
+ console.error(e)
+ }
+}
+
+updateMaxVersion(newMaxVersion) \ No newline at end of file