Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Yarn 3 #1862

Merged
merged 6 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .yarn/releases/yarn-2.4.2.cjs

This file was deleted.

631 changes: 631 additions & 0 deletions .yarn/releases/yarn-3.0.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ packageExtensions:
peerDependencies:
react-dom: ^16.14.0

yarnPath: .yarn/releases/yarn-2.4.2.cjs
yarnPath: .yarn/releases/yarn-3.0.0.cjs
4 changes: 3 additions & 1 deletion packages/api-page-builder/src/graphql/crud/system.crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ export default {
{
title: "Welcome to Webiny",
path: "/welcome-to-webiny",
content: welcomeToWebinyPageContent
content: welcomeToWebinyPageContent,
settings: {}
},
{
title: "Not Found",
path: "/not-found",
content: notFoundPageData,
settings: {},
// Do not show the page in page lists, only direct get is possible.
visibility: {
get: { latest: true, published: true },
Expand Down
14 changes: 6 additions & 8 deletions packages/cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ const execa = require("execa");
const semver = require("semver");
const { verifyConfig } = require("./config");
const currentNodeVersion = process.versions.node;
const majorVersion = parseInt(currentNodeVersion.split(".")[0]);
const minorVersion = parseInt(currentNodeVersion.split(".")[1]);

(async () => {
if (majorVersion < 10 || (majorVersion === 10 && minorVersion < 14)) {
if (!semver.satisfies(currentNodeVersion, "^12 || ^14")) {
console.error(
chalk.red(
"You are running Node " +
currentNodeVersion +
".\n" +
"Webiny requires Node 10.14 or higher. \n" +
"Webiny requires Node ^12 or ^14. \n" +
"Please update your version of Node."
)
);
Expand All @@ -25,13 +23,13 @@ const minorVersion = parseInt(currentNodeVersion.split(".")[1]);

try {
const { stdout } = await execa("yarn", ["--version"]);
if (!semver.satisfies(stdout, "^2")) {
console.error(chalk.red(`"@webiny/cli" requires yarn@^2 to be installed!`));
if (!semver.satisfies(stdout, "^2||^3")) {
console.error(chalk.red(`"@webiny/cli" requires yarn ^2 or ^3 to be installed!`));
process.exit(1);
}
} catch (err) {
console.error(chalk.red(`"@webiny/cli" requires yarn@^2 to be installed!`));
console.log(`Please visit https://yarnpkg.com/ to install "yarn@^2".`);
console.error(chalk.red(`"@webiny/cli" requires yarn ^2 or ^3 to be installed!`));
console.log(`Please visit https://yarnpkg.com/ to install "yarn".`);
process.exit(1);
}

Expand Down
9 changes: 6 additions & 3 deletions packages/create-webiny-project/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const verifyConfig = require("./utils/verifyConfig");
chalk.red(
[
`You are running Node.js ${nodeVersion}, but Webiny requires version 12 or 14.`,
`Please switch to one of the two and try again.`,
`Please switch to one of the two versions and try again.`,
"For more information, please visit https://docs.webiny.com/docs/tutorials/install-webiny#prerequisites."
].join(" ")
)
Expand All @@ -23,10 +23,13 @@ const verifyConfig = require("./utils/verifyConfig");

try {
const yarnVersion = await getYarnVersion();
if (!semver.satisfies(yarnVersion, "^1.22.0 || ^2")) {
if (!semver.satisfies(yarnVersion, "^1.22.0 || ^2 || ^3")) {
console.error(
chalk.red(
`Webiny requires yarn@^1.22.0. Please run "npm install -g yarn" to update.`
[
`Webiny requires yarn@^1.22.0 or higher.`,
`Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`
].join("\n")
)
);
process.exit(1);
Expand Down
7 changes: 2 additions & 5 deletions packages/create-webiny-project/utils/createProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,10 @@ module.exports = async function createProject({
}
},
{
// Setup yarn@2
title: "Setup yarn@^2",
// Setup yarn
title: "Setup yarn",
task: async () => {
// We are forcing the 2.x version.
// https://github.com/yarnpkg/berry/issues/3180#issuecomment-887332050
await execa("yarn", ["set", "version", "berry"], { cwd: projectRoot });
await execa("yarn", ["set", "version", "2.x"], { cwd: projectRoot });

const yamlPath = path.join(projectRoot, ".yarnrc.yml");
const parsedYaml = yaml.load(fs.readFileSync(yamlPath, "utf-8"));
Expand Down
Loading