Archived
1
0

Replace jq with some JavaScript

This commit is contained in:
Asher 2019-07-05 12:44:33 -05:00
parent 197d8dba93
commit f51751ad21
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 23 additions and 3 deletions

18
scripts/merge.js Normal file
View File

@ -0,0 +1,18 @@
const fs = require("fs");
const a = process.argv[2];
const b = process.argv[3];
const out = process.argv[4];
const aJson = JSON.parse(fs.readFileSync(a));
const bJson = JSON.parse(fs.readFileSync(b));
delete aJson.scripts;
delete aJson.dependencies;
delete aJson.devDependencies;
delete aJson.optionalDependencies;
fs.writeFileSync(out, JSON.stringify({
...aJson,
...bJson,
}, null, 2));

View File

@ -1,3 +1,5 @@
{
"name": "code-server"
"name": "code-server",
"main": "out/vs/server/main",
"desktopName": "code-server-url-handler.desktop"
}

View File

@ -68,8 +68,8 @@ function build-code-server() {
mkdir -p "${codeServerBuildPath}"
cp -r "${vscodeBuildPath}/resources/app/extensions" "${codeServerBuildPath}"
jq -s '.[0] * .[1]' "${vscodeBuildPath}/resources/app/package.json" "${rootPath}/scripts/package.json" > "${codeServerBuildPath}/package.json"
jq -s '.[0] * .[1]' "${vscodeBuildPath}/resources/app/product.json" "${rootPath}/scripts/product.json" > "${codeServerBuildPath}/product.json"
node "${rootPath}/scripts/merge.js" "${vscodeBuildPath}/resources/app/package.json" "${rootPath}/scripts/package.json" "${codeServerBuildPath}/package.json"
node "${rootPath}/scripts/merge.js" "${vscodeBuildPath}/resources/app/product.json" "${rootPath}/scripts/product.json" "${codeServerBuildPath}/product.json"
cp -r "${vscodeSourcePath}/out" "${codeServerBuildPath}"
rm -rf "${codeServerBuildPath}/out/vs/server/node_modules"
cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}"