Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 2242c47

Browse files
authored
Merge branch 'master' into patch-1
2 parents 1ac00ad + 1e280d4 commit 2242c47

24 files changed

+229
-172
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10
9+
ignore:
10+
- dependency-name: eslint
11+
versions:
12+
- "> 7.22.0"

.github/workflows/lint.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
fail-fast: false
10-
matrix:
11-
os: [ubuntu-latest]
12-
node-version: [12]
7+
runs-on: ubuntu-latest
138
steps:
149
- uses: actions/checkout@v2
1510

1611
- name: Set up Node ${{ matrix.node-version }}
1712
uses: actions/setup-node@v1
1813
with:
19-
node-version: ${{ matrix.node-version }}
14+
node-version: 14
2015

2116
- name: Install deps
2217
run: npm install

.github/workflows/publish.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ jobs:
66
publish-npm:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: actions/setup-node@v1
9+
- uses: actions/checkout@v2
10+
11+
- uses: actions/setup-node@v2
1112
with:
12-
version: 12
13+
version: 14
1314
registry-url: https://registry.npmjs.org/
15+
1416
- run: npm publish
1517
env:
1618
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-latest, windows-latest, macOS-latest]
12-
python-version: [3.6, 2.7]
13-
node-version: [12]
12+
python-version: [2.7, 3.6]
1413
steps:
1514
- uses: actions/checkout@v2
1615

@@ -19,10 +18,10 @@ jobs:
1918
with:
2019
python-version: ${{ matrix.python-version }}
2120

22-
- name: Set up Node ${{ matrix.node-version }}
21+
- name: Set up Node
2322
uses: actions/setup-node@v1
2423
with:
25-
node-version: ${{ matrix.node-version }}
24+
node-version: 14
2625

2726
- name: Check python version
2827
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ __pycache__
4545

4646
#NODE STUFF
4747
package-lock.json
48+
yarn.lock

.tool-versions

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ custom:
105105
## :sparkles::pencil::sparkles: Poetry support
106106

107107
If you include a `pyproject.toml` and have `poetry` installed instead of a `requirements.txt` this will use
108-
`poetry export --without-hashes -f requirements.txt -o requirements.txt` to generate them. It is fully compatible with all options such as `zip` and
108+
`poetry export --without-hashes -f requirements.txt -o requirements.txt --with-credentials` to generate them. It is fully compatible with all options such as `zip` and
109109
`dockerizePip`. If you don't want this plugin to generate it for you, set the following option:
110110

111111
```yaml

index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ class ServerlessPythonRequirements {
151151
.then(cleanup)
152152
.then(removeVendorHelper);
153153

154+
const setupArtifactPathCapturing = () => {
155+
// Reference:
156+
// https://github.com/serverless/serverless/blob/9591d5a232c641155613d23b0f88ca05ea51b436/lib/plugins/package/lib/packageService.js#L139
157+
// The packageService#packageFunction does set artifact path back to the function config.
158+
// As long as the function config's "package" attribute wasn't undefined, we can still use it
159+
// later to access the artifact path.
160+
for (const functionName in this.serverless.service.functions) {
161+
if (!serverless.service.functions[functionName].package) {
162+
serverless.service.functions[functionName].package = {};
163+
}
164+
}
165+
};
166+
154167
const before = () => {
155168
if (!isFunctionRuntimePython(arguments)) {
156169
return;
@@ -160,7 +173,8 @@ class ServerlessPythonRequirements {
160173
.then(pyprojectTomlToRequirements)
161174
.then(addVendorHelper)
162175
.then(installAllRequirements)
163-
.then(packRequirements);
176+
.then(packRequirements)
177+
.then(setupArtifactPathCapturing);
164178
};
165179

166180
const after = () => {

lib/clean.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function cleanup() {
1414
const artifacts = ['.requirements'];
1515
if (this.options.zip) {
1616
if (this.serverless.service.package.individually) {
17-
this.targetFuncs.forEach(f => {
17+
this.targetFuncs.forEach((f) => {
1818
artifacts.push(path.join(f.module, '.requirements.zip'));
1919
artifacts.push(path.join(f.module, 'unzip_requirements.py'));
2020
});
@@ -25,7 +25,7 @@ function cleanup() {
2525
}
2626

2727
return BbPromise.all(
28-
artifacts.map(artifact =>
28+
artifacts.map((artifact) =>
2929
fse.removeAsync(path.join(this.servicePath, artifact))
3030
)
3131
);
@@ -47,7 +47,7 @@ function cleanupCache() {
4747
const promises = [];
4848
glob
4949
.sync([path.join(cacheLocation, '*slspyc/')], { mark: true, dot: false })
50-
.forEach(file => {
50+
.forEach((file) => {
5151
promises.push(fse.removeAsync(file));
5252
});
5353
return BbPromise.all(promises);

lib/docker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function tryBindPath(serverless, bindPath, testFile) {
8181
`${bindPath}:/test`,
8282
'alpine',
8383
'ls',
84-
`/test/${testFile}`
84+
`/test/${testFile}`,
8585
];
8686
try {
8787
if (debug) serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
@@ -167,7 +167,7 @@ function getDockerUid(bindPath) {
167167
'stat',
168168
'-c',
169169
'%u',
170-
'/bin/sh'
170+
'/bin/sh',
171171
];
172172
const ps = dockerCommand(options);
173173
return ps.stdout.trim();

0 commit comments

Comments
 (0)