Skip to content

Commit 4d7b754

Browse files
zpaofson
authored andcommitted
Use npm script hooks to avoid && in deploy script (facebook#1324)
1 parent a90e2b2 commit 4d7b754

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/react-scripts/scripts/build.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ function build(previousSizeMap) {
181181
console.log(' ' + chalk.dim('// ...'));
182182
console.log(' ' + chalk.yellow('"scripts"') + ': {');
183183
console.log(' ' + chalk.dim('// ...'));
184-
console.log(' ' + chalk.yellow('"deploy"') + ': ' + chalk.yellow('"npm run build&&gh-pages -d build"'));
184+
console.log(' ' + chalk.yellow('"predeploy"') + ': ' + chalk.yellow('"npm run build",'));
185+
console.log(' ' + chalk.yellow('"deploy"') + ': ' + chalk.yellow('"gh-pages -d build"'));
185186
console.log(' }');
186187
console.log();
187188
console.log('Then run:');

packages/react-scripts/template/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1132,17 +1132,18 @@ To publish it at [https://myusername.github.io/my-app](https://myusername.github
11321132
npm install --save-dev gh-pages
11331133
```
11341134
1135-
Add the following script in your `package.json`:
1135+
Add the following scripts in your `package.json`:
11361136
11371137
```js
11381138
// ...
11391139
"scripts": {
11401140
// ...
1141-
"deploy": "npm run build&&gh-pages -d build"
1141+
"predeploy": "npm run build",
1142+
"deploy": "gh-pages -d build"
11421143
}
11431144
```
11441145
1145-
(Note: the lack of whitespace is intentional.)
1146+
The `predeploy` script will run automatically before `deploy` is run.
11461147
11471148
#### Step 3: Deploy the site by running `npm run deploy`
11481149

0 commit comments

Comments
 (0)