liferay-npm-scripts
Usage
npm install --save-dev liferay-npm-scripts
package.json
{
"scripts": {
"build": "liferay-npm-scripts build",
"eject": "liferay-npm-scripts eject"
}
}
Scripts Available
build
Build script that compiles all necessary javascript, soy, and bundles it together using liferay-npm-bundler
.
liferay-npm-scripts build
Do you have soy dependencies? build
should automatically detect them.
Do you need to use liferay-npm-bridge-generator
? Just add a .npmbridgerc
file and follow the configuration options here.
lint
liferay-npm-scripts lint
Lint calls check-source-formatting
for the globs specified in liferay-npm-scripts.
format
liferay-npm-scripts format
Format calls check-source-formatting
with the --inline-edit
flag for the globs specified in your .liferaynpmscriptsrc
configuration. Or defaults seen here.
test
liferay-npm-scripts test
Runs jest
with a default configuration specified in jest.json. You can override or add any additional configuration by following jest documentaion.
Additionally if you want to use any flags for jest, such as --watch
you can do so.
For example
liferay-npm-scripts test --watch
eject
Note: this is a one-way operation. Once you eject, you can't go back.
liferay-npm-scripts eject
Eject will remove liferay-npm-scripts
as a dependency and write all of the necessary configuration files and replace npm scripts. To see the before and after, check out the example.
Config
If you need to add additional configuration you can do so by creating a .liferaynpmscriptsrc
file at the root of your project. The default configuration of this file can be seen here.
Other Config
If you need more flexibility over babel or the bundler. You can still add a .babelrc
or .npmbundlerrc
which will be merged with the default settings this tool provides. Default Babel Config, Default Bundler Config
For more control over lint
and format
, follow the configuration options here
Want to use a different NODE_ENV
? Try doing something like
NODE_ENV=development liferay-npm-scripts build