mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Merge pull request #4058 from franciscocpg/aws-nodejs-typescript
Adding aws-nodejs-typescript template
This commit is contained in:
commit
34dd46440e
@ -51,6 +51,10 @@ services:
|
||||
image: microsoft/dotnet:1.0.4-sdk
|
||||
volumes:
|
||||
- ./tmp/serverless-integration-test-aws-fsharp:/app
|
||||
aws-nodejs-typescript:
|
||||
image: node:6.10.3
|
||||
volumes:
|
||||
- ./tmp/serverless-integration-test-aws-nodejs-typescript:/app
|
||||
aws-nodejs-ecma-script:
|
||||
image: node:6.10.3
|
||||
volumes:
|
||||
|
||||
@ -41,6 +41,7 @@ To see a list of available templates run `serverless create --help`
|
||||
Most commonly used templates:
|
||||
|
||||
- aws-nodejs
|
||||
- aws-nodejs-typescript
|
||||
- aws-nodejs-ecma-script
|
||||
- aws-python
|
||||
- aws-python3
|
||||
|
||||
@ -51,6 +51,7 @@ serverless create --template aws-nodejs --path myService
|
||||
Here are the available runtimes for AWS Lambda:
|
||||
|
||||
* aws-nodejs
|
||||
* aws-nodejs-typescript
|
||||
* aws-nodejs-ecma-script
|
||||
* aws-python
|
||||
* aws-python3
|
||||
|
||||
@ -9,6 +9,7 @@ const userStats = require('../../utils/userStats');
|
||||
// class wide constants
|
||||
const validTemplates = [
|
||||
'aws-nodejs',
|
||||
'aws-nodejs-typescript',
|
||||
'aws-nodejs-ecma-script',
|
||||
'aws-python',
|
||||
'aws-python3',
|
||||
|
||||
@ -99,6 +99,26 @@ describe('Create', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate scaffolding for "aws-nodejs-typescript" template', () => {
|
||||
process.chdir(tmpDir);
|
||||
create.options.template = 'aws-nodejs-typescript';
|
||||
|
||||
return create.create().then(() => {
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'serverless.yml')))
|
||||
.to.be.equal(true);
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'handler.ts')))
|
||||
.to.be.equal(true);
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'tsconfig.json')))
|
||||
.to.be.equal(true);
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'package.json')))
|
||||
.to.be.equal(true);
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'webpack.config.js')))
|
||||
.to.be.equal(true);
|
||||
expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, '.gitignore')))
|
||||
.to.be.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate scaffolding for "aws-nodejs-ecma-script" template', () => {
|
||||
process.chdir(tmpDir);
|
||||
create.options.template = 'aws-nodejs-ecma-script';
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
# package directories
|
||||
node_modules
|
||||
jspm_packages
|
||||
|
||||
# Serverless directories
|
||||
.serverless
|
||||
|
||||
# Webpack directories
|
||||
.webpack
|
||||
@ -0,0 +1,3 @@
|
||||
export const hello = (event, context, cb) => cb(null,
|
||||
{ message: 'Go Serverless Webpack (Typescript) v1.0! Your function executed successfully!', event }
|
||||
);
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "aws-nodejs-typescript",
|
||||
"version": "1.0.0",
|
||||
"description": "Serverless webpack example using Typescript",
|
||||
"main": "handler.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"serverless-webpack": "^2.2.0",
|
||||
"ts-loader": "^2.3.1",
|
||||
"typescript": "^2.4.2",
|
||||
"webpack": "^3.3.0"
|
||||
},
|
||||
"author": "The serverless webpack authors (https://github.com/elastic-coders/serverless-webpack)",
|
||||
"license": "MIT"
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
service:
|
||||
name: aws-nodejs-typescript
|
||||
|
||||
# Add the serverless-webpack plugin
|
||||
plugins:
|
||||
- serverless-webpack
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
|
||||
functions:
|
||||
# Example with LAMBDA-PROXY integration
|
||||
# Invoking locally:
|
||||
# sls webpack invoke -f hello
|
||||
hello:
|
||||
handler: handler.hello
|
||||
events:
|
||||
- http:
|
||||
method: get
|
||||
path: hello
|
||||
integration: lambda
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
const path = require('path');
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
const slsw = require('serverless-webpack');
|
||||
|
||||
module.exports = {
|
||||
entry: slsw.lib.entries,
|
||||
output: {
|
||||
libraryTarget: 'commonjs',
|
||||
path: path.join(__dirname, '.webpack'),
|
||||
filename: '[name].js',
|
||||
},
|
||||
target: 'node',
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.ts(x?)$/, loader: 'ts-loader' },
|
||||
],
|
||||
},
|
||||
};
|
||||
@ -17,5 +17,6 @@ integration-test aws-scala-sbt sbt assembly
|
||||
integration-test aws-nodejs
|
||||
integration-test aws-python
|
||||
integration-test aws-python3
|
||||
integration-test aws-nodejs-typescript
|
||||
integration-test aws-nodejs-ecma-script
|
||||
integration-test google-nodejs
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user