Skip to content

Commit 3f82985

Browse files
bnussman-akamaibnussmanbill-akamai
authored
refactor: [M3-8632] - Use pnpm as our package manager (linode#11297)
* switch from yarn to pnpm * fix api-v4 validation version * easy fixes first * cloud manager boots * more progress * finish fixing cloud manager type issues * clean up * add back comments * clean up scripts * update lint job * update lint job * fix pnpm version issue * update github actions * fix lint issue * storybook clean up and fixes * fix tests * fix link test * use pnpm pack to fix version issue * try to fix pnpm pack issue * fix precommit hooks * update the rest of our github actions * attempt at updating docker related files * break github actions * update pnpm lockfile * fix lockfile * use pnpm pack so that workspace packages get resolved properly * fix missing ui dependency * fix missing ui dependency * add another missing dependency to the ui package * fix outdated lockfile * fix incorrect import * update lockfile * remove corepack packagemanager definiton * work on backwards compability with yarn * work on backwards compability with yarn * set pnpm version manually for now * fix cypress component testing * try to fix junit reporter * update lockfile * remove search precommit * debug packge publishing * debug packge publishing * debug packge publishing * clean up precommit * update other publish * update other publish * finish up changes to our publish steps * simplify the pnpm dev command * add bootstrap command * update docs * update a few more docs * fixes * Update docs/GETTING_STARTED.md Co-authored-by: bill-akamai <bcoloe@akamai.com> * link to pnpm install docs * ignore pnpm store for docker * make devenv work * update lockfile * update lockfile * furture proof package publishing * fix precommit hook * fix ui package missing luxon dependency * add missing @mui/x-date-pickers dependency --------- Co-authored-by: Banks Nussman <banks@nussman.us> Co-authored-by: bill-akamai <bcoloe@akamai.com>
1 parent 23a1c45 commit 3f82985

File tree

55 files changed

+22493
-10833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+22493
-10833
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 152 deletions
Large diffs are not rendered by default.

.github/workflows/coverage.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ jobs:
1111
with:
1212
ref: ${{ github.base_ref }} # The base branch of the PR (develop)
1313

14+
- uses: pnpm/action-setup@v4
15+
with:
16+
run_install: false
17+
version: 10
18+
1419
- name: Use Node.js v20.17 LTS
1520
uses: actions/setup-node@v4
1621
with:
1722
node-version: "20.17"
18-
19-
- uses: actions/cache@v4
20-
with:
21-
path: |
22-
**/node_modules
23-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
23+
cache: "pnpm"
2424

2525
- name: Install Dependencies
26-
run: yarn --frozen-lockfile
26+
run: pnpm install --frozen-lockfile
2727

2828
- name: Build @linode/validation
29-
run: yarn build:validation
29+
run: pnpm build:validation
3030

3131
- name: Build @linode/api-v4
32-
run: yarn build:sdk
32+
run: pnpm build:sdk
3333

3434
- name: Run Base Branch Coverage
35-
run: yarn coverage:summary
35+
run: pnpm coverage:summary
3636

3737
- name: Write Base Coverage to an Artifact
3838
run: |
@@ -56,28 +56,28 @@ jobs:
5656
steps:
5757
- uses: actions/checkout@v4
5858

59+
- uses: pnpm/action-setup@v4
60+
with:
61+
run_install: false
62+
version: 10
63+
5964
- name: Use Node.js v20.17 LTS
6065
uses: actions/setup-node@v4
6166
with:
6267
node-version: "20.17"
63-
64-
- uses: actions/cache@v4
65-
with:
66-
path: |
67-
**/node_modules
68-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
68+
cache: "pnpm"
6969

7070
- name: Install Dependencies
71-
run: yarn --frozen-lockfile
71+
run: pnpm install --frozen-lockfile
7272

7373
- name: Build @linode/validation
74-
run: yarn build:validation
74+
run: pnpm build:validation
7575

7676
- name: Build @linode/api-v4
77-
run: yarn build:sdk
77+
run: pnpm build:sdk
7878

7979
- name: Run Current Branch Coverage
80-
run: yarn coverage:summary
80+
run: pnpm coverage:summary
8181

8282
- name: Write PR Number to an Artifact
8383
run: |

.github/workflows/coverage_badge.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ jobs:
1313
- name: Checkout Code
1414
uses: actions/checkout@v4
1515

16+
- uses: pnpm/action-setup@v4
17+
with:
18+
run_install: false
19+
version: 10
20+
1621
- name: Use Node.js v20.17 LTS
1722
uses: actions/setup-node@v4
1823
with:
1924
node-version: "20.17"
20-
21-
- uses: actions/cache@v4
22-
with:
23-
path: |
24-
**/node_modules
25-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
25+
cache: "pnpm"
2626

2727
- name: Install Dependencies
28-
run: yarn --frozen-lockfile
28+
run: pnpm install --frozen-lockfile
2929

3030
- name: Build @linode/validation
31-
run: yarn build:validation
31+
run: pnpm build:validation
3232

3333
- name: Build @linode/api-v4
34-
run: yarn build:sdk
34+
run: pnpm build:sdk
3535

3636
- name: Run Base Branch Coverage
37-
run: yarn coverage:summary
37+
run: pnpm coverage:summary
3838

3939
- name: Generate Coverage Badge
4040
uses: jaywcjlove/coverage-badges-cli@7f0781807ef3e7aba97a145beca881d36451b7b7 # v1.1.1

.github/workflows/e2e_schedule_and_push.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@ jobs:
3131
- uses: actions/setup-node@v4
3232
with:
3333
node-version: "20.17"
34-
- uses: actions/cache@v4
35-
with:
36-
path: |
37-
node_modules
38-
*/*/node_modules
39-
~/.cache/Cypress
40-
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
41-
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
34+
cache: "pnpm"
4235
- run: |
4336
echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV
4437
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
@@ -57,9 +50,9 @@ jobs:
5750
echo "REACT_APP_API_ROOT=${{ secrets.REACT_APP_API_ROOT }}" >> ./packages/manager/.env
5851
echo "REACT_APP_APP_ROOT=${{ secrets.REACT_APP_APP_ROOT }}" >> ./packages/manager/.env
5952
echo "REACT_APP_DISABLE_NEW_RELIC=1" >> ./packages/manager/.env
60-
yarn install:all
61-
yarn build
62-
yarn start:manager:ci &
53+
pnpm install:all
54+
pnpm build
55+
pnpm start:manager:ci &
6356
- name: Run tests
6457
uses: cypress-io/github-action@v6
6558
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ packages/manager/bundle_analyzer_report.html
138138

139139
# vitepress
140140
docs/.vitepress/cache
141+
142+
# pnpm store will be generated if you run pnpm install in docker environments
143+
.pnpm-store

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
yarn workspaces run precommit
1+
pnpm run -r --workspace-concurrency=1 --if-present precommit

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ x-e2e-runners:
8383
target: e2e
8484
env_file: ./packages/manager/.env
8585
volumes: *default-volumes
86-
entrypoint: 'yarn'
86+
entrypoint: 'pnpm'
8787

8888
services:
8989
# Serves a local instance of Cloud Manager for Cypress to use for its tests.
@@ -164,7 +164,7 @@ services:
164164
entrypoint:
165165
- "/bin/sh"
166166
- "-c"
167-
- "caddy reverse-proxy --from $${CYPRESS_BASE_URL} --to $${REVERSE_PROXY_URL} > /dev/null 2>&1 & yarn $0 $@"
167+
- "caddy reverse-proxy --from $${CYPRESS_BASE_URL} --to $${REVERSE_PROXY_URL} > /dev/null 2>&1 & pnpm $0 $@"
168168

169169
# Cypress component test runner service.
170170
#
@@ -191,7 +191,7 @@ services:
191191
environment:
192192
<<: *default-env
193193
MANAGER_OAUTH: ${MANAGER_OAUTH}
194-
entrypoint: ['yarn', 'cy:e2e']
194+
entrypoint: ['pnpm', 'cy:e2e']
195195

196196
# Component test runner.
197197
# Does not require any Cloud Manager environment to run.
@@ -201,7 +201,7 @@ services:
201201
environment:
202202
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
203203
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}
204-
entrypoint: ['yarn', 'cy:component:run']
204+
entrypoint: ['pnpm', 'cy:component:run']
205205

206206
# End-to-end test runner for Cloud's synthetic monitoring tests.
207207
# Configured to run against a remote Cloud instance hosted at some URL.
@@ -211,4 +211,4 @@ services:
211211
environment:
212212
<<: *default-env
213213
MANAGER_OAUTH: ${MANAGER_OAUTH}
214-
entrypoint: ['yarn', 'cy:e2e']
214+
entrypoint: ['pnpm', 'cy:e2e']

docs/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Feel free to open an issue to report a bug or request a feature.
3333
- install it via `brew`: https://github.com/cli/cli#installation or upgrade with `brew upgrade gh`
3434
- Once installed, run `gh repo set-default` and pick `linode/manager` (only > 2.21.0)
3535
- You can also just create the changeset manually, in this case make sure to use the proper formatting for it.
36-
- Run `yarn changeset`from the root, choose the package to create a changeset for, and provide a description for the change.
36+
- Run `pnpm changeset`from the root, choose the package to create a changeset for, and provide a description for the change.
3737
You can either have it committed automatically or do it manually if you need to edit it.
3838
- A changeset is optional, but should be included if the PR falls in one of the following categories:<br>
3939
`Added`, `Fixed`, `Changed`, `Removed`, `Tech Stories`, `Tests`, `Upcoming Features`
@@ -74,4 +74,4 @@ Break down *additional* things in your PR into multiple PRs (like you would do w
7474

7575
## Docs
7676

77-
To run the docs development server locally, [install Bun](https://bun.sh/) and start the server: `yarn docs`.
77+
To run the docs development server locally, [install Bun](https://bun.sh/) and start the server: `pnpm run docs`.

docs/GETTING_STARTED.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,52 @@
1010
8. Install Node.js 20.17 LTS. We recommend using [Volta](https://volta.sh/):
1111

1212
```bash
13-
14-
$ curl https://get.volta.sh | bash
13+
curl https://get.volta.sh | bash
1514

1615
## Add volta to your .*rc file, or open a new terminal window.
1716

18-
$ volta install node@20.17
17+
volta install node@20.17
1918

20-
$ node --version
19+
node --version
2120
## v20.17.0
22-
2321
```
2422

25-
9. Install the latest version of Yarn:
23+
9. Install pnpm v10 using Volta or view the [pnpm docs](https://pnpm.io/installation) for more installation methods
2624

2725
```bash
28-
$ npm install --global yarn --upgrade
29-
# 1.22.10
26+
volta install pnpm@10
27+
28+
pnpm --version
29+
# 10.2.0
3030
```
3131

32-
10. Navigate to the root directory of the repository, then start Cloud Manager and the JS client with `yarn up`.
33-
11. After installation, Cloud Manager should be running at `http://localhost:3000`.
32+
10. Navigate to the root directory of the repository
33+
11. Run `pnpm bootstrap` to install dependencies and perform an initial build of our packages
34+
12. Run `pnpm dev` to start the local development server. Cloud Manager should be running at `http://localhost:3000`
3435

3536
## Serving a production build of Cloud Manager
3637

37-
You can then serve these files however you prefer or use our included local http server.
38+
You can build a production bundle of Cloud Manager and serve it locally.
3839

3940
```bash
40-
yarn install:all
41+
pnpm install
42+
43+
pnpm run --filter @linode/validation build # build the @linode/validation package
44+
45+
pnpm run --filter @linode/api-v4 build # build the @linode/api-v4 (it depends on @linode/validation)
4146

42-
yarn workspace linode-manager build
47+
pnpm run --filter linode-manager build # build a production bundle of Cloud Manager
4348

44-
yarn workspace linode-manager run start:ci
49+
pnpm run --filter linode-manager start:ci # start a local http server on http://localhost:3000/
4550
```
4651

4752
## Exposing Cloud Manager's dev server to the network
4853

4954
By default, Cloud Manager's dev server only listens on `localhost`. If you need to
50-
expose the Vite dev server, you can use the following command.
55+
expose the Vite dev server to all network interfaces, you can use the following command.
5156

5257
> **Note**: This is useful for running Cloud Manager's dev server in Docker-like environments
5358
5459
```bash
55-
yarn up:expose
60+
pnpm run up:expose
5661
```

docs/development-guide/01-repository-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The linode/manager repository is a monorepo that houses three packages:
88

99
The **manager** package is dependent on the **api-v4** package, which is itself dependent on the **validation** package.
1010

11-
The repo has a root level `package.json` which defines project-level scripts, hooks, and dependencies. The code for dependencies shared across projects are hoisted up to the root-level `/node_modules` directory. There is a single `yarn.lock` file for the repo which lives at the root level.
11+
The repo has a root level `package.json` which defines project-level scripts, hooks, and dependencies. The code for dependencies shared across projects are hoisted up to the root-level `/node_modules` directory. There is a single `pnpm-lock.yaml` file for the repo which lives at the root level.
1212

1313
Any files relevant to the entire project or repo should be included at the root level. Files belonging to a specific package belong in `/packages/<package_name>`.
1414

@@ -52,7 +52,7 @@ Like api-v4, TypeScript files are compiled to /lib and compiled + minified to in
5252
A few notable directories in the root level of the manager package:
5353

5454
- **/build**
55-
- where the app is compiled to after running `yarn build` (gitignored)
55+
- where the app is compiled to after running `pnpm build` (gitignored)
5656
- **/config**
5757
- configuration for unit tests
5858
- **/cypress**

0 commit comments

Comments
 (0)