Skip to content

Commit

Permalink
fix: serverless app layers (#903)
Browse files Browse the repository at this point in the history
Co-authored-by: Harry Chen <czy88840616@gmail.com>
  • Loading branch information
echosoar and czy88840616 authored Mar 14, 2021
1 parent 9e08c93 commit 73cd61a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion packages-serverless/serverless-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@midwayjs/bootstrap": "^2.8.11",
"@midwayjs/core": "^2.8.11",
"@midwayjs/gateway-common-http": "^1.2.41",
"@midwayjs/locate": "^1.4.1",
"@midwayjs/serverless-spec-builder": "^1.2.41",
"body-parser": "^1.19.0",
"express": "^4.17.1"
Expand Down
9 changes: 1 addition & 8 deletions packages-serverless/serverless-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import {
IMidwayFramework,
MidwayFrameworkType,
} from '@midwayjs/core';
import { isTypeScriptEnvironment } from '@midwayjs/bootstrap';
import { Server } from 'net';
import { start2 } from './start';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import { getSpecFile, loadSpec } from '@midwayjs/serverless-spec-builder';
import { createExpressGateway } from '@midwayjs/gateway-common-http';
import { findNpmModule, output404 } from './utils';
import { Locator } from '@midwayjs/locate';
import { StarterMap, TriggerMap } from './platform';

import { IServerlessApp, IServerlessAppOptions } from './interface';
Expand Down Expand Up @@ -195,12 +193,7 @@ export class Framework
}

// 分析项目结构
let currentBaseDir = baseDir;
if (isTypeScriptEnvironment()) {
const locator = new Locator(appDir);
const midwayLocatorResult = await locator.run({});
currentBaseDir = midwayLocatorResult.tsCodeRoot;
}
const currentBaseDir = baseDir;

const triggerMap = this.getTriggerMap();
const layers = this.getLayers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ describe('test/index.test.ts', () => {
}
let app;
beforeAll(async () => {
app = await createApp(cwd, {}, join(__dirname, '../src'));
app = await createApp(cwd, {
baseDir: join(cwd, 'src/apis'),
}, join(__dirname, '../src'));
});
afterAll(async () => {
await close(app);
Expand Down

0 comments on commit 73cd61a

Please sign in to comment.