feat(cli): find root dir

This commit is contained in:
陈嘉涵
2019-12-12 17:19:31 +08:00
parent 71415e467d
commit c86d3d166f
5 changed files with 35 additions and 21 deletions
+3 -3
View File
@@ -1,12 +1,12 @@
import { join } from 'path';
import { exec } from 'shelljs';
import { ROOT } from '../common/constant';
export function changelog(dist: string, cmd: { tag?: string }) {
const basepath = process.cwd();
const tag = cmd.tag || 'v1.0.0';
exec(`
basepath=${basepath}
basepath=${ROOT}
github_changelog_generator \
--header-label "# 更新日志" \
@@ -18,6 +18,6 @@ export function changelog(dist: string, cmd: { tag?: string }) {
--no-author \
--no-unreleased \
--since-tag ${tag} \
-o ${join(basepath, dist)}
-o ${join(ROOT, dist)}
`);
}
+3 -3
View File
@@ -1,7 +1,7 @@
import { runCLI } from 'jest';
import { setNodeEnv } from '../common';
import { genPackageEntry } from '../compiler/gen-package-entry';
import { CWD, JEST_CONFIG_FILE, PACKAGE_ENTRY_FILE } from '../common/constant';
import { ROOT, JEST_CONFIG_FILE, PACKAGE_ENTRY_FILE } from '../common/constant';
export function test(command: any) {
setNodeEnv('test');
@@ -11,10 +11,10 @@ export function test(command: any) {
});
const config = {
rootDir: CWD,
rootDir: ROOT,
watch: command.watch,
config: JEST_CONFIG_FILE
} as any;
runCLI(config, [CWD]);
runCLI(config, [ROOT]);
}