Skip to content

Commit

Permalink
fix: error taking hook parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
blurooochen committed May 18, 2020
1 parent da0a8bc commit 634ab47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions packages/feflow-cli/src/core/native/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = (ctx: any) => {

if (/(.git)/.test(dependencies[0])) {
const repoUrl = dependencies[0];
const match = repoUrl.match(/\/([a-zA-Z0-9]*).git$/);
const match = repoUrl.match(/\/(.*).git$/);
const command = match && match[1];
let repoName: string;
ctx.logger.debug(`Repo name is: ${ command }`);
Expand All @@ -84,7 +84,10 @@ module.exports = (ctx: any) => {

writeDependencies(repoName, universalPkgJsonPath);
plugin.test.run();
plugin.postInstall.run();
plugin.postInstall.run([], (out: string, err?: any): boolean => {
out && console.log(out);
return err ? false : true;
});

ctx.logger.info('install success');
} else {
Expand Down
12 changes: 6 additions & 6 deletions packages/feflow-cli/src/core/schema/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export class Plugin {
this.command = new Command(this.ctx, this.path, config?.command);
this.autoUpdate = config['auto-update'] || false;
this.test = new Command(this.ctx, this.path, config?.test);
this.preInstall = new Command(this.ctx, this.path, config?.preInstall);
this.postInstall = new Command(this.ctx, this.path, config?.postInstall);
this.preRun = new Command(this.ctx, this.path, config?.preRun);
this.postRun = new Command(this.ctx, this.path, config?.postRun);
this.preUpgrade = new Command(this.ctx, this.path, config?.preUpgrade);
this.postUpgrade = new Command(this.ctx, this.path, config?.postUpgrade);
this.preInstall = new Command(this.ctx, this.path, config?.['pre-install']);
this.postInstall = new Command(this.ctx, this.path, config?.['post-install']);
this.preRun = new Command(this.ctx, this.path, config?.['pre-run']);
this.postRun = new Command(this.ctx, this.path, config?.['post-run']);
this.preUpgrade = new Command(this.ctx, this.path, config?.['pre-upgrade']);
this.postUpgrade = new Command(this.ctx, this.path, config?.['post-upgrade']);
}

async check() {
Expand Down

0 comments on commit 634ab47

Please sign in to comment.