diff --git a/.circleci/config.yml b/.circleci/config.yml index 5bc9014..c2d40d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,33 +3,13 @@ workflows: macos: jobs: - build_for_macos: - context: code-sign-generic + context: code-sign-macOS windows: jobs: - build_for_windows: context: code-sign-generic orbs: windows: circleci/windows@2.2.0 -commands: - shared_build_steps: - description: "The build steps which are the same on all platforms. Does not include 'checkout'" - steps: - - restore_cache: - keys: - - npm-cache-{{ arch }}-{{ checksum "package-lock.json" }} - - run: - name: Install scratch-desktop dependencies - command: npm ci - - save_cache: # save cache BEFORE doing anything special with scratch-gui - paths: - - node_modules/ - key: npm-cache-{{ arch }}-{{ checksum "package-lock.json" }} - - run: - name: Install scratch-gui dependencies - command: cd node_modules/scratch-gui && npm install - - run: - name: Build - command: npm run dist jobs: build_for_macos: macos: @@ -58,3 +38,23 @@ jobs: mv dist/{Scratch*.appx,Scratch*.exe} Artifacts/ - store_artifacts: path: Artifacts/ +commands: + shared_build_steps: + description: The build steps which are the same on all platforms. Does not include 'checkout' + steps: + - restore_cache: + keys: + - npm-cache-{{ arch }}-{{ checksum "package-lock.json" }} + - run: + name: Print NPM cache root + command: npm config get cache + - run: + name: Install scratch-desktop dependencies + command: npm ci + - save_cache: + paths: + - node_modules/ + key: npm-cache-{{ arch }}-{{ checksum "package-lock.json" }} + - run: + name: Build + command: npm run dist diff --git a/package.json b/package.json index 175e1ca..52b5876 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,11 @@ "version": "3.12.0", "license": "BSD-3-Clause", "scripts": { + "postinstall": "node ./scripts/npm-in-gui.js install", "start": "electron-webpack dev --bail --display-error-details --env.minify=false", - "build-gui": "node ./scripts/run-in-gui.js build", - "watch-gui": "node ./scripts/run-in-gui.js watch", - "delete-gui": "rimraf ./node_modules/scratch-gui", - "install-gui": "cd ./node_modules/scratch-gui && npm i", - "clean": "rimraf ./dist/ ./static/assets/", + "build-gui": "node ./scripts/npm-in-gui.js run build", + "watch-gui": "node ./scripts/npm-in-gui.js run watch", + "clean": "rimraf ./dist ./static/assets ./node_modules/scratch-gui/build ./node_modules/scratch-gui/dist", "compile": "rimraf ./dist/ && electron-webpack --bail --display-error-details --env.minify=false", "fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js", "dist": "npm run build-gui && npm run fetch && npm run compile -p && node ./scripts/electron-builder-wrapper.js", diff --git a/scripts/run-in-gui.js b/scripts/npm-in-gui.js similarity index 92% rename from scripts/run-in-gui.js rename to scripts/npm-in-gui.js index 5d2f78e..f879bfd 100644 --- a/scripts/run-in-gui.js +++ b/scripts/npm-in-gui.js @@ -3,8 +3,6 @@ const path = require('path'); // process.argv: ['node', 'run-in-gui.js', 'foo', ...] const args = process.argv.slice(2); -args.unshift('run'); -// args: ['run', 'foo', ...] // copy environment (including PATH) then add or replace BUILD_MODE and STATIC_PATH const env = {