Skip to content

Commit 29f957d

Browse files
committed
chore: Reformat with eslint & prettier
1 parent 274b8e5 commit 29f957d

File tree

12 files changed

+249
-238
lines changed

12 files changed

+249
-238
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 2
22
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"
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/integrate.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
npm update --no-save
6060
npm update --save-dev --no-save
6161
- name: Unit tests
62-
run: script -e -c "npm test"
62+
run: npm test
6363

6464
windowsNode16:
6565
name: '[Windows] Node.js v16: Unit tests'
@@ -161,7 +161,7 @@ jobs:
161161
npm update --no-save
162162
npm update --save-dev --no-save
163163
- name: Unit tests
164-
run: script -e -c "npm test"
164+
run: npm test
165165

166166
linuxNode12:
167167
name: '[Linux] Node.js v12: Unit tests'
@@ -212,12 +212,12 @@ jobs:
212212
npm update --no-save
213213
npm update --save-dev --no-save
214214
- name: Unit tests
215-
run: script -e -c "npm test"
215+
run: npm test
216216

217217
tagIfNewVersion:
218218
name: Tag if new version
219219
runs-on: ubuntu-latest
220-
needs: [linuxNode14, windowsNode14, linuxNode16, linuxNode12]
220+
needs: [linuxNode16, windowsNode16, linuxNode14, linuxNode12]
221221
steps:
222222
- name: Checkout repository
223223
uses: actions/checkout@v2

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
path: |
2727
~/.npm
2828
node_modules
29-
key: npm-v14-${{ runner.os }}-refs/heads/master-${{ hashFiles('package.json') }}
29+
key: npm-v16-${{ runner.os }}-refs/heads/master-${{ hashFiles('package.json') }}
3030

3131
- name: Install Node.js and npm
3232
uses: actions/setup-node@v1
3333
with:
34-
node-version: 14.x
34+
node-version: 16.x
3535
registry-url: https://registry.npmjs.org
3636

3737
- name: Publish new version

.github/workflows/validate.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
npx dump-release-notes-from-cc-changelog $NEW_VERSION
8787
fi
8888
- name: Unit tests
89-
run: script -e -c "npm test"
89+
run: npm test
9090

9191
windowsNode16:
9292
name: '[Windows] Node.js v16: Unit tests'
@@ -192,9 +192,7 @@ jobs:
192192
npm update --no-save
193193
npm update --save-dev --no-save
194194
- name: Unit tests
195-
# Some tests depend on TTY support, which is missing in GA runner
196-
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
197-
run: script -e -c "npm test"
195+
run: npm test
198196

199197
linuxNode12:
200198
name: '[Linux] Node.js v12: Unit tests'
@@ -247,4 +245,4 @@ jobs:
247245
npm update --no-save
248246
npm update --save-dev --no-save
249247
- name: Unit tests
250-
run: script -e -c "npm test"
248+
run: npm test

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
A Serverless v1.x plugin to automatically bundle dependencies from `requirements.txt` and make them available in your `PYTHONPATH`.
99

10-
---
10+
---
1111

