Skip to content

Commit

Permalink
chore: update engines (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
cirocfc authored Mar 2, 2023
1 parent 766037d commit b72a7c0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .yarn/plugins/@yarnpkg/plugin-engines.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module.exports = {
name: "@yarnpkg/plugin-engines",
factory: function (require) {
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;})();
var plugin=(()=>{var P=Object.create,l=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var Y=n=>l(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)l(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of j(e))!b.call(n,t)&&t!=="default"&&l(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(Y(l(n!=null?P(N(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")),g;(function(r){r.Yarn="Yarn",r.Console="Console"})(g||(g={}));var f=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case g.Yarn:this.reportYarnError(e);break;case g.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,c=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),p=o.formatUtils.pretty(t,e,"cyan"),h=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${c} version ${p} does not satisfy the required version ${h}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),d=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends f{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),c=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 ${c} version. The .nvmrc file does not exist.`,"red"));return}let p=(0,m.readFileSync)(t,"utf-8").trim();if((0,d.validRange)(p))return p;let h=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${c} version. The ${h} 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,d.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 f{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))}};function C(n){return function(e){if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{selfEngines:r={},engines:t={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,c={project:e,errorReporter:n};[new v(c),new u(c)].forEach(h=>h.verifyEngine(Object.keys(r).length?r:t))}}var S={hooks:{validateProject:C(g.Yarn),setupScriptEnvironment:C(g.Console)}},q=S;return U;})();
return plugin;
}
};
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
nodeLinker: 'node-modules'
nodeLinker: node-modules

npmAuthToken: '${{ NPM_TOKEN }}'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: 'https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js'
spec: 'https://raw.githubusercontent.com/ContaAzul/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js'

yarnPath: .yarn/releases/yarn-3.4.1.cjs
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"dist"
],
"scripts": {
"prepare": "yarn dlx only-allow yarn && yarn simple-git-hooks",
"prepack": "ca-pinst --disable",
"postpack": "ca-pinst --enable",
"preinstall": "yarn dlx only-allow yarn",
"postinstall": " yarn simple-git-hooks",
"build": "yarn build:production",
"build:watch": "rollup -c -w",
"build:production": "rollup -c",
Expand Down Expand Up @@ -48,6 +51,7 @@
"@commitlint/format": "^17.4.4",
"@release-it/conventional-changelog": "^4.3.0",
"babel-jest": "^29.4.3",
"contaazul-pinst": "^1.0.2",
"conventional-changelog": "^3.1.25",
"conventional-changelog-conventionalcommits": "^4.6.3",
"coveralls": "^3.1.1",
Expand All @@ -74,7 +78,7 @@
"registry": "https://registry.npmjs.org/"
},
"packageManager": "[email protected]",
"engines": {
"selfEngines": {
"node": ">=18.x",
"yarn": ">=3.x"
},
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3563,6 +3563,15 @@ __metadata:
languageName: node
linkType: hard

"contaazul-pinst@npm:^1.0.2":
version: 1.0.2
resolution: "contaazul-pinst@npm:1.0.2"
bin:
ca-pinst: lib/bin.js
checksum: af9ff75208c79cf1c8f826bc2e108e67b4a68383890b59b82c5cd1541fef93aa1c105a6a35bc568274e29a677634e7c3fc809e94e89d18fe74efd3cc5197c9b8
languageName: node
linkType: hard

"conventional-changelog-angular@npm:^5.0.11, conventional-changelog-angular@npm:^5.0.12":
version: 5.0.12
resolution: "conventional-changelog-angular@npm:5.0.12"
Expand Down Expand Up @@ -3902,6 +3911,7 @@ __metadata:
"@commitlint/format": ^17.4.4
"@release-it/conventional-changelog": ^4.3.0
babel-jest: ^29.4.3
contaazul-pinst: ^1.0.2
conventional-changelog: ^3.1.25
conventional-changelog-conventionalcommits: ^4.6.3
coveralls: ^3.1.1
Expand Down

0 comments on commit b72a7c0

Please sign in to comment.