Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
James Bourne committed Oct 14, 2019
2 parents fe6029d + 71c86c3 commit 3bd0693
Show file tree
Hide file tree
Showing 14 changed files with 10,134 additions and 9,163 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ rules:
lodash/preferred-alias: off
lodash/prop-shorthand: off
lodash/prefer-lodash-method: [ error, { ignoreObjects: [ BbPromise, path ] } ]
max-len: [ error, { code: 120, ignoreStrings: true, ignoreComments: true, ignoreTemplateLiterals: true } ]
9 changes: 4 additions & 5 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
linters:
"*.js":
- "prettier-eslint --write" # Run Prettier
- "eslint" # Run TSLint
- "git add"
"*.js":
- "prettier-eslint --write" # Run Prettier
- "eslint" # Run TSLint
- "git add"
13 changes: 13 additions & 0 deletions examples/typescript/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
["@babel/preset-typescript"]
]
}
3 changes: 3 additions & 0 deletions examples/typescript/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.webpack
.webpackCache
14 changes: 10 additions & 4 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
"author": "Nicola Peduzzi <thenikso@gmail.com> (http://nikso.net)",
"license": "MIT",
"devDependencies": {
"serverless": "^1.23.0",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-typescript": "^7.3.3",
"babel-loader": "^8.0.6",
"cache-loader": "^4.1.0",
"fork-ts-checker-webpack-plugin": "^1.4.3",
"serverless": "^1.49.0",
"serverless-webpack": "file:../../",
"ts-loader": "^2.3.7",
"typescript": "^2.5.3",
"webpack": "^3.8.1"
"typescript": "^3.5.3",
"webpack": "^4.38.0",
"webpack-node-externals": "^1.7.2"
}
}
19 changes: 16 additions & 3 deletions examples/typescript/serverless.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
service: serverless-webpack-typescript-example

package:
individually: true
# Add the serverless-webpack plugin
plugins:
- serverless-webpack

provider:
name: aws
runtime: nodejs6.10
runtime: nodejs10.x

functions:
hello:
handler: handler.hello
handler: src/handler.hello
events:
- http:
method: get
path: hello
integration: lambda
goodbye:
handler: src/handler2.goodbye
events:
- http:
method: get
path: goodbye
integration: lambda
custom:
webpack:
webpackConfig: 'webpack.config.js'
packager: 'yarn'
includeModules: true
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/typescript/src/handler2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const goodbye = (event, context, cb) => cb(null,
{ message: 'Goodbye Serverless Webpack (Typescript) v1.0! Your function executed successfully!', event }
);
21 changes: 13 additions & 8 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"compilerOptions": {
"sourceMap": true,
"lib": [
"es5",
"es6",
"dom",
"es2015",
"esnext.asynciterable"
]
"preserveConstEnums": true,
"strictNullChecks": true,
"inlineSources": true,
"inlineSourceMap": true,
"sourceRoot": "/",
"target": "es2017",
"outDir": ".build",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"lib": ["es2017"],
"rootDir": "./src",
"resolveJsonModule": true
}
}
34 changes: 22 additions & 12 deletions examples/typescript/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const slsw = require('serverless-webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

const isLocal = slsw.lib.webpack.isLocal;

module.exports = {
mode: isLocal ? 'development' : 'production',
entry: slsw.lib.entries,
externals: [nodeExternals()],
devtool: 'source-map',
resolve: {
extensions: [
'.js',
'.json',
'.ts',
'.tsx'
]
extensions: [ '.js', '.jsx', '.json', '.ts', '.tsx' ]
},
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
target: 'node',
module: {
rules: [
{
test: /\.ts(x?)$/,
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
],
loader: 'cache-loader',
options: {
cacheDirectory: path.resolve('.webpackCache')
}
},
'babel-loader'
]
}
]
}
},
plugins: [new ForkTsCheckerWebpackPlugin()]
};
Loading

0 comments on commit 3bd0693

Please sign in to comment.