Skip to content

Commit

Permalink
refactor: use 'prepare' instead of 'prepack'
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Sep 26, 2023
1 parent 93f2907 commit c6fc8e7
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

- name: Build package
run: |
yarn workspace create-react-native-library prepack
yarn workspace create-react-native-library prepare
- name: Get working directory
run: |
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
- name: Build library
working-directory: ${{ env.work_dir }}
run: |
yarn prepack
yarn prepare
- name: Build example (Web)
working-directory: ${{ env.work_dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
run: yarn typecheck

- name: Build packages
run: yarn lerna run prepack
run: yarn lerna run prepare
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ yarn add --dev react-native-builder-bob

See options below for more details.

1. Add `bob` to your `prepack` step:
1. Add `bob` to your `prepare` or `prepack` step:

```js
"scripts": {
"prepack": "bob build"
"prepare": "bob build"
}
```

Expand Down Expand Up @@ -226,7 +226,7 @@ This builds the project according to the configuration. This is usually run as p

```json
"scripts": {
"prepack": "bob build"
"prepare": "bob build"
}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"typecheck": "tsc --noEmit",
"watch": "concurrently 'yarn typecheck --watch' 'lerna run --parallel prepack -- --watch'"
"watch": "concurrently 'yarn typecheck --watch' 'lerna run --parallel prepare -- --watch'"
},
"devDependencies": {
"@arkweid/lefthook": "^0.7.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-react-native-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"prepack": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
},
"dependencies": {
"cross-spawn": "^7.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: ./.github/actions/setup

- name: Build package
run: yarn prepack
run: yarn prepare

<% if (project.native) { -%>
build-android:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"!**/.*"
],
"scripts": {
"example": "yarn workspace <%- project.slug -%>-example",
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
Expand All @@ -35,9 +36,8 @@
<% } else { -%>
"clean": "del-cli lib",
<% } -%>
"prepack": "bob build",
"release": "release-it",
"example": "yarn workspace <%- project.slug -%>-example"
"prepare": "bob build",
"release": "release-it"
},
"keywords": [
"react-native",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-builder-bob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"prepack": "babel --extensions .ts,.tsx src --out-dir lib --source-maps --delete-dir-on-start"
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --source-maps --delete-dir-on-start"
},
"dependencies": {
"@babel/core": "^7.18.5",
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native-builder-bob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ yargs
}
}

const prepack = 'bob build';
const prepare = 'bob build';
const files = [
source,
output,
Expand Down Expand Up @@ -236,20 +236,20 @@ yargs
}
}

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

if (replace) {
pkg.scripts.prepack = prepack;
pkg.scripts.prepare = prepare;
}
} else {
pkg.scripts = pkg.scripts || {};
pkg.scripts.prepack = prepack;
pkg.scripts.prepare = prepare;
}

if (
Expand Down

0 comments on commit c6fc8e7

Please sign in to comment.