Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
fix: fix options.basedir default value (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Feb 22, 2020
1 parent 495a631 commit 04edc9f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/serverless-invoke/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export abstract class InvokeCore implements IInvoke {
constructor(options: InvokeOptions) {
options = this.formatOptions(options);
this.options = options;
this.baseDir = options.baseDir || process.cwd();
this.baseDir = this.options.baseDir;
this.buildDir = resolve(this.baseDir, options.buildDir || 'dist');
this.spec = loadSpec(this.baseDir);
}
Expand Down Expand Up @@ -108,20 +108,20 @@ export abstract class InvokeCore implements IInvoke {
incremental: this.options.incremental,
tsConfig: {
compilerOptions: {
sourceRoot: this.codeAnalyzeResult.tsCodeRoot // for sourceMap
}
sourceRoot: this.codeAnalyzeResult.tsCodeRoot, // for sourceMap
},
},
clean: this.options.clean
clean: this.options.clean,
});
} else {
await tsCompile(baseDir, {
tsConfigName: 'tsconfig.json',
tsConfig: {
compilerOptions: {
sourceRoot: resolve(baseDir, 'src') // for sourceMap
}
sourceRoot: resolve(baseDir, 'src'), // for sourceMap
},
},
clean: this.options.clean
clean: this.options.clean,
});
await move(join(baseDir, 'dist'), join(this.buildDir, 'dist'), opts);
}
Expand Down Expand Up @@ -219,6 +219,9 @@ export abstract class InvokeCore implements IInvoke {
}

private formatOptions(options: InvokeOptions) {
if (!options.baseDir) {
options.baseDir = process.cwd();
}
// 开启增量编译,则不自动清理目录
if (options.incremental) {
options.clean = false;
Expand Down

0 comments on commit 04edc9f

Please sign in to comment.