From f51751ad21e7463e6519a030d91df1abba02c727 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 5 Jul 2019 12:44:33 -0500 Subject: [PATCH] Replace jq with some JavaScript --- scripts/merge.js | 18 ++++++++++++++++++ scripts/package.json | 4 +++- scripts/tasks.bash | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 scripts/merge.js diff --git a/scripts/merge.js b/scripts/merge.js new file mode 100644 index 00000000..61bfb7d4 --- /dev/null +++ b/scripts/merge.js @@ -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)); diff --git a/scripts/package.json b/scripts/package.json index 234792c3..5085fa85 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -1,3 +1,5 @@ { - "name": "code-server" + "name": "code-server", + "main": "out/vs/server/main", + "desktopName": "code-server-url-handler.desktop" } diff --git a/scripts/tasks.bash b/scripts/tasks.bash index f430c1a5..e96c413f 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -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}"