Skip to content

Commit d033ec9

Browse files
authored
Merge pull request #586 from bryantbiggs/chore/update-dependencies
chore: update dependencies to latest
2 parents 4c4aa2f + 72a3684 commit d033ec9

18 files changed

+89
-94
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ updates:
99
ignore:
1010
- dependency-name: eslint
1111
versions:
12-
- "> 5.16.0"
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.

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();

lib/inject.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ function injectRequirements(requirementsPath, packagePath, options) {
2121

2222
return fse
2323
.readFileAsync(packagePath)
24-
.then(buffer => JSZip.loadAsync(buffer))
25-
.then(zip =>
24+
.then((buffer) => JSZip.loadAsync(buffer))
25+
.then((zip) =>
2626
BbPromise.resolve(
2727
glob.sync([path.join(requirementsPath, '**')], {
2828
mark: true,
29-
dot: true
29+
dot: true,
3030
})
3131
)
32-
.map(file => [file, path.relative(requirementsPath, file)])
32+
.map((file) => [file, path.relative(requirementsPath, file)])
3333
.filter(
3434
([file, relativeFile]) =>
3535
!file.endsWith('/') &&
@@ -42,7 +42,7 @@ function injectRequirements(requirementsPath, packagePath, options) {
4242
.mapSeries(([file, relativeFile, fileStat]) =>
4343
zipFile(zip, relativeFile, fse.readFileAsync(file), {
4444
unixPermissions: fileStat.mode,
45-
createFolders: false
45+
createFolders: false,
4646
})
4747
)
4848
.then(() => writeZip(zip, packagePath))
@@ -61,16 +61,16 @@ function moveModuleUp(source, target, module) {
6161

6262
return fse
6363
.readFileAsync(source)
64-
.then(buffer => JSZip.loadAsync(buffer))
65-
.then(sourceZip =>
64+
.then((buffer) => JSZip.loadAsync(buffer))
65+
.then((sourceZip) =>
6666
sourceZip.filter(
67-
file =>
67+
(file) =>
6868
file.startsWith(module + '/') ||
6969
file.startsWith('serverless_sdk/') ||
7070
file.match(/^s_.*\.py/) !== null
7171
)
7272
)
73-
.map(srcZipObj =>
73+
.map((srcZipObj) =>
7474
zipFile(
7575
targetZip,
7676
srcZipObj.name.startsWith(module + '/')
@@ -96,18 +96,18 @@ function injectAllRequirements(funcArtifact) {
9696

9797
if (this.serverless.service.package.individually) {
9898
return BbPromise.resolve(this.targetFuncs)
99-
.filter(func =>
99+
.filter((func) =>
100100
(func.runtime || this.serverless.service.provider.runtime).match(
101101
/^python.*/
102102
)
103103
)
104-
.map(func => {
104+
.map((func) => {
105105
if (!get(func, 'module')) {
106106
set(func, ['module'], '.');
107107
}
108108
return func;
109109
})
110-
.map(func => {
110+
.map((func) => {
111111
if (func.module !== '.') {
112112
const artifact = func.package ? func.package.artifact : funcArtifact;
113113
const newArtifact = path.join(
@@ -122,7 +122,7 @@ function injectAllRequirements(funcArtifact) {
122122
return func;
123123
}
124124
})
125-
.map(func => {
125+
.map((func) => {
126126
return this.options.zip
127127
? func
128128
: injectRequirements(

lib/layer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function createLayers() {
3636
}-${this.serverless.providers.aws.getStage()}-python-requirements`,
3737
description:
3838
'Python requirements generated by serverless-python-requirements.',
39-
compatibleRuntimes: [this.serverless.service.provider.runtime]
39+
compatibleRuntimes: [this.serverless.service.provider.runtime],
4040
},
4141
this.options.layer
4242
);
@@ -55,11 +55,9 @@ function layerRequirements() {
5555

5656
this.serverless.cli.log('Packaging Python Requirements Lambda Layer...');
5757

58-
return BbPromise.bind(this)
59-
.then(zipRequirements)
60-
.then(createLayers);
58+
return BbPromise.bind(this).then(zipRequirements).then(createLayers);
6159
}
6260

6361
module.exports = {
64-
layerRequirements
62+
layerRequirements,
6563
};

lib/pip.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const {
1212
checkForAndDeleteMaxCacheVersions,
1313
sha256Path,
1414
getRequirementsWorkingPath,
15-
getUserCachePath
15+
getUserCachePath,
1616
} = require('./shared');
1717

1818
/**
@@ -22,7 +22,7 @@ const {
2222
* @return {string[][]} a list of valid commands.
2323
*/
2424
function filterCommands(commands) {
25-
return commands.filter(cmd => Boolean(cmd) && cmd.length > 0);
25+
return commands.filter((cmd) => Boolean(cmd) && cmd.length > 0);
2626
}
2727

2828
/**
@@ -129,7 +129,7 @@ function installRequirements(targetFolder, serverless, options) {
129129
Array.isArray(options.pipCmdExtraArgs) &&
130130
options.pipCmdExtraArgs.length > 0
131131
) {
132-
options.pipCmdExtraArgs.forEach(cmd => {
132+
options.pipCmdExtraArgs.forEach((cmd) => {
133133
const parts = cmd.split(/\s+/, 2);
134134
pipCmd.push(...parts);
135135
});
@@ -140,9 +140,11 @@ function installRequirements(targetFolder, serverless, options) {
140140
// Check if we're using the legacy --cache-dir command...
141141
if (options.pipCmdExtraArgs.indexOf('--cache-dir') > -1) {
142142
if (options.dockerizePip) {
143-
throw 'Error: You can not use --cache-dir with Docker any more, please\n' +
143+
throw (
144+
'Error: You can not use --cache-dir with Docker any more, please\n' +
144145
' use the new option useDownloadCache instead. Please see:\n' +
145-
' https://github.com/UnitedIncome/serverless-python-requirements#caching';
146+
' https://github.com/UnitedIncome/serverless-python-requirements#caching'
147+
);
146148
} else {
147149
serverless.cli.log('==================================================');
148150
serverless.cli.log(
@@ -239,7 +241,7 @@ function installRequirements(targetFolder, serverless, options) {
239241

240242
if (options.dockerEnv) {
241243
// Add environment variables to docker run cmd
242-
options.dockerEnv.forEach(function(item) {
244+
options.dockerEnv.forEach(function (item) {
243245
dockerCmd.push('-e', item);
244246
});
245247
}
@@ -256,7 +258,7 @@ function installRequirements(targetFolder, serverless, options) {
256258
'chown',
257259
'-R',
258260
`${process.getuid()}:${process.getgid()}`,
259-
'/var/task'
261+
'/var/task',
260262
]);
261263
} else {
262264
// Use same user so --cache-dir works
@@ -274,7 +276,7 @@ function installRequirements(targetFolder, serverless, options) {
274276
'chown',
275277
'-R',
276278
`${process.getuid()}:${process.getgid()}`,
277-
dockerDownloadCacheDir
279+
dockerDownloadCacheDir,
278280
]);
279281
}
280282
}
@@ -384,7 +386,7 @@ function filterRequirementsFile(source, target, options, serverless) {
384386
const noDeploy = new Set(options.noDeploy || []);
385387
const requirements = getRequirements(source);
386388
var prepend = [];
387-
const filteredRequirements = requirements.filter(req => {
389+
const filteredRequirements = requirements.filter((req) => {
388390
req = req.trim();
389391
if (req.startsWith('#')) {
390392
// Skip comments
@@ -440,7 +442,7 @@ function copyVendors(vendorFolder, targetFolder, serverless) {
440442
`Copying vendor libraries from ${vendorFolder} to ${targetFolder}...`
441443
);
442444

443-
fse.readdirSync(vendorFolder).map(file => {
445+
fse.readdirSync(vendorFolder).map((file) => {
444446
let source = path.join(vendorFolder, file);
445447
let dest = path.join(targetFolder, file);
446448
if (fse.existsSync(dest)) {
@@ -603,12 +605,12 @@ function installAllRequirements() {
603605
if (this.serverless.service.package.individually) {
604606
let doneModules = [];
605607
this.targetFuncs
606-
.filter(func =>
608+
.filter((func) =>
607609
(func.runtime || this.serverless.service.provider.runtime).match(
608610
/^python.*/
609611
)
610612
)
611-
.map(f => {
613+
.map((f) => {
612614
if (!get(f, 'module')) {
613615
set(f, ['module'], '.');
614616
}

lib/pipenv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function pipfileToRequirements() {
2020
'pipenv',
2121
['lock', '--requirements', '--keep-outdated'],
2222
{
23-
cwd: this.servicePath
23+
cwd: this.servicePath,
2424
}
2525
);
2626
if (res.error) {

lib/poetry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ function pyprojectTomlToRequirements() {
2323
'requirements.txt',
2424
'-o',
2525
'requirements.txt',
26-
'--with-credentials'
26+
'--with-credentials',
2727
],
2828
{
29-
cwd: this.servicePath
29+
cwd: this.servicePath,
3030
}
3131
);
3232
if (res.error) {
@@ -46,7 +46,7 @@ function pyprojectTomlToRequirements() {
4646
const requirementsContents =
4747
res.stdout.toString().trim() || // As of poetry 1.0.0b1, requirements.txt is printed to standard output when the -o option is not specified.
4848
fse.readFileSync(sourceRequirements, {
49-
encoding: 'utf-8'
49+
encoding: 'utf-8',
5050
});
5151

5252
if (requirementsContents.match(editableFlag)) {

lib/shared.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function checkForAndDeleteMaxCacheVersions(options, serverless) {
2727
// Check if we have too many
2828
if (files.length >= options.staticCacheMaxVersions) {
2929
// Sort by modified time
30-
files.sort(function(a, b) {
30+
files.sort(function (a, b) {
3131
return (
3232
fse.statSync(a).mtime.getTime() - fse.statSync(b).mtime.getTime()
3333
);
@@ -90,7 +90,7 @@ function getUserCachePath(options) {
9090
// Otherwise, find/use the python-ey appdirs cache location
9191
const dirs = new Appdir({
9292
appName: 'serverless-python-requirements',
93-
appAuthor: 'UnitedIncome'
93+
appAuthor: 'UnitedIncome',
9494
});
9595
return dirs.userCache();
9696
}
@@ -108,5 +108,5 @@ module.exports = {
108108
checkForAndDeleteMaxCacheVersions,
109109
getRequirementsWorkingPath,
110110
getUserCachePath,
111-
sha256Path
111+
sha256Path,
112112
};

0 commit comments

Comments
 (0)