Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r authored May 6, 2021
2 parents 456b4b3 + 540f600 commit 2984e8c
Show file tree
Hide file tree
Showing 25 changed files with 6,594 additions and 6,816 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
eslint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
name: ESLint

steps:
Expand All @@ -19,7 +19,7 @@ jobs:
fetch-depth: 2

- name: "Install Node.js"
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "12"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
publish-npm:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://registry.npmjs.org/
Expand Down
40 changes: 34 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fetch-depth: 2

- name: "Install Node.js"
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "${{ matrix.node }}"

Expand All @@ -39,12 +39,9 @@ jobs:
- name: "Run tests"
run: "npm run test"

- name: "Run tests"
run: "npm run test"

coverage:
name: "Upload coverage"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs:
- "mocha"

Expand All @@ -55,7 +52,7 @@ jobs:
fetch-depth: 2

- name: "Install Node.js"
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: "12"

Expand All @@ -69,3 +66,34 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

serverless-v1:
runs-on: ${{ matrix.os }}
name: Node.js ${{ matrix.node }} on ${{ matrix.os }} with Serverless v1

strategy:
matrix:
os:
- ubuntu-20.04
node:
- "14"

steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: "Install Node.js"
uses: actions/setup-node@v2
with:
node-version: "${{ matrix.node }}"

- name: "Install Serverless v1"
run: npm install serverless@"<2.0.0"

- name: "Install dependencies"
run: npm ci

- name: "Run tests"
run: "npm run test"
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change Log

