mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
6f7f6bb674
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.
26 lines
726 B
JavaScript
26 lines
726 B
JavaScript
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);
|