fix(cli): use remove instead of emptyDir in clean command (#5895) (#5904)

This commit is contained in:
neverland 2020-03-25 10:18:15 +08:00 committed by GitHub
parent 5f16f1fb6d
commit 3dd3a45cfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View File

@ -1,11 +1,18 @@
import { emptyDir } from 'fs-extra';
import { ES_DIR, LIB_DIR, DIST_DIR, SITE_DIST_DIR } from '../common/constant';
import { remove } from 'fs-extra';
import {
ES_DIR,
LIB_DIR,
DIST_DIR,
VETUR_DIR,
SITE_DIST_DIR,
} from '../common/constant';
export async function clean() {
await Promise.all([
emptyDir(ES_DIR),
emptyDir(LIB_DIR),
emptyDir(DIST_DIR),
emptyDir(SITE_DIST_DIR),
remove(ES_DIR),
remove(LIB_DIR),
remove(DIST_DIR),
remove(VETUR_DIR),
remove(SITE_DIST_DIR),
]);
}

View File

@ -23,6 +23,7 @@ export const ROOT = findRootDir(CWD);
export const ES_DIR = join(ROOT, 'es');
export const LIB_DIR = join(ROOT, 'lib');
export const DOCS_DIR = join(ROOT, 'docs');
export const VETUR_DIR = join(ROOT, 'vetur');
export const SITE_DIST_DIR = join(ROOT, 'site');
export const VANT_CONFIG_FILE = join(ROOT, 'vant.config.js');
export const PACKAGE_JSON_FILE = join(ROOT, 'package.json');

View File

@ -1,26 +1,25 @@
import markdownVetur from '@vant/markdown-vetur';
import { join } from 'path';
import { get } from 'lodash';
import {
ROOT,
SRC_DIR,
VETUR_DIR,
getVantConfig,
getPackageJson,
} from '../common/constant';
// generate vetur tags & attributes
export function genVeturConfig() {
const vantConfig = getVantConfig();
const pkgJson = getPackageJson();
const vantConfig = getVantConfig();
const options = get(vantConfig, 'build.vetur');
if (options) {
markdownVetur.parseAndWrite({
name: vantConfig.name,
version: pkgJson.version,
path: SRC_DIR,
test: /zh-CN\.md/,
outputDir: join(ROOT, 'vetur'),
version: pkgJson.version,
outputDir: VETUR_DIR,
...options,
});
}