Skip to main content

๐Ÿฅณ Add emoji and description

Previousโ€‹

Beforehand, we have npm scripts like this that need to add emoji and desc.

package.json
{
"scripts": {
"scripts": "better-scripts",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test"
}
}
tip

By default, better-scripts reads the scripts field in package.json if config is not found, but now we need to add some config for emoji and description.

Add descriptionโ€‹

Add a better-scripts field in pacakge.json and write command and description

package.json
{
"scripts": {...},
"better-scripts": {
"start": ["react-scripts start", "Start a development server"],
"build": ["react-scripts build", "Create a production build"],
"test": ["react-scripts test", "Run tests"]
}
}

scriptName: [command, desc]

Add emojiโ€‹

An array formed script value can only place command and desc, we need change it to an object in order to add emoji.

package.json
{
"scripts": {...},
"better-scripts": {
"dev": {
"alias": "๐ŸŒŸ Dev",
"command": "yarn start",
"desc": "Start a development server"
},
"build": {
"alias": "๐Ÿ“ฆ Build",
"command": "yarn build",
"desc": "Create a production build"
},
"test": {
"alias": "๐Ÿงช Test",
"command": "yarn test",
"desc": "Run tests"
}
}
}