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

fix: compile skip check #73

Merged
merged 2 commits into from
Mar 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/serverless-invoke/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { FaaSStarterClass, cleanTarget, compareFileChange } from './utils';
import { join, resolve, relative } from 'path';
import { existsSync, move, writeFileSync, ensureFileSync } from 'fs-extra';
import { loadSpec } from '@midwayjs/fcli-command-core';
import { loadSpec, getSpecFile } from '@midwayjs/fcli-command-core';
import { writeWrapper } from '@midwayjs/serverless-spec-builder';
import { AnalyzeResult, Locator } from '@midwayjs/locate';
import {
Expand Down Expand Up @@ -36,6 +36,7 @@ export abstract class InvokeCore implements IInvoke {
spec: any;
buildDir: string;
wrapperInfo: any;
specFile: string;
codeAnalyzeResult: AnalyzeResult;

constructor(options: InvokeOptions) {
Expand All @@ -44,6 +45,7 @@ export abstract class InvokeCore implements IInvoke {
this.baseDir = this.options.baseDir;
this.buildDir = resolve(this.baseDir, options.buildDir || 'dist');
this.spec = loadSpec(this.baseDir);
this.specFile = getSpecFile(this.baseDir).path;
}

protected async getStarter() {
Expand Down Expand Up @@ -98,7 +100,7 @@ export abstract class InvokeCore implements IInvoke {
const buildLogPath = resolve(this.buildDir, '.faasTSBuildTime.log');
if (existsSync(buildLogPath)) {
const fileChanges = await compareFileChange(
[ `${relative(baseDir, this.codeAnalyzeResult.tsCodeRoot)}/**/*` ],
[ this.specFile, `${relative(baseDir, this.codeAnalyzeResult.tsCodeRoot)}/**/*` ],
[ buildLogPath ],
{ cwd: baseDir }
);
Expand Down