Sign app for publishing (#38)
* Sign app for publishing * update gitignore * refactor input args * Change instance api sorting * Better instance sorting * Instance filter * remove hardcoded instance * script cleanups * Unused function
This commit is contained in:
1 parent
4640a34863
commit
7a155c689e
15 files changed
+636
-252
No files matched your search
@@ -1,33 +1,33 @@
|
||||
const fs = require('fs');
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]")
|
||||
exit(-1)
|
||||
console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
function argsToSymbolsObject(arr) {
|
||||
return arr.reduce(function (acc, value) {
|
||||
keyValue = value.split("=")
|
||||
acc[keyValue[0]] = keyValue[1]
|
||||
return acc
|
||||
}, {})
|
||||
keyValue = value.split("=");
|
||||
acc[keyValue[0]] = keyValue[1];
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
const newSymbols = argsToSymbolsObject(process.argv.slice(2))
|
||||
const newSymbols = argsToSymbolsObject(process.argv.slice(2));
|
||||
let currentSymbols = {}
|
||||
|
||||
const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n')
|
||||
const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="))
|
||||
const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n');
|
||||
const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="));
|
||||
if (bsConstIndex !== -1) {
|
||||
let bsConst = appManifestLines[bsConstIndex]
|
||||
bsConst = bsConst.substring("bs_const=".length)
|
||||
let bsConst = appManifestLines[bsConstIndex];
|
||||
bsConst = bsConst.substring("bs_const=".length);
|
||||
currentSymbols = argsToSymbolsObject(bsConst.split(";"))
|
||||
}
|
||||
|
||||
mergedSymbols = {...currentSymbols, ...newSymbols}
|
||||
mergedSymbols = { ...currentSymbols, ...newSymbols };
|
||||
|
||||
bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";")
|
||||
bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";");
|
||||
|
||||
appManifestLines[bsConstIndex] = bsConst
|
||||
appManifestLines[bsConstIndex] = bsConst;
|
||||
|
||||
fs.writeFileSync("./src/manifest", appManifestLines.join("\n"))
|
||||
fs.writeFileSync("./src/manifest", appManifestLines.join("\n"));
|
||||
Reference in new issue
Block a user