From 6e4d619e70bb6dbe32ecd523052cef192ca45caa Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Mon, 18 Apr 2022 23:56:45 -0300 Subject: [PATCH] Add yarn plugin to check node and yarn version --- .yarn/plugins/@yarnpkg/plugin-engines.cjs | 9 +++++++++ .yarnrc.yml | 2 ++ package.json | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .yarn/plugins/@yarnpkg/plugin-engines.cjs diff --git a/.yarn/plugins/@yarnpkg/plugin-engines.cjs b/.yarn/plugins/@yarnpkg/plugin-engines.cjs new file mode 100644 index 000000000000..834718659985 --- /dev/null +++ b/.yarn/plugins/@yarnpkg/plugin-engines.cjs @@ -0,0 +1,9 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { +name: "@yarnpkg/plugin-engines", +factory: function (require) { +var plugin=(()=>{var l=Object.create,c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=e=>c(e,"__esModule",{value:!0});var t=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)c(e,r,{get:o[r],enumerable:!0})},P=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of u(o))!h.call(e,s)&&s!=="default"&&c(e,s,{get:()=>o[s],enumerable:!(r=v(o,s))||r.enumerable});return e},i=e=>P(y(c(e!=null?l(m(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>$});var n=i(t("@yarnpkg/core")),p=i(t("@yarnpkg/fslib")),d=i(t("fs")),f=i(t("path")),a=i(t("semver")),N={hooks:{validateProject:e=>{let o=(0,d.readFileSync)((0,f.resolve)(p.npath.fromPortablePath(e.cwd),"package.json"),"utf-8"),{engines:r={}}=JSON.parse(o);if(r.node!=null&&!(0,a.satisfies)(process.version,r.node))throw new n.ReportError(n.MessageName.UNNAMED,`The current Node version ${process.version} does not satisfy the required version ${r.node}.`);if(r.yarn!=null&&!(0,a.satisfies)(n.YarnVersion,r.yarn))throw new n.ReportError(n.MessageName.UNNAMED,`The current Yarn version v${n.YarnVersion} does not satisfy the required version ${r.yarn}.`)},setupScriptEnvironment:async e=>{let o=(0,d.readFileSync)((0,f.resolve)(p.npath.fromPortablePath(e.cwd),"package.json"),"utf-8"),{engines:r={}}=JSON.parse(o);r.node!=null&&!(0,a.satisfies)(process.version,r.node)&&(console.error(`The current Node version ${process.version} does not satisfy the required version ${r.node}.`),process.exit(1)),r.yarn!=null&&!(0,a.satisfies)(n.YarnVersion,r.yarn)&&(console.error(`The current Yarn version v${n.YarnVersion} does not satisfy the required version ${r.yarn}.`),process.exit(1))}}},$=N;return k;})(); +return plugin; +} +}; diff --git a/.yarnrc.yml b/.yarnrc.yml index f71089c56853..c8d9919469b2 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -3,5 +3,7 @@ nodeLinker: node-modules plugins: - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs spec: "@yarnpkg/plugin-workspace-tools" + - path: .yarn/plugins/@yarnpkg/plugin-engines.cjs + spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js" yarnPath: .yarn/releases/yarn-3.2.0.cjs diff --git a/package.json b/package.json index d92637e572da..59e3c08fce84 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/RocketChat/Rocket.Chat#readme", "engines": { - "npm": ">=7.0.0", + "yarn": "3.2.0", "node": ">=14.0.0 <15" }, "packageManager": "yarn@3.2.0",