Skip to content

Commit cc7d8fa

Browse files
committed
refactor: use prepack script instead of prepare
1 parent 5fc3ec6 commit cc7d8fa

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

.github/workflows/build-templates.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595

9696
- name: Build package
9797
run: |
98-
yarn workspace create-react-native-library prepare
98+
yarn workspace create-react-native-library prepack
9999
100100
- name: Get working directory
101101
run: |

.github/workflows/check-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
run: yarn typecheck
2525

2626
- name: Build packages
27-
run: yarn lerna run prepare
27+
run: yarn lerna run prepack

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ yarn add --dev react-native-builder-bob
7979

8080
See options below for more details.
8181

82-
1. Add `bob` to your `prepare` step:
82+
1. Add `bob` to your `prepack` step:
8383

8484
```js
8585
"scripts": {
86-
"prepare": "bob build"
86+
"prepack": "bob build"
8787
}
8888
```
8989

@@ -223,7 +223,7 @@ This builds the project according to the configuration. This is usually run as p
223223

224224
```json
225225
"scripts": {
226-
"prepare": "bob build"
226+
"prepack": "bob build"
227227
}
228228
```
229229

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"lint": "eslint \"**/*.{js,ts,tsx}\"",
1818
"typecheck": "tsc --noEmit",
19-
"watch": "concurrently 'yarn typecheck --watch' 'lerna run --parallel prepare -- --watch'"
19+
"watch": "concurrently 'yarn typecheck --watch' 'lerna run --parallel prepack -- --watch'"
2020
},
2121
"devDependencies": {
2222
"@arkweid/lefthook": "^0.7.7",

packages/create-react-native-library/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"registry": "https://registry.npmjs.org/"
4040
},
4141
"scripts": {
42-
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
42+
"prepack": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
4343
},
4444
"dependencies": {
4545
"cross-spawn": "^7.0.3",

packages/create-react-native-library/templates/common/$.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ jobs:
4545
uses: ./.github/actions/setup
4646

4747
- name: Build package
48-
run: yarn prepare
48+
run: yarn prepack

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"test": "jest",
3131
"typecheck": "tsc --noEmit",
3232
"lint": "eslint \"**/*.{js,ts,tsx}\"",
33-
"prepare": "bob build",
33+
"prepack": "bob build",
3434
"release": "release-it",
3535
"example": "yarn --cwd example",
3636
<% if (example === 'native' && turborepo) { -%>

packages/react-native-builder-bob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"registry": "https://registry.npmjs.org/"
3434
},
3535
"scripts": {
36-
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --source-maps --delete-dir-on-start"
36+
"prepack": "babel --extensions .ts,.tsx src --out-dir lib --source-maps --delete-dir-on-start"
3737
},
3838
"dependencies": {
3939
"@babel/core": "^7.18.5",

packages/react-native-builder-bob/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ yargs
196196
}
197197
}
198198

199-
const prepare = 'bob build';
199+
const prepack = 'bob build';
200200
const files = [
201201
source,
202202
output,
@@ -224,20 +224,20 @@ yargs
224224
}
225225
}
226226

227-
if (pkg.scripts?.prepare && pkg.scripts.prepare !== prepare) {
227+
if (pkg.scripts?.prepack && pkg.scripts.prepack !== prepack) {
228228
const { replace } = await prompts({
229229
type: 'confirm',
230230
name: 'replace',
231-
message: `Your package.json has the 'scripts.prepare' field set to '${pkg.scripts.prepare}'. Do you want to replace it with '${prepare}'?`,
231+
message: `Your package.json has the 'scripts.prepack' field set to '${pkg.scripts.prepack}'. Do you want to replace it with '${prepack}'?`,
232232
initial: true,
233233
});
234234

235235
if (replace) {
236-
pkg.scripts.prepare = prepare;
236+
pkg.scripts.prepack = prepack;
237237
}
238238
} else {
239239
pkg.scripts = pkg.scripts || {};
240-
pkg.scripts.prepare = prepare;
240+
pkg.scripts.prepack = prepack;
241241
}
242242

243243
if (

0 commit comments

Comments
 (0)