Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 14c2814

Browse files
Fixes #7 - Default NODE_ENV to production and allow it to be set by users
1 parent a79b00c commit 14c2814

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

packages/liferay-npm-scripts/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ If you need to add additional configuration you can do so by creating a `.lifera
8282
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](./src/config/babel.json), [Default Bundler Config](./src/config/npm-bundler.json)
8383

8484
For more control over `lint` and `format`, follow the configuration options [here](https://github.com/liferay/liferay-frontend-source-formatter#custom-configuration)
85+
86+
Want to use a different `NODE_ENV`? Try doing something like
87+
88+
```sh
89+
NODE_ENV=development liferay-npm-scripts build
90+
```

packages/liferay-npm-scripts/src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Do this as the first thing so that any code reading it knows the right env.
2+
if (!process.env.NODE_ENV) {
3+
process.env.NODE_ENV = 'production';
4+
}
5+
16
const fs = require('fs');
27
const minimist = require('minimist');
38
const inquirer = require('inquirer');

packages/liferay-npm-scripts/src/scripts/build.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Do this as the first thing so that any code reading it knows the right env.
2-
process.env.BABEL_ENV = 'production';
3-
process.env.NODE_ENV = 'production';
4-
51
const CWD = process.cwd();
62

73
const spawnSync = require('../utils/spawnSync');

0 commit comments

Comments
 (0)