Change cli options

This commit is contained in:
soupette 2019-10-14 10:51:25 +02:00
parent bf84be65e1
commit 983839f538
5 changed files with 9 additions and 9 deletions

View File

@ -77,8 +77,8 @@ options: [--optimize]
- **strapi build**<br/>
Builds the administration panel without minimizing the assets
- **strapi build --optimize**<br/>
Builds the administration panel and minize the assets. The build duration takes longer
- **strapi build --no-optimization**<br/>
Builds the administration panel without minizing the assets. The build duration is faster.
::: note
You can specify a NODE_ENV to use the configurations in the `./config/environments/[development|staging|production]` folder.

View File

@ -44,7 +44,7 @@ Before running your server in production you need to build your admin panel for
::: tab "yarn" id="yarn-build"
```bash
NODE_ENV=production yarn build --optimize
NODE_ENV=production yarn build
```
:::
@ -52,7 +52,7 @@ NODE_ENV=production yarn build --optimize
::: tab "npm" id="npm-build"
```bash
NODE_ENV=production npm run build --optimize
NODE_ENV=production npm run build
```
:::

View File

@ -176,8 +176,8 @@ program
program
.command('build')
.option(
'--optimize',
'Build the Administration with assets optimization',
'--no-optimization',
'Build the Administration without assets optimization',
false
)
.description('Builds the strapi admin app')

View File

@ -10,7 +10,7 @@ const addSlash = require('../utils/addSlash');
/**
* `$ strapi build`
*/
module.exports = async ({ optimize }) => {
module.exports = async ({ optimization }) => {
const dir = process.cwd();
const env = process.env.NODE_ENV || 'development';
@ -39,7 +39,7 @@ module.exports = async ({ optimize }) => {
dir,
// front end build env is always production for now
env: 'production',
optimize: optimize || false,
optimize: optimization || false,
options: {
backend: adminBackend,
publicPath: addSlash(adminPath),

View File

@ -20,7 +20,7 @@ module.exports = async function({ build, watchAdmin }) {
// Don't run the build process if the admin is in watch mode
if (build && !watchAdmin && !fs.existsSync(path.join(dir, 'build'))) {
try {
execa.shellSync('npm run -s build', {
execa.shellSync('npm run -s build —— --no-optimization', {
stdio: 'inherit',
});
} catch (err) {