1212
_Originally developed by [**Capital One**](https://www.capitalone.com/tech/open-source/), now maintained in scope of Serverless, Inc_
1313

1414
_Capital One considers itself the bank a technology company would build. It's delivering best-in-class innovation so that its millions of customers can manage their finances with ease. Capital One is all-in on the cloud and is a leader in the adoption of open source, RESTful APIs, microservices and containers. We build our own products and release them with a speed and agility that allows us to get new customer experiences to market quickly. Our engineers use artificial intelligence and machine learning to transform real-time data, software and algorithms into the future of finance, reimagined._
1515

16-
---
16+
---
1717

1818
## Install
1919

@@ -557,10 +557,10 @@ package:
557557
- [@andrewfarley](https://github.com/andrewfarley) - Implemented download caching and static caching
558558
- [@bweigel](https://github.com/bweigel) - adding the `slimPatternsAppendDefaults` option & fixing per-function packaging when some functions don't have requirements & Porting tests from bats to js!
559559
- Poetry support
560-
- [@squaresurf](https://github.com/squaresurf)
561-
- [@drice](https://github.com/drice)
562-
- [@ofercaspi](https://github.com/ofercaspi)
563-
- [@tpansino](https://github.com/tpansino)
560+
- [@squaresurf](https://github.com/squaresurf)
561+
- [@drice](https://github.com/drice)
562+
- [@ofercaspi](https://github.com/ofercaspi)
563+
- [@tpansino](https://github.com/tpansino)
564564
- [@david-mk-lawrence](https://github.com/david-mk-lawrence) - added Lambda Layer support
565565
- [@bryantbriggs](https://github.com/bryantbiggs) - Fixing CI/CD
566566
- [@jacksgt](https://github.com/jacksgt) - Fixing pip issues

index.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const values = require('lodash.values');
77
const {
88
addVendorHelper,
99
removeVendorHelper,
10-
packRequirements
10+
packRequirements,
1111
} = require('./lib/zip');
1212
const { injectAllRequirements } = require('./lib/inject');
1313
const { layerRequirements } = require('./lib/layer');
@@ -57,7 +57,7 @@ class ServerlessPythonRequirements {
5757
staticCacheMaxVersions: 0,
5858
pipCmdExtraArgs: [],
5959
noDeploy: [],
60-
vendor: ''
60+
vendor: '',
6161
},
6262
(this.serverless.service.custom &&
6363
this.serverless.service.custom.pythonRequirements) ||
@@ -75,7 +75,9 @@ class ServerlessPythonRequirements {
7575
) {
7676
if (!this.warningLogged) {
7777
if (this.log) {
78-
this.log.warning('You provided a docker related option but dockerizePip is set to false.');
78+
this.log.warning(
79+
'You provided a docker related option but dockerizePip is set to false.'
80+
);
7981
} else {
8082
this.serverless.cli.log(
8183
'WARNING: You provided a docker related option but dockerizePip is set to false.'
@@ -144,31 +146,31 @@ class ServerlessPythonRequirements {
144146
commands: {
145147
clean: {
146148
usage: 'Remove .requirements and requirements.zip',
147-
lifecycleEvents: ['clean']
149+
lifecycleEvents: ['clean'],
148150
},
149151
install: {
150152
usage: 'install requirements manually',
151-
lifecycleEvents: ['install']
153+
lifecycleEvents: ['install'],
152154
},
153155
cleanCache: {
154156
usage:
155157
'Removes all items in the pip download/static cache (if present)',
156-
lifecycleEvents: ['cleanCache']
157-
}
158-
}
159-
}
158+
lifecycleEvents: ['cleanCache'],
159+
},
160+
},
161+
},
160162
};
161163

162-
if (this.serverless.cli.generateCommandsHelp) {
163-
Object.assign(this.commands.requirements, {
164-
usage: 'Serverless plugin to bundle Python packages',
165-
lifecycleEvents: ['requirements']
166-
});
167-
} else {
168-
this.commands.requirements.type = 'container';
169-
}
164+
if (this.serverless.cli.generateCommandsHelp) {
165+
Object.assign(this.commands.requirements, {
166+
usage: 'Serverless plugin to bundle Python packages',
167+
lifecycleEvents: ['requirements'],
168+
});
169+
} else {
170+
this.commands.requirements.type = 'container';
171+
}
170172

171-
const isFunctionRuntimePython = args => {
173+
const isFunctionRuntimePython = (args) => {
172174
// If functionObj.runtime is undefined, python.
173175
if (!args[1].functionObj || !args[1].functionObj.runtime) {
174176
return true;
@@ -177,9 +179,7 @@ class ServerlessPythonRequirements {
177179
};
178180

179181
const clean = () =>
180-
BbPromise.bind(this)
181-
.then(cleanup)
182-
.then(removeVendorHelper);
182+
BbPromise.bind(this).then(cleanup).then(removeVendorHelper);
183183

184184
const setupArtifactPathCapturing = () => {
185185
// Reference:
@@ -243,7 +243,7 @@ class ServerlessPythonRequirements {
243243
},
244244
'requirements:install:install': before,
245245
'requirements:clean:clean': clean,
246-
'requirements:cleanCache:cleanCache': cleanCache
246+
'requirements:cleanCache:cleanCache': cleanCache,
247247
};
248248
}
249249
}

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
"bin": {},
4040
"scripts": {
4141
"commitlint": "commitlint -f HEAD@{15}",
42-
"format": "prettier --write '{.,lib}/*.{js,md}'",
43-
"lint": "eslint *.js lib/*.js && prettier -c '{.,lib}/*.{js,md}'",
42+
"lint": "eslint .",
4443
"lint:updated": "pipe-git-updated --ext=js -- eslint",
4544
"prepare-release": "standard-version && prettier --write CHANGELOG.md",
4645
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
@@ -79,6 +78,14 @@
7978
"peerDependencies": {
8079
"serverless": "^2.32"
8180
},
81+
"lint-staged": {
82+
"*.js": [
83+
"eslint"
84+
],
85+
"*.{css,html,js,json,md,yaml,yml}": [
86+
"prettier -c"
87+
]
88+
},
8289
"eslintConfig": {
8390
"extends": "eslint:recommended",
8491
"env": {

0 commit comments

Comments
 (0)