Skip to content

Commit 695d3f1

Browse files
refactor: [UEPR-43] Changed prepublish script to prepare
1 parent 87bc644 commit 695d3f1

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.github/actions/install-dependencies/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ runs:
3131
path: |
3232
node_modules
3333
packages/*/node_modules
34+
packages/*/src/generated
3435
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
3536
- if: steps.restore-node-modules-cache.outputs.cache-hit != 'true'
3637
name: Install NPM dependencies
@@ -43,4 +44,5 @@ runs:
4344
path: |
4445
node_modules
4546
packages/*/node_modules
47+
packages/*/src/generated
4648
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}

packages/scratch-gui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "npm run clean && webpack",
1515
"clean": "rimraf ./build ./dist",
1616
"deploy": "touch build/.nojekyll && gh-pages -t -d build -m \"[skip ci] Build for $(git log --pretty=format:%H -n1)\"",
17-
"prepublish": "node scripts/prepublish.mjs",
17+
"prepare": "node scripts/prepare.mjs",
1818
"prune": "./prune-gh-pages.sh",
1919
"i18n:push": "tx-push-src scratch-editor interface translations/en.json",
2020
"i18n:src": "rimraf ./translations/messages/src && babel src > tmp.js && rimraf tmp.js && build-i18n-src ./translations/messages/src ./translations/",

packages/scratch-gui/scripts/prepublish.mjs renamed to packages/scratch-gui/scripts/prepare.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// From the NPM docs:
22
// "If you need to perform operations on your package before it is used, in a way that is not dependent on the
3-
// operating system or architecture of the target system, use a prepublish script."
3+
// operating system or architecture of the target system, use a prepare script."
44
// Once this step is complete, a developer should be able to work without an Internet connection.
55
// See also: https://docs.npmjs.com/cli/using-npm/scripts
66

@@ -100,7 +100,7 @@ const downloadMicrobitHex = async () => {
100100
fs.writeFileSync(
101101
absoluteGeneratedFile,
102102
[
103-
'// This file is generated by scripts/prepublish.mjs',
103+
'// This file is generated by scripts/prepare.mjs',
104104
'// Do not edit this file directly',
105105
'// This file relies on a loader to turn this `require` into a URL',
106106
`module.exports = require('${requirePath}');`,
@@ -110,13 +110,13 @@ const downloadMicrobitHex = async () => {
110110
console.info(`Wrote ${relativeGeneratedFile}`);
111111
};
112112

113-
const prepublish = async () => {
113+
const prepare = async () => {
114114
await downloadMicrobitHex();
115115
};
116116

117-
prepublish().then(
117+
prepare().then(
118118
() => {
119-
console.info('Prepublish script complete');
119+
console.info('Prepare script complete');
120120
process.exit(0);
121121
},
122122
e => {

scripts/build-monorepo.sh

-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ build_scratch_gui () {
456456
cd ./monorepo.out/packages/scratch-gui
457457
use_node_version_from_nvmrc
458458
process_workspace_webpack_config "." "webpack.config.js"
459-
npm run prepublish
460459
npm run build
461460
cd -
462461
}

scripts/build-packages.sh

-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ npm run build
1515
cd -
1616

1717
cd ./packages/scratch-gui
18-
npm run prepublish
1918
NODE_ENV=production npm run build
2019
cd -

0 commit comments

Comments
 (0)