Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(package.json): Serverless v4 support. #271

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
fail-fast: false
matrix:
serverless: ['1', '2', '3']
node: [ '14', '15', '16', '18', '19', '20', '21' ]
serverless: ['2', '3', '4']
node: [ '18', '20', '22' ]
Comment on lines +16 to +17
Copy link
Owner Author

@neverendingqs neverendingqs Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: update CHANGELOG with changes to serverless and Node.js support.

Rationale:

  • serverless@1 doesn't seem to support package.patterns:, causing a circular reference in integration tests (see below)
  • serverless@4 requires at least Node.js v18 and it would be simplest to just support active LTS versions

name: CI (Node v${{ matrix.node }}, serverless@${{ matrix.serverless }})
steps:
- uses: actions/checkout@v2
Expand All @@ -32,23 +32,26 @@ jobs:
# Some versions of npm install peer dependencies
npm i serverless@${{ matrix.serverless }}
npx serverless --version
npm link ../../

npx serverless package --stage production

# Must match value of `TEST_VAR` in `.env.production`
cat .serverless/cloudformation-template-update-stack.json | grep cf5bb467-9052-4a34-b318-f6df31644229
working-directory: examples/simple-express-app
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}

- name: publish
# Only publish (maybe) for one version of Node, and only on 'master'
if: ${{ matrix.node == 14 && matrix.serverless == '3' && github.ref == 'refs/heads/master' }}
if: ${{ matrix.node == 22 && matrix.serverless == '3' && github.ref == 'refs/heads/master' }}
run: npm run deploy
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- name: Coveralls
# Only send coverage details for one version of Node
if: ${{ matrix.node == 14 }}
if: ${{ matrix.node == 22 }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
80 changes: 16 additions & 64 deletions examples/simple-express-app/package-lock.json

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

5 changes: 1 addition & 4 deletions examples/simple-express-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"express": "^4.18.2",
"serverless-http": "^3.2.0"
},
"devDependencies": {
"serverless-dotenv-plugin": "^6.0.0"
},
Comment on lines -16 to -18
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing issue: uses a specific version instead of the version in the PR. This change along with the npm link ../../ addition should resolve this.

"peerDependencies": {
"serverless": "1 || 2 || pre-3 || 3"
"serverless": "2 || pre-3 || 3 || 4"
}
}
4 changes: 4 additions & 0 deletions examples/simple-express-app/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

service: my-express-application

package:
patterns:
- '!node_modules/serverless-dotenv-plugin/**'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid circular references due to symlinks.


plugins:
- ../../

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"sinon-chai": "^3.7.0"
},
"peerDependencies": {
"serverless": "1 || 2 || pre-3 || 3"
"serverless": "2 || pre-3 || 3 || 4"
}
}
Loading