Skip to content

Commit

Permalink
style: fix some spec errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cpselvis committed Nov 27, 2019
1 parent 073bfc2 commit a10c8ba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 70 deletions.
4 changes: 2 additions & 2 deletions packages/feflow-cli/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const printBanner = () => {
console.log(chalk.green(data));
console.log(chalk.green(` Feflow,current version: v${pkg.version}, homepage: https://github.com/Tencent/feflow `));
console.log(chalk.green(' (c) powered by Tencent, aims to improve front end workflow. '));
console.log(chalk.green(' Run feflow --help to see usage. '));
console.log(chalk.green(' Run fef --help to see usage. '));
});
}

Expand All @@ -58,7 +58,7 @@ export default function entry() {

let cmd: any = args._.shift();

if (!cmd) {
if (!cmd && !args.h && !args.help) {
printBanner();
return;
}
Expand Down
60 changes: 0 additions & 60 deletions packages/feflow-cli/src/cli/upgrade.ts

This file was deleted.

18 changes: 11 additions & 7 deletions packages/feflow-cli/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ export default class Feflow {
async init(cmd: string) {
if (cmd === 'config') {
await this.initClient();
await this.checkCliUpdate()
await this.loadNative();
} else {
await this.initClient();
await this.checkCliUpdate()
await this.initPackageManager();
await this.checkCliUpdate();
await this.checkUpdate();
await this.loadNative();
await loadPlugins(this);
Expand Down Expand Up @@ -85,7 +84,7 @@ export default class Feflow {
}

initPackageManager() {
const { root } = this;
const { root, logger } = this;

return new Promise<any>((resolve, reject) => {
if (!this.config || !this.config.packageManager) {
Expand Down Expand Up @@ -137,6 +136,8 @@ export default class Feflow {
});
}
return;
} else {
logger.debug('Use packageManager is: ', this.config.packageManager);
}
resolve();
});
Expand Down Expand Up @@ -295,22 +296,25 @@ export default class Feflow {

async checkCliUpdate() {
const { version, config, configPath } = this;
if (!config) {
return;
}
if (config.lastUpdateCheck && (+new Date() - parseInt(config.lastUpdateCheck, 10)) <= 1000 * 3600 * 24) {
return;
}
const packageManager = config.packageManager;
const registryUrl = await getRegistryUrl(packageManager);
const latestVersion: any = await packageJson('@feflow/cli', 'latest', registryUrl)
const latestVersion: any = await packageJson('@feflow/cli', 'latest', registryUrl);
if (semver.gt(latestVersion, version)) {
const askIfUpdateCli = [{
type: "confirm",
name: "ifUpdate",
message: `${chalk.yellow(`@feflow/cli's latest version is ${chalk.green(`${latestVersion}`)} but your version is ${chalk.red(`${version}`)}, Do your want to update it?`)}`,
message: `${chalk.yellow(`@feflow/cli's latest version is ${chalk.green(`${latestVersion}`)}, but your version is ${chalk.red(`${version}`)}, Do you want to update it?`)}`,
default: true
}]
const answer = await inquirer.prompt(askIfUpdateCli)
const answer = await inquirer.prompt(askIfUpdateCli);
if (answer.ifUpdate) {
await this.updateCli(packageManager)
await this.updateCli(packageManager);
} else {
safeDump({
...config,
Expand Down
2 changes: 1 addition & 1 deletion packages/feflow-cli/src/core/native/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const showHelp = (commands: Array<Object>) => {
const sections = [
{
header: 'Usage',
content: '$ feflow [options] [command]'
content: '$ fef [options] [command]'
},
{
header: 'Commands',
Expand Down

0 comments on commit a10c8ba

Please sign in to comment.