✂️ Simplify package.json
Remove previous scripts
Since we add a configuration in scripts.json
, we don't need to maintain npm scripts in two places.
Now let's remove previous.
package.json
{
"scripts": {
"scripts": "better-scripts",
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test"
}
}
Edit config command
Now command yarn xxx
in config won't work, so we need change it to real command.
yarn start
→react-scripts start
yarn build
→react-scripts build
yarn test
→react-scripts test
scripts.json
{
"dev": {
"alias": "🌟 Dev",
"command": "react-scripts start",
"desc": "Start a development server"
},
"build": {
"alias": "📦 Build",
"command": "react-scripts build",
"desc": "Create a production build"
},
"test": {
"alias": "🧪 Test",
"command": "react-scripts test",
"desc": "Run tests"
}
}
Final
🎉 Great! Your package.json will always be clean and tidy.