Replace jq with some JavaScript
This commit is contained in:
parent
197d8dba93
commit
f51751ad21
3 changed files with 23 additions and 3 deletions
18
scripts/merge.js
Normal file
18
scripts/merge.js
Normal 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));
|
|
@ -1,3 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "code-server"
|
"name": "code-server",
|
||||||
|
"main": "out/vs/server/main",
|
||||||
|
"desktopName": "code-server-url-handler.desktop"
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ function build-code-server() {
|
||||||
mkdir -p "${codeServerBuildPath}"
|
mkdir -p "${codeServerBuildPath}"
|
||||||
|
|
||||||
cp -r "${vscodeBuildPath}/resources/app/extensions" "${codeServerBuildPath}"
|
cp -r "${vscodeBuildPath}/resources/app/extensions" "${codeServerBuildPath}"
|
||||||
jq -s '.[0] * .[1]' "${vscodeBuildPath}/resources/app/package.json" "${rootPath}/scripts/package.json" > "${codeServerBuildPath}/package.json"
|
node "${rootPath}/scripts/merge.js" "${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/product.json" "${rootPath}/scripts/product.json" "${codeServerBuildPath}/product.json"
|
||||||
cp -r "${vscodeSourcePath}/out" "${codeServerBuildPath}"
|
cp -r "${vscodeSourcePath}/out" "${codeServerBuildPath}"
|
||||||
rm -rf "${codeServerBuildPath}/out/vs/server/node_modules"
|
rm -rf "${codeServerBuildPath}/out/vs/server/node_modules"
|
||||||
cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}"
|
cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}"
|
||||||
|
|
Loading…
Reference in a new issue