-
Notifications
You must be signed in to change notification settings - Fork 121
/
propagate-version.js
34 lines (23 loc) · 1.07 KB
/
propagate-version.js
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
31
32
33
34
/*
Propogate the version number from package.json to:
* plugin.info for the TiddlyDesktop plugin
* $:/plugins/tiddlywiki/tiddlydesktop/version
*/
(function(){
/*jslint browser: true */
"use strict";
var fs = require("fs"),
path = require("path");
// Get package.info
var packageInfo = require("./package.json");
// Insert version number in the nwjs package.json
var nwAppPackageInfo = JSON.parse(fs.readFileSync("./source/package.json","utf8") || {});
nwAppPackageInfo.version = packageInfo.version;
fs.writeFileSync("./source/package.json",JSON.stringify(nwAppPackageInfo,null,4));
// Insert version number in plugin.info
var pluginInfo = JSON.parse(fs.readFileSync("./source/tiddlywiki/plugins/tiddlywiki/tiddlydesktop/plugin.info","utf8") || {});
pluginInfo.version = packageInfo.version;
fs.writeFileSync("./source/tiddlywiki/plugins/tiddlywiki/tiddlydesktop/plugin.info",JSON.stringify(pluginInfo,null,4));
// Create $:/plugins/tiddlywiki/tiddlydesktop/version
fs.writeFileSync("./source/tiddlywiki/plugins/tiddlywiki/tiddlydesktop/system/version.txt",packageInfo.version);
})();