mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 13:42:27 -05:00
add script to merge scratch-gui deps
This is in preparation for having webpack build scratch-gui source instead of consuming its build output. This script merges the dependencies listed in package-deps.json with those listed in scratch-gui's package.json, using the package-deps.json version in case of conflict, then writes the result into the `devDependencies` section of scratch-desktop's package.json.
This commit is contained in:
parent
fa5312721a
commit
6f7f6bb674
2 changed files with 50 additions and 0 deletions
24
package-deps.json
Normal file
24
package-deps.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"description": "Deps of scratch-desktop that don't match scratch-gui. See scripts/rebuild-deps.js",
|
||||
"devDependencies": {
|
||||
"async": "^3.2.0",
|
||||
"babel-plugin-react-intl": "^7.5.7",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"electron": "^8.2.5",
|
||||
"electron-builder": "^22.6.0",
|
||||
"electron-devtools-installer": "^3.0.0",
|
||||
"electron-notarize": "^0.3.0",
|
||||
"electron-store": "^5.1.1",
|
||||
"electron-webpack": "^2.8.2",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-scratch": "^6.0.0",
|
||||
"eslint-plugin-import": "^2.20.0",
|
||||
"eslint-plugin-react": "^7.20.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nets": "^3.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"scratch-gui": "github:LLK/scratch-gui#scratch-desktop",
|
||||
"source-map-loader": "^0.2.4",
|
||||
"uuid": "^8.0.0"
|
||||
}
|
||||
}
|
26
scripts/rebuild-deps.js
Normal file
26
scripts/rebuild-deps.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const fs = require('fs');
|
||||
|
||||
const desktopPackage = require('../package.json');
|
||||
const desktopRawPackage = require('../package-deps.json');
|
||||
const guiPackage = require('../node_modules/scratch-gui/package.json');
|
||||
|
||||
const sortObject = obj => Object
|
||||
.keys(obj)
|
||||
.sort()
|
||||
.reduce(
|
||||
(accumulator, currentKey) => {
|
||||
accumulator[currentKey] = obj[currentKey];
|
||||
return accumulator;
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
desktopPackage.devDependencies = sortObject(Object.assign(
|
||||
{},
|
||||
guiPackage.devDependencies,
|
||||
desktopRawPackage.devDependencies
|
||||
));
|
||||
|
||||
let newDesktopPackage = JSON.stringify(desktopPackage, null, 2);
|
||||
newDesktopPackage += '\n';
|
||||
fs.writeFileSync('package.json', newDesktopPackage);
|
Loading…
Reference in a new issue