Skip to content

Commit 5d98476

Browse files
committed
chore: migrate to yarn berry with node linker (#158)
1 parent 830f8d3 commit 5d98476

17 files changed

+11957
-8168
lines changed

Diff for: .editorconfig

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# EditorConfig helps developers define and maintain
2-
# consistent coding styles between different editors and IDEs.
3-
41
root = true
52

63
[*]
7-
end_of_line = lf
84
charset = utf-8
9-
trim_trailing_whitespace = true
10-
insert_final_newline = true
11-
indent_style = space
5+
end_of_line = lf
126
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

Diff for: .eslintrc.json

+3-50
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,13 @@
11
{
2+
"extends": ["prettier"],
23
"plugins": ["prettier"],
3-
"parserOptions": {
4-
"sourceType": "module"
5-
},
64
"env": {
75
"es6": true,
86
"browser": true,
97
"node": true,
108
"jasmine": true
119
},
12-
"extends": ["prettier"],
13-
"globals": {
14-
"require": true,
15-
"creditcard": true,
16-
"CREDIT_CARDS": true,
17-
"INVALID_CREDIT_CARD": true,
18-
"VALID_CREDIT_CARD": true,
19-
"luhn": true,
20-
"list": true
21-
},
22-
"rules": {
23-
"camelcase": 2,
24-
"comma-dangle": [2, {
25-
"arrays": "always-multiline",
26-
"objects": "always-multiline",
27-
"imports": "always-multiline",
28-
"exports": "always-multiline",
29-
"functions": "never"
30-
}],
31-
"comma-spacing": 2,
32-
"comma-style": [2, "last"],
33-
"eol-last": 2,
34-
"eqeqeq": 2,
35-
"indent": [2, 2],
36-
"linebreak-style": [2, "unix"],
37-
"max-nested-callbacks": [2, 3],
38-
"no-dupe-keys": 2,
39-
"no-eq-null": 2,
40-
"no-extra-semi": 2,
41-
"no-lonely-if": 2,
42-
"no-multi-spaces": 0,
43-
"no-multiple-empty-lines": [2, {"max": 2}],
44-
"no-nested-ternary": 2,
45-
"no-param-reassign": 2,
46-
"no-self-compare": 2,
47-
"no-throw-literal": 2,
48-
"no-trailing-spaces": 2,
49-
"no-undef": 2,
50-
"no-underscore-dangle": 0,
51-
"no-void": 2,
52-
"one-var": [2, "never"],
53-
"prettier/prettier": "error",
54-
"quotes": [2, "single"],
55-
"semi": [2, "always"],
56-
"keyword-spacing": 2,
57-
"space-before-function-paren": [2, "never"],
58-
"space-in-parens": [2, "never"]
10+
"parserOptions": {
11+
"sourceType": "module"
5912
}
6013
}

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Use Node.js
1313
uses: actions/setup-node@v2
1414
with:
15-
node-version: '14.x'
15+
node-version: '18.x'
1616

1717
- name: Install dependencies
1818
run: yarn

Diff for: .github/workflows/deploy-npm.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup Node
3636
uses: actions/setup-node@v2
3737
with:
38-
node-version: '14.x'
38+
node-version: '18.x'
3939
registry-url: 'https://registry.npmjs.org'
4040

4141
# Cache dependencies

Diff for: .gitignore

+71-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,72 @@
1+
# OS
2+
.DS_Store
3+
4+
# IDEs
5+
.idea
6+
7+
# Logs
8+
logs
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
lerna-debug.log*
14+
15+
# Diagnostic reports (https://nodejs.org/api/report.html)
16+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
17+
18+
# Runtime data
19+
pids
20+
*.pid
21+
*.seed
22+
*.pid.lock
23+
24+
# Directory for instrumented libs generated by jscoverage/JSCover
25+
lib-cov
26+
27+
# Coverage directory used by tools like istanbul
28+
coverage
29+
*.lcov
30+
31+
# nyc test coverage
32+
.nyc_output
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# Optional eslint cache
42+
.eslintcache
43+
44+
# Optional REPL history
45+
.node_repl_history
46+
47+
# Yarn
48+
.yarn/*
49+
!.yarn/releases
50+
!.yarn/plugins
51+
.pnp.*
52+
.yarn-integrity
53+
54+
# npm
55+
.npm
56+
package-lock.json
57+
58+
# dotenv environment variables file
59+
.env
60+
.env.test
61+
62+
# Cache
63+
.cache
64+
65+
# Build
66+
build
167
dist
2-
node_modules
3-
npm-debug.log
4-
.coverage
68+
69+
# Other
70+
*.tgz
71+
*.iml
72+
*.map

Diff for: .npmignore

-3
This file was deleted.

Diff for: .nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

Diff for: .prettierrc.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
module.exports = {
2-
printWidth: 80,
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: true,
5+
endOfLine: 'lf',
6+
printWidth: 120,
7+
quoteProps: 'as-needed',
8+
semi: true,
39
singleQuote: true,
4-
trailingComma: 'es5'
10+
tabWidth: 2,
11+
trailingComma: 'all',
12+
useTabs: false,
513
};

Diff for: .yarn/plugins/@yarnpkg/plugin-engines.cjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@yarnpkg/plugin-engines",
5+
factory: function (require) {
6+
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c={}));var h=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case c.Yarn:this.reportYarnError(e);break;case c.Console:default:this.reportConsoleError(e);break}};this.reportYarnError=e=>{throw new o.ReportError(o.MessageName.UNNAMED,e)};this.reportConsoleError=e=>{console.error(e),process.exit(1)};this.formatErrorMessage=(e,r)=>{let{configuration:t}=this.project,p=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),g=o.formatUtils.pretty(t,e,"cyan"),d=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${p} version ${g} does not satisfy the required version ${d}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),l=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends h{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),p=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,m.existsSync)(t)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The .nvmrc file does not exist.`,"red"));return}let g=(0,m.readFileSync)(t,"utf-8").trim();if((0,l.validRange)(g))return g;let d=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The ${d} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(e){let r=e.node;r!=null&&(r===".nvmrc"&&(r=this.resolveNvmRequiredVersion()),(0,l.satisfies)(process.version,r,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),r.replace(/^v/i,"")))}};var x=s(i("semver")),E=s(i("@yarnpkg/core"));var u=class extends h{get engine(){return"Yarn"}verifyEngine(e){let r=e.yarn;r!=null&&((0,x.satisfies)(E.YarnVersion,r,{includePrerelease:!0})||this.throwWrongEngineError(E.YarnVersion,r))}};var C=n=>e=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:r={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,t={project:e,errorReporter:n};[new v(t),new u(t)].forEach(g=>g.verifyEngine(r))},S={hooks:{validateProject:C(c.Yarn),setupScriptEnvironment:C(c.Console)}},q=S;return U;})();
7+
return plugin;
8+
}
9+
};

Diff for: .yarn/releases/yarn-3.4.1.cjs

+873
Large diffs are not rendered by default.

Diff for: .yarnrc.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
nodeLinker: 'node-modules'
2+
3+
plugins:
4+
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
5+
spec: 'https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js'
6+
7+
yarnPath: .yarn/releases/yarn-3.4.1.cjs

Diff for: CHANGELOG.md

-83
This file was deleted.

Diff for: README.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,19 @@ creditcard.js is available as a NPM package. You can install through Yarn or NPM
1515
### Yarn
1616

1717
```sh
18-
$ yarn add creditcard.js
18+
yarn add creditcard.js
1919
```
2020

2121
### NPM
2222

2323
```sh
24-
$ npm install creditcard.js
24+
npm install creditcard.js
2525
```
2626

2727
## Usage
2828

2929
```javascript
30-
import {
31-
isValid,
32-
isExpirationDateValid,
33-
isSecurityCodeValid,
34-
getCreditCardNameByNumber,
35-
} from 'creditcard.js';
30+
import { isValid, isExpirationDateValid, isSecurityCodeValid, getCreditCardNameByNumber } from 'creditcard.js';
3631

3732
isValid('4916108926268679'); // returns true
3833
isExpirationDateValid('02', '2020'); // returns true
@@ -92,7 +87,7 @@ Type: `string`
9287

9388
### `getCreditCardNameByNumber(number)` -> `string`
9489

95-
Returns the credit card type from the card number. _(See the full list of [currently supported cards](#suportted-credit-card-types))_
90+
Returns the credit card type from the card number. _(See the full list of [currently supported cards](#supported-credit-card-types))_
9691

9792
**number**
9893

@@ -101,7 +96,7 @@ Type: `string`
10196

10297
---
10398

104-
## Suportted credit card types
99+
## Supported credit card types
105100

106101
- American Express
107102
- Aura

Diff for: jest.config.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module.exports = {
22
coverageDirectory: '.coverage',
3-
collectCoverageFrom: [
4-
'src/**/*.js',
5-
],
3+
collectCoverageFrom: ['src/**/*.js'],
64
coverageReporters: ['html', 'lcovonly'],
75
coverageThreshold: {
86
global: {
97
statements: 100,
108
branches: 100,
119
functions: 100,
12-
lines: 100
10+
lines: 100,
1311
},
1412
},
1513
};

0 commit comments

Comments
 (0)