fix(cli): yarn install --production error

This commit is contained in:
chenos 2022-06-02 14:44:10 +08:00
parent 5156cda89f
commit 8298d2a691
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,5 @@
const { Command } = require('commander');
const { isPackageValid } = require('../util');
/**
*
@ -15,5 +16,7 @@ module.exports = (cli) => {
require('./umi')(cli);
require('./upgrade')(cli);
require('./postinstall')(cli);
require('./create-plugin')(cli);
if (isPackageValid('@umijs/utils')) {
require('./create-plugin')(cli);
}
}

View File

@ -1,5 +1,5 @@
const { Command } = require('commander');
const { run, isDev } = require('../util');
const { run, isDev, isPackageValid } = require('../util');
const { resolve } = require('path');
const { existsSync } = require('fs');
const { readFile, writeFile } = require('fs').promises;
@ -21,6 +21,9 @@ module.exports = (cli) => {
const content = await readFile(resolve(cwd, '.env.example'), 'utf-8');
await writeFile(resolve(cwd, '.env'), content, 'utf-8');
}
if (!isPackageValid('umi')) {
return;
}
run('umi', ['generate', 'tmp'], {
stdio: 'pipe',
env: {