mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
Merge pull request #148 from cwillisf/no-package-deps
remove rebuild-deps script, package-deps.json
This commit is contained in:
commit
e0fb2d4c53
4 changed files with 298 additions and 4445 deletions
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"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",
|
||||
"fs-extra": "^9.0.1",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nets": "^3.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"scratch-gui": "github:LLK/scratch-gui#scratch-desktop",
|
||||
"uuid": "^8.0.0"
|
||||
}
|
||||
}
|
4535
package-lock.json
generated
4535
package-lock.json
generated
File diff suppressed because it is too large
Load diff
104
package.json
104
package.json
|
@ -8,7 +8,6 @@
|
|||
"scripts": {
|
||||
"clean": "rimraf ./dist ./static/assets",
|
||||
"start": "mkdirp ./dist && electron-webpack dev --bail --display-error-details --env.minify=false --no-progress",
|
||||
"postinstall": "npm run rebuild-deps",
|
||||
"compile": "mkdirp ./dist && electron-webpack --bail --display-error-details --env.minify=false --no-progress",
|
||||
"fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js",
|
||||
"build": "npm run build:dev",
|
||||
|
@ -19,8 +18,7 @@
|
|||
"dist": "npm run clean && npm run compile && npm run fetch && npm run doBuild -- --mode=dist",
|
||||
"distDev": "npm run clean && npm run compile && npm run fetch && npm run doBuild -- --mode=dev",
|
||||
"test": "npm run test:lint",
|
||||
"test:lint": "eslint --cache --color --ext .jsx,.js .",
|
||||
"rebuild-deps": "node ./scripts/rebuild-deps.js"
|
||||
"test:lint": "eslint --cache --color --ext .jsx,.js ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -30,117 +28,43 @@
|
|||
"source-map-support": "^0.5.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.1.2",
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-transform-async-to-generator": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"arraybuffer-loader": "^1.0.6",
|
||||
"@babel/core": "^7.9.6",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-async-to-generator": "^7.8.3",
|
||||
"@babel/preset-env": "^7.9.6",
|
||||
"@babel/preset-react": "^7.9.4",
|
||||
"async": "^3.2.0",
|
||||
"autoprefixer": "^9.0.1",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-loader": "^8.0.4",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-react-intl": "^7.5.7",
|
||||
"base64-loader": "1.0.0",
|
||||
"bowser": "1.9.4",
|
||||
"chromedriver": "83.0.0",
|
||||
"classnames": "2.2.6",
|
||||
"computed-style-to-inline-style": "3.0.0",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"core-js": "2.5.7",
|
||||
"css-loader": "^1.0.0",
|
||||
"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",
|
||||
"enzyme": "^3.5.0",
|
||||
"enzyme-adapter-react-16": "1.3.0",
|
||||
"es6-object-assign": "1.1.0",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-scratch": "^6.0.0",
|
||||
"eslint-import-resolver-webpack": "^0.11.1",
|
||||
"eslint-plugin-import": "^2.20.0",
|
||||
"eslint-plugin-jest": "^22.14.1",
|
||||
"eslint-plugin-react": "^7.20.0",
|
||||
"file-loader": "2.0.0",
|
||||
"fs-extra": "^9.0.1",
|
||||
"get-float-time-domain-data": "0.1.0",
|
||||
"get-user-media-promise": "1.1.4",
|
||||
"gh-pages": "github:rschamp/gh-pages#publish-branch-to-subfolder",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"immutable": "3.8.2",
|
||||
"intl": "1.2.5",
|
||||
"jest": "^21.0.0",
|
||||
"jest-junit": "^7.0.0",
|
||||
"js-base64": "2.4.9",
|
||||
"keymirror": "0.1.1",
|
||||
"lodash.bindall": "4.4.0",
|
||||
"lodash.debounce": "4.0.8",
|
||||
"lodash.defaultsdeep": "4.6.0",
|
||||
"lodash.isequal": "4.5.0",
|
||||
"lodash.omit": "4.5.0",
|
||||
"lodash.pick": "4.4.0",
|
||||
"lodash.throttle": "4.0.1",
|
||||
"minilog": "3.1.0",
|
||||
"lodash.bindall": "^4.4.0",
|
||||
"lodash.defaultsdeep": "^4.6.1",
|
||||
"minilog": "^3.1.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nets": "^3.2.0",
|
||||
"omggif": "1.0.9",
|
||||
"papaparse": "5.1.1",
|
||||
"postcss-import": "^12.0.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-simple-vars": "^5.0.1",
|
||||
"prop-types": "^15.5.10",
|
||||
"query-string": "^5.1.1",
|
||||
"raf": "^3.4.0",
|
||||
"raw-loader": "^0.5.1",
|
||||
"react": "16.2.0",
|
||||
"react-contextmenu": "2.9.4",
|
||||
"react-dom": "16.2.0",
|
||||
"react-draggable": "3.0.5",
|
||||
"react-ga": "2.5.3",
|
||||
"react-dom": "16.2.1",
|
||||
"react-intl": "2.9.0",
|
||||
"react-modal": "3.9.1",
|
||||
"react-popover": "0.5.10",
|
||||
"react-redux": "5.0.7",
|
||||
"react-responsive": "5.0.0",
|
||||
"react-style-proptype": "3.2.2",
|
||||
"react-tabs": "2.3.0",
|
||||
"react-test-renderer": "16.2.0",
|
||||
"react-tooltip": "3.8.0",
|
||||
"react-virtualized": "9.20.1",
|
||||
"react-visibility-sensor": "5.0.2",
|
||||
"redux": "3.7.2",
|
||||
"redux-mock-store": "^1.2.3",
|
||||
"redux-throttle": "0.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"scratch-audio": "0.1.0-prerelease.20200528195344",
|
||||
"scratch-blocks": "0.1.0-prerelease.20200818140148",
|
||||
"scratch-gui": "github:LLK/scratch-gui#scratch-desktop",
|
||||
"scratch-l10n": "3.10.20200812030801",
|
||||
"scratch-paint": "0.2.0-prerelease.20200813210710",
|
||||
"scratch-render": "0.1.0-prerelease.20200820192709",
|
||||
"scratch-storage": "1.3.3",
|
||||
"scratch-svg-renderer": "0.2.0-prerelease.20200610220938",
|
||||
"scratch-vm": "0.2.0-prerelease.20200820211625",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"startaudiocontext": "1.2.1",
|
||||
"style-loader": "^0.23.0",
|
||||
"svg-to-image": "1.1.3",
|
||||
"text-encoding": "0.7.0",
|
||||
"to-style": "1.3.3",
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"uuid": "^8.0.0",
|
||||
"wav-encoder": "1.3.0",
|
||||
"web-audio-test-api": "^0.5.2",
|
||||
"webpack": "^4.6.0",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.3",
|
||||
"xhr": "2.5.0"
|
||||
"webpack": "^4.43.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"upath": "^1.0.5"
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
const fs = require('fs');
|
||||
|
||||
const desktopPackage = require('../package.json');
|
||||
const desktopRawPackage = require('../package-deps.json');
|
||||
const guiPackage = require('scratch-gui/package.json');
|
||||
|
||||
/**
|
||||
* Sort an object's keys.
|
||||
* @param {object} obj - the object whose keys should be sorted.
|
||||
* @returns {object} - a new object with the same keys and values, but the keys are sorted by {@link Array#sort}.
|
||||
*/
|
||||
const sortObject = obj => Object
|
||||
.keys(obj)
|
||||
.sort()
|
||||
.reduce(
|
||||
(accumulator, currentKey) => {
|
||||
accumulator[currentKey] = obj[currentKey];
|
||||
return accumulator;
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
/**
|
||||
* Make a shallow comparison of two objects, returning true if they match. This shallow comparison returns true iff:
|
||||
* - the two objects have the same number of keys, AND
|
||||
* - each key of obj1 is present in obj2 (via hasOwnProperty), AND
|
||||
* - the value associated with each key in obj1 matches (using ===) the value associated with the same key in obj2
|
||||
* Note that the order of keys is not compared.
|
||||
* @param {object} obj1 - the first object to compare
|
||||
* @param {object} obj2 - the second object to compare
|
||||
* @returns {boolean} - true if the objects are shallow-identical.
|
||||
*/
|
||||
const shallowCompare = (obj1, obj2) =>
|
||||
Object.keys(obj1).length === Object.keys(obj2).length &&
|
||||
Object.keys(obj1).every(k => Object.prototype.hasOwnProperty.call(obj2, k) && (obj1[k] === obj2[k]));
|
||||
|
||||
/**
|
||||
* Merge `scratch-gui` and `scratch-desktop` dependencies:
|
||||
* 1. Merge the dependencies found in `scratch-gui/package.json` with those in `package-deps.json`.
|
||||
* 2. Report statistics.
|
||||
* 3. If the result differs from `package.json`, rewrite `package.json` with the new dependencies and print a warning.
|
||||
*/
|
||||
const rebuildDeps = () => {
|
||||
const oldDevDependencies = desktopPackage.devDependencies;
|
||||
desktopPackage.devDependencies = sortObject(Object.assign(
|
||||
{},
|
||||
guiPackage.devDependencies,
|
||||
desktopRawPackage.devDependencies
|
||||
));
|
||||
|
||||
console.log(`Direct dependencies (desktop / gui / merged): ${
|
||||
Object.keys(desktopRawPackage.devDependencies).length} / ${
|
||||
Object.keys(guiPackage.devDependencies).length} / ${
|
||||
Object.keys(desktopPackage.devDependencies).length}`);
|
||||
if (shallowCompare(oldDevDependencies, desktopPackage.devDependencies)) {
|
||||
console.log('Dependencies in package.json were already up-to-date.');
|
||||
} else {
|
||||
let newDesktopPackage = JSON.stringify(desktopPackage, null, 2);
|
||||
newDesktopPackage += '\n';
|
||||
fs.writeFileSync('package.json', newDesktopPackage);
|
||||
console.warn(
|
||||
'\n', // NPM adds a prefix to all BUT the first line, so this makes the remaining lines format correctly
|
||||
'***\n',
|
||||
'*** Dependencies in package.json have been updated! Please re-run npm to install these updates.\n',
|
||||
'***\n'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
rebuildDeps();
|
Loading…
Reference in a new issue