This repository has been archived by the owner on Jul 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
170 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
packages/faas-cli-plugin-package/test/fixtures/aggregation/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
{} | ||
{ | ||
"dependencies": { | ||
"@midwayjs/faas": "*" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/faas-cli-plugin-package/test/fixtures/aggregation/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compileOnSave": true, | ||
"compilerOptions": { | ||
"target": "ES2018", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"inlineSourceMap":true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"stripInternal": true, | ||
"pretty": true, | ||
"declaration": true, | ||
"outDir": "dist" | ||
}, | ||
"exclude": [ | ||
"dist", | ||
"node_modules", | ||
"test" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/faas-cli-plugin-package/test/fixtures/noYaml/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"@midwayjs/faas": "*" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/faas-cli-plugin-package/test/fixtures/noYaml/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
service: serverless-midway-test | ||
|
||
provider: | ||
name: aliyun | ||
runtime: nodejs8 | ||
credentials: ./.aliyun_credentials # path must be absolute |
14 changes: 14 additions & 0 deletions
14
packages/faas-cli-plugin-package/test/fixtures/noYaml/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Func, Inject, Provide } from '@midwayjs/decorator'; | ||
import { FaaSContext } from '@midwayjs/faas'; | ||
|
||
@Provide() | ||
@Func('service.handler') | ||
export class Service { | ||
|
||
@Inject() | ||
ctx: FaaSContext; // context | ||
|
||
async handler() { | ||
return 'hello world'; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/faas-cli-plugin-package/test/fixtures/noYaml/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compileOnSave": true, | ||
"compilerOptions": { | ||
"target": "ES2018", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"inlineSourceMap": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"stripInternal": true, | ||
"pretty": true, | ||
"declaration": true, | ||
"outDir": "dist", | ||
"sourceRoot": "" | ||
}, | ||
"exclude": [ | ||
"dist", | ||
"node_modules", | ||
"test" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CommandHookCore, loadSpec } from '@midwayjs/fcli-command-core'; | ||
import { PackagePlugin } from '../src/index'; | ||
import { AliyunFCPlugin } from '../../faas-cli-plugin-fc/src/index'; | ||
import { resolve } from 'path'; | ||
import { remove } from 'fs-extra'; | ||
import { transform } from '@midwayjs/serverless-spec-builder'; | ||
import * as assert from 'assert'; | ||
|
||
describe('/test/noyaml.test.ts', () => { | ||
describe('integration project build', () => { | ||
it('aggregation package', async () => { | ||
const baseDir = resolve(__dirname, 'fixtures/noYaml'); | ||
const buildDir = resolve(baseDir, './.serverless'); | ||
await remove(buildDir); | ||
const core = new CommandHookCore({ | ||
config: { | ||
servicePath: baseDir, | ||
}, | ||
commands: ['package'], | ||
service: loadSpec(baseDir), | ||
provider: 'aliyun', | ||
options: {}, | ||
log: console, | ||
}); | ||
core.addPlugin(PackagePlugin); | ||
core.addPlugin(AliyunFCPlugin); | ||
await core.ready(); | ||
await core.invoke(['package']); | ||
const yaml = transform(resolve(buildDir, 'template.yml')); | ||
assert(yaml.Resources['serverless-midway-test']['service'].Properties.Handler === 'service.handler'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.