mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
build scratch-gui from source instead of using its build output
This commit is contained in:
parent
78d75dc3cf
commit
f3b8251408
6 changed files with 27 additions and 66 deletions
|
@ -18,7 +18,6 @@
|
|||
"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"
|
||||
}
|
||||
}
|
||||
|
|
21
package-lock.json
generated
21
package-lock.json
generated
|
@ -15577,27 +15577,6 @@
|
|||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
|
||||
},
|
||||
"source-map-loader": {
|
||||
"version": "0.2.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz",
|
||||
"integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async": "^2.5.0",
|
||||
"loader-utils": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
|
||||
"integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash": "^4.17.14"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map-resolve": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz",
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
"version": "3.13.1",
|
||||
"license": "BSD-3-Clause",
|
||||
"scripts": {
|
||||
"clean": "rimraf ./dist ./static/assets && node ./scripts/npm-in-gui.js run clean",
|
||||
"clean": "rimraf ./dist ./static/assets",
|
||||
"start": "electron-webpack dev --bail --display-error-details --env.minify=false",
|
||||
"compile": "npm run build-gui && electron-webpack --bail --display-error-details --env.minify=false",
|
||||
"compile": "electron-webpack --bail --display-error-details --env.minify=false",
|
||||
"fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js",
|
||||
"build": "npm run build:dev",
|
||||
"build:dev": "npm run compile && npm run doBuild -- --mode=dev",
|
||||
|
@ -19,9 +19,6 @@
|
|||
"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 .",
|
||||
"postinstall": "node ./scripts/npm-in-gui.js install",
|
||||
"build-gui": "node ./scripts/npm-in-gui.js run build",
|
||||
"watch-gui": "node ./scripts/npm-in-gui.js run watch",
|
||||
"rebuild-deps": "node ./scripts/rebuild-deps.js"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -129,7 +126,6 @@
|
|||
"scratch-svg-renderer": "0.2.0-prerelease.20200610220938",
|
||||
"scratch-vm": "0.2.0-prerelease.20200720182258",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"source-map-loader": "^0.2.4",
|
||||
"startaudiocontext": "1.2.1",
|
||||
"style-loader": "^0.23.0",
|
||||
"svg-to-image": "1.1.3",
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
const childProcess = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
// process.argv: ['node', 'run-in-gui.js', 'foo', ...]
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
// copy environment (including PATH) then add or replace BUILD_MODE and STATIC_PATH
|
||||
const env = {
|
||||
...process.env,
|
||||
BUILD_MODE: 'dist',
|
||||
STATIC_PATH: 'static'
|
||||
};
|
||||
|
||||
const child = childProcess.spawnSync(
|
||||
'npm', args,
|
||||
{
|
||||
cwd: path.join('node_modules', 'scratch-gui'),
|
||||
env,
|
||||
shell: true,
|
||||
stdio: 'inherit'
|
||||
}
|
||||
);
|
||||
|
||||
if (child.error) throw child.error;
|
||||
process.exit(child.status);
|
|
@ -1,4 +1,5 @@
|
|||
const childProcess = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
const electronPath = require('electron');
|
||||
const webpack = require('webpack');
|
||||
|
@ -49,9 +50,8 @@ const makeConfig = function (defaultConfig, options) {
|
|||
const shouldDisable = options.disableDefaultRulesForExtensions.some(
|
||||
ext => rule.test.test(`test.${ext}`)
|
||||
);
|
||||
if (shouldDisable) {
|
||||
console.log(`${options.name}: Discarding electron-webpack default rule for ${rule.test}`);
|
||||
}
|
||||
const statusWord = shouldDisable ? 'Discarding' : 'Keeping';
|
||||
console.log(`${options.name}: ${statusWord} electron-webpack default rule for ${rule.test}`);
|
||||
return !shouldDisable;
|
||||
});
|
||||
}
|
||||
|
@ -67,11 +67,6 @@ const makeConfig = function (defaultConfig, options) {
|
|||
loader: 'babel-loader',
|
||||
options: babelOptions
|
||||
},
|
||||
{
|
||||
test: sourceFileTest,
|
||||
loader: 'source-map-loader',
|
||||
enforce: 'pre'
|
||||
},
|
||||
{ // coped from scratch-gui
|
||||
test: /\.css$/,
|
||||
use: [{
|
||||
|
@ -114,7 +109,12 @@ const makeConfig = function (defaultConfig, options) {
|
|||
].concat(options.plugins || []),
|
||||
resolve: {
|
||||
cacheWithContext: false,
|
||||
symlinks: false
|
||||
symlinks: false,
|
||||
alias: {
|
||||
// act like scratch-gui has this line in its package.json:
|
||||
// "browser": "./src/index.js"
|
||||
'scratch-gui$': path.resolve(__dirname, 'node_modules', 'scratch-gui', 'src', 'index.js')
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -10,14 +10,26 @@ module.exports = defaultConfig =>
|
|||
{
|
||||
name: 'renderer',
|
||||
useReact: true,
|
||||
disableDefaultRulesForExtensions: ['js', 'jsx', 'css', 'svg', 'png', 'wav', 'gif', 'jpg'],
|
||||
disableDefaultRulesForExtensions: ['js', 'jsx', 'css', 'svg', 'png', 'wav', 'gif', 'jpg', 'ttf'],
|
||||
babelPaths: [
|
||||
path.resolve(__dirname, 'src', 'renderer')
|
||||
path.resolve(__dirname, 'src', 'renderer'),
|
||||
/node_modules[\\/]+scratch-[^\\/]+[\\/]+src/,
|
||||
/node_modules[\\/]+pify/,
|
||||
/node_modules[\\/]+@vernier[\\/]+godirect/
|
||||
],
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([{
|
||||
from: path.resolve(__dirname, 'node_modules', 'scratch-gui', 'dist', 'static'),
|
||||
to: 'static'
|
||||
from: 'node_modules/scratch-blocks/media',
|
||||
to: 'static/blocks-media'
|
||||
}]),
|
||||
new CopyWebpackPlugin([{
|
||||
from: 'extension-worker.{js,js.map}',
|
||||
context: 'node_modules/scratch-vm/dist/web'
|
||||
}]),
|
||||
new CopyWebpackPlugin([{
|
||||
from: 'src/lib/libraries/*.json',
|
||||
to: 'static/libraries',
|
||||
flatten: true
|
||||
}])
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue