Skip to content

Commit 6e739ad

Browse files
authored
test: migrate yarn modern examples to corepack (#1350)
* test: migrate yarn modern examples to corepack * chore: use corepack for yarn modern maintenance
1 parent c19c3fa commit 6e739ad

File tree

12 files changed

+60
-1903
lines changed

12 files changed

+60
-1903
lines changed

.github/workflows/example-yarn-modern-pnp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
16-
16+
- run: corepack enable yarn # experimental - see https://nodejs.org/docs/latest/api/corepack.html
1717
- name: Custom Yarn command
1818
uses: ./
1919
with:

.github/workflows/example-yarn-modern.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
16-
16+
- run: corepack enable yarn # experimental - see https://nodejs.org/docs/latest/api/corepack.html
1717
- name: Custom Yarn command
1818
uses: ./
1919
with:

docs/MAINTENANCE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes updating the [examples](../examples) in this repository
66

77
The [examples](../examples) directory contains examples of the use of Cypress (Current) [Configuration](https://docs.cypress.io/guides/references/configuration) which applies to Cypress 10 and later. These examples test and demonstrate the use of [cypress-io/github-action](https://github.com/cypress-io/github-action).
88

9-
The examples make use of [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [Yarn 1 (Classic)](https://classic.yarnpkg.com/) and [Yarn Modern](https://yarnpkg.com/) (Yarn 2 and later) to define and install the packages being used.
9+
The examples make use of [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [Yarn 1 (Classic)](https://classic.yarnpkg.com/) and [Yarn Modern](https://yarnpkg.com/) to define and install the packages being used. For [Yarn Modern](https://yarnpkg.com/) the recommended [Corepack](https://yarnpkg.com/corepack) is used as a Yarn version manager.
1010

1111
*The previous [examples/v9](https://github.com/cypress-io/github-action/tree/v5/examples/v9) are archived in the [v5](https://github.com/cypress-io/github-action/tree/v5/) branch. This directory contains examples which were set up to use Cypress `9.7.0`, the last version using Legacy Configuration, covering Cypress 9 and below. These `v9` examples are no longer maintained.
1212

@@ -18,20 +18,16 @@ The examples make use of [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/)
1818

1919
- [git](https://git-scm.com/) distributed version control system.
2020

21-
- [npm](https://www.npmjs.com/), which is installed with [Node.js](https://nodejs.org/)
21+
- [npm](https://www.npmjs.com/), which is installed with [Node.js](https://nodejs.org/).
22+
23+
- [corepack](https://github.com/nodejs/corepack), which is installed with [Node.js](https://nodejs.org/).
2224

2325
- [pnpm](https://pnpm.io/) installed through:
2426

2527
```bash
2628
npm install pnpm@latest -g
2729
```
2830

29-
- [Yarn 1 (Classic)](https://classic.yarnpkg.com/) installed through:
30-
31-
```bash
32-
npm install yarn@latest -g
33-
```
34-
3531
- [Visual Studio Code](https://code.visualstudio.com/) or other editor
3632

3733
Under Microsoft Windows it may be necessary to also execute the following preparatory command:
@@ -55,3 +51,7 @@ This updates all [examples](../examples) to cypress@latest.
5551
[.github/workflows/example-install-only.yml](../.github/workflows/example-install-only.yml) contains a hard-coded Cypress version number. This can be updated by hand.
5652

5753
After updating the examples locally, they can be committed with git and a pull request opened on GitHub.
54+
55+
### Updating Yarn examples
56+
57+
The script [/scripts/update-cypress-latest-yarn.sh](../scripts/update-cypress-latest-yarn.sh) (which is invoked through `npm run update:cypress` to update the Yarn examples) runs [Yarn 1 (Classic)](https://classic.yarnpkg.com/) as an `npm` global install, runs [Yarn Modern](https://yarnpkg.com/) through Corepack and returns Corepack to its default disabled state on completion.

examples/yarn-modern-pnp/.yarn/releases/yarn-4.6.0.cjs

Lines changed: 0 additions & 934 deletions
This file was deleted.

examples/yarn-modern-pnp/.yarnrc.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/yarn-modern-pnp/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# example: yarn-modern-pnp
22

3-
This example demonstrates installing dependencies using [Yarn Modern (version 2 and later)](https://yarnpkg.com/) with [Plug'n'Play](https://yarnpkg.com/features/pnp) turned on.
3+
This example demonstrates installing dependencies using [Yarn Modern v4](https://yarnpkg.com/) with [corepack](https://yarnpkg.com/corepack) enabled and the default configuration of [Plug'n'Play](https://yarnpkg.com/features/pnp) enabled.
4+
5+
Run locally with:
6+
7+
```shell
8+
corepack enable yarn
9+
yarn
10+
yarn test
11+
```

examples/yarn-modern/.yarn/releases/yarn-4.6.0.cjs

Lines changed: 0 additions & 934 deletions
This file was deleted.

examples/yarn-modern/.yarnrc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
nodeLinker: node-modules
2-
3-
yarnPath: .yarn/releases/yarn-4.6.0.cjs

examples/yarn-modern/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# example: yarn-modern
22

3-
This example demonstrates installing dependencies using [Yarn Modern (version 2 and later)](https://yarnpkg.com/).
3+
This example demonstrates installing dependencies using [Yarn Modern v4](https://yarnpkg.com/) with [corepack](https://yarnpkg.com/corepack) enabled and the configuration option `nodeLinker: node-modules` selected.
4+
5+
Run locally with:
6+
7+
```shell
8+
corepack enable yarn
9+
yarn
10+
yarn test
11+
```

scripts/check-package-manager-yarn.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)