* 5.4.2
* Regression Fix: Empty lines while stats: 'errors-only' ([#773][] @Enase)
* Add type to CLI options ([#774][] @j0k3r)
* Add Serverless v2 compatibility ([#775][] @nponeccop)
* Support local errors with NPM 7 workspaces ([#782][] @mikejpeters)
* Fix `excludeRegex` option and allow dotfiles to be packaged ([#780][] @l1b3r)
* Correctly handle packaging for function during `deploy -f` ([#794][] @pgrzesik)

[#773]: https://github.com/serverless-heaven/serverless-webpack/pull/773
[#774]: https://github.com/serverless-heaven/serverless-webpack/pull/774
[#775]: https://github.com/serverless-heaven/serverless-webpack/pull/775
[#782]: https://github.com/serverless-heaven/serverless-webpack/pull/782
[#780]: https://github.com/serverless-heaven/serverless-webpack/pull/780
[#794]: https://github.com/serverless-heaven/serverless-webpack/pull/794

* 5.4.1
* Display the zip method used ([#735][] @j0k3r)
* Dependabot should now updates package.json too ([#742][] @j0k3r)
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Coverage Status][ico-coverage]][link-coverage]
[![Contributors][ico-contributors]][link-contributors]

A Serverless v1.x plugin to build your lambda functions with [Webpack][link-webpack].
A Serverless v1.x & v2.x plugin to build your lambda functions with [Webpack][link-webpack].

This plugin is for you if you want to use the latest Javascript version with [Babel][link-babel];
use custom [resource loaders][link-webpack-loaders], optimize your packaged functions individually
Expand Down Expand Up @@ -302,6 +302,22 @@ custom:
```
> Note that only relative path is supported at the moment.


`peerDependencies` of all above external dependencies will also be packed into the Serverless
artifact. By default, `node_modules` in the same directory as `package.json` (current working directory
or specified by`packagePath`) will be used.

However in some configuration (like monorepo), `node_modules` is in parent directory which is different from
where `package.json` is. Set `nodeModulesRelativeDir` to specify the relative directory where `node_modules` is.

```yaml
# serverless.yml
custom:
webpack:
includeModules:
nodeModulesRelativeDir: '../../' # relative path to current working directory.
```

#### Runtime dependencies

If a runtime dependency is detected that is found in the `devDependencies` section and
Expand Down Expand Up @@ -463,7 +479,7 @@ regex you want to exclude).
# serverless.yml
custom:
webpack:
excludeRegex: /\.ts|test|\.map/
excludeRegex: \.ts|test|\.map
```

#### Keep output directory after packaging
Expand Down
8 changes: 4 additions & 4 deletions examples/babel-multiple-statically-entries/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7006,7 +7006,7 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.4.0"
version "5.4.1"
dependencies:
bestzip "^2.2.0"
bluebird "^3.7.2"
Expand Down Expand Up @@ -7331,9 +7331,9 @@ sshpk@^1.7.0:
tweetnacl "~0.14.0"

ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down
6 changes: 3 additions & 3 deletions examples/babel-webpack-4/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/include-external-npm-packages/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3608,7 +3608,7 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.4.0"
version "5.4.1"
dependencies:
bestzip "^2.2.0"
bluebird "^3.7.2"
Expand Down Expand Up @@ -3762,9 +3762,9 @@ sshpk@^1.7.0:
tweetnacl "~0.14.0"

ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down
18 changes: 9 additions & 9 deletions examples/multiple-statically-entries/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1951,10 +1951,10 @@ is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==

is-builtin-module@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.0.0.tgz#137d3d2425023a19a660fb9dd6ddfabe52c03466"
integrity sha512-/93sDihsAD652hrMEbJGbMAVBf1qc96kyThHQ0CAOONHaE3aROLpTjDe4WQ5aoC5ITHFxEq1z8XqSU7km+8amw==
is-builtin-module@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.1.0.tgz#6fdb24313b1c03b75f8b9711c0feb8c30b903b00"
integrity sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==
dependencies:
builtin-modules "^3.0.0"

Expand Down Expand Up @@ -3351,13 +3351,13 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.4.0"
version "5.4.1"
dependencies:
bestzip "^2.2.0"
bluebird "^3.7.2"
fs-extra "^9.1.0"
glob "^7.1.6"
is-builtin-module "^3.0.0"
is-builtin-module "^3.1.0"
lodash "^4.17.21"
semver "^7.3.5"
optionalDependencies:
Expand Down Expand Up @@ -3490,9 +3490,9 @@ split-string@^3.0.1, split-string@^3.0.2:
extend-shallow "^3.0.0"

ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down
8 changes: 4 additions & 4 deletions examples/typescript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7180,7 +7180,7 @@ serverless-offline@^6.5.0:
ws "^7.2.1"

"serverless-webpack@file:../..":
version "5.4.0"
version "5.4.1"
dependencies:
bestzip "^2.2.0"
bluebird "^3.7.2"
Expand Down Expand Up @@ -7505,9 +7505,9 @@ sshpk@^1.7.0:
tweetnacl "~0.14.0"

ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ class ServerlessWebpack {
this.options = options;

if (
(
(_.has(this.serverless, 'service.custom.webpack') &&
_.isString(this.serverless.service.custom.webpack) &&
_.endsWith(this.serverless.service.custom.webpack, '.ts')) ||
((_.has(this.serverless, 'service.custom.webpack') &&
_.isString(this.serverless.service.custom.webpack) &&
_.endsWith(this.serverless.service.custom.webpack, '.ts')) ||
(_.has(this.serverless, 'service.custom.webpack.webpackConfig') &&
_.endsWith(this.serverless.service.custom.webpack.webpackConfig, '.ts'))
) && !process[Symbol.for('ts-node.register.instance')]
_.endsWith(this.serverless.service.custom.webpack.webpackConfig, '.ts'))) &&
!process[Symbol.for('ts-node.register.instance')]
) {
try {
require('ts-node/register');
Expand Down Expand Up @@ -63,7 +62,8 @@ class ServerlessWebpack {
options: {
out: {
usage: 'Path to output directory',
shortcut: 'o'
shortcut: 'o',
type: 'string'
}
},
commands: {
Expand Down
2 changes: 1 addition & 1 deletion index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('ServerlessWebpack', () => {

_.set(serverless, 'service.custom.webpack.webpackConfig', 'webpack.config.ts');

const badDeps = function() {
const badDeps = function () {
new ServerlessWebpack(serverless, {});
};

Expand Down
7 changes: 6 additions & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ function ensureArray(obj) {
}

function getStatsLogger(statsConfig, consoleLog) {
return stats => consoleLog(stats.toString(statsConfig || defaultStatsConfig));
return stats => {
const statsOutput = stats.toString(statsConfig || defaultStatsConfig);
if (statsOutput) {
consoleLog(statsOutput);
}
};
}

function webpackCompile(config, logStats) {
Expand Down
Loading

0 comments on commit 2984e8c

Please sign in to comment.