Skip to content

Commit a219aa4

Browse files
authored
AXON-1209: Migration: npm → Yarn v4 (Berry) (#1024)
* build: added yarn settings * build: added yarn.lock instead of package.lock * build: updated scripts section * build: updated ci workflows * test: updated e2e Dockerfile * refactor: removed audit-cli config * chore: updated gitignore * build: enabled corepack before caching * build: added immutable param * build: removed --recursive flag * build: added recursive flag * chore: removed overrides * build: updated audit * build: added devDependencies * build: updated bundle size * docs: changed npm to yarn * build: updated pre-commit hook * build: updated scripts section * build: added --no-dependencies flag * build: move to dependencies * build: updated vscodeignore * build: updated maxAssetSize * build: updated set version in package.json * build: updated yarnrc config * build: added @atlaskit/link-provider * chore: updated gitignore * docs: added comment for pdfjs-dist * build: updated asset max size * build: upgrade editor dependencies * build: updated yarn.lock * chore: updated yarn.lock * build: upgrade yarn.lock
1 parent 0ad8fcd commit a219aa4

File tree

17 files changed

+26803
-48269
lines changed

17 files changed

+26803
-48269
lines changed

.audit-ci.json

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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ In particular, if you're making changes not covered by tests - please describe t
2929

3030
Basic checks:
3131

32-
- [ ] `npm run lint`
33-
- [ ] `npm run test`
32+
- [ ] `yarn lint`
33+
- [ ] `yarn test`
3434

3535
Advanced checks:
3636
- [ ] If Atlassian employee & Bitbucket changes: did you test with DC in mind? [See Instructions](https://www.loom.com/share/71e5d17734a547f68fd6128be6cd760e?sid=835e58a7-1240-498d-b2d7-fa7fdf8ffa36)

.github/workflows/build.yaml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,25 @@ jobs:
2121
- uses: actions/setup-node@v4
2222
with:
2323
node-version: 20
24-
cache: 'npm'
24+
25+
- name: Enable Corepack
26+
run: corepack enable
27+
28+
- name: Cache Yarn dependencies
29+
uses: actions/cache@v4
30+
with:
31+
path: .yarn/cache
32+
key: yarn-cache-${{ hashFiles('yarn.lock') }}
33+
restore-keys: yarn-cache-
2534

2635
- name: Install dependencies
27-
run: |
28-
npm ci --no-audit
36+
run: yarn install --immutable
2937

3038
- name: Run vulnerability audit
31-
# "There is no Vulnerability in Media Viewer after 48.5.4. since it was fixed by patching, but npm audit still reports it.",
32-
# So that switched to audit-ci with allowlist
33-
run: npx audit-ci --config=".audit-ci.json"
39+
run: yarn npm audit --recursive --no-deprecations
3440

3541
- name: Run linter
36-
run: npm run lint
42+
run: yarn lint
3743

3844
ci-matrix:
3945
needs: [lint]
@@ -63,22 +69,31 @@ jobs:
6369
- uses: actions/setup-node@v4
6470
with:
6571
node-version: 20
66-
cache: 'npm'
72+
73+
- name: Enable Corepack
74+
run: corepack enable
75+
76+
- name: Cache Yarn dependencies
77+
uses: actions/cache@v4
78+
with:
79+
path: .yarn/cache
80+
key: yarn-cache-${{ hashFiles('yarn.lock') }}
81+
restore-keys: yarn-cache-
6782

6883
- name: Install dependencies
69-
run: npm ci --no-audit
84+
run: yarn install --immutable
7085

7186
- name: Run unit tests
7287
if: matrix.kind == 'unit'
73-
run: npm run test
88+
run: yarn test
7489

7590
- name: Build and package the extension
7691
if: matrix.kind == 'e2e'
77-
run: npm run extension:package
92+
run: yarn extension:package
7893

7994
- name: Generate SSL certs for E2E test
8095
if: matrix.kind == 'e2e'
81-
run: npm run test:e2e:sslcerts
96+
run: yarn test:e2e:sslcerts
8297

8398
- name: Fetch E2E image
8499
if: matrix.kind == 'e2e'
@@ -88,7 +103,7 @@ jobs:
88103
89104
- name: Run E2E (${{ matrix.target }})
90105
if: matrix.kind == 'e2e'
91-
run: npm run test:e2e:docker
106+
run: yarn test:e2e:docker
92107
env:
93108
TARGET: ${{ matrix.target }}
94109

.github/workflows/release-nightly.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,34 @@ jobs:
3636
uses: actions/setup-node@v4
3737
with:
3838
node-version: 20
39-
cache: 'npm'
39+
40+
- name: Enable Corepack
41+
run: corepack enable
42+
43+
- name: Cache Yarn dependencies
44+
uses: actions/cache@v4
45+
with:
46+
path: .yarn/cache
47+
key: yarn-cache-${{ hashFiles('yarn.lock') }}
48+
restore-keys: yarn-cache-
4049

4150
- name: Set version in package.json
42-
run: npm version $PACKAGE_VERSION --no-git-tag-version --allow-same-version -f
51+
run: yarn version $PACKAGE_VERSION --immediate
4352

4453
- name: Install dependencies
45-
run: npm ci --no-audit
54+
run: yarn install --immutable
4655

4756
- name: Build and package the extension for pre-release
48-
run: npm run extension:package:prerelease
57+
run: yarn extension:package:prerelease
4958

5059
- name: Run linter
51-
run: npm run lint
60+
run: yarn lint
5261

5362
- name: Run unit tests
54-
run: npm run test:nocoverage
63+
run: yarn test:nocoverage
5564

5665
- name: Generate SSL certs for E2E test
57-
run: npm run test:e2e:sslcerts
66+
run: yarn test:e2e:sslcerts
5867

5968
- name: Fetch E2E image
6069
run: |

.github/workflows/release.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,34 @@ jobs:
4343
uses: actions/setup-node@v4
4444
with:
4545
node-version: 20
46-
cache: 'npm'
46+
47+
- name: Enable Corepack
48+
run: corepack enable
49+
50+
- name: Cache Yarn dependencies
51+
uses: actions/cache@v4
52+
with:
53+
path: .yarn/cache
54+
key: yarn-cache-${{ hashFiles('yarn.lock') }}
55+
restore-keys: yarn-cache-
4756

4857
- name: Set version in package.json
49-
run: npm version $PACKAGE_VERSION --no-git-tag-version --allow-same-version -f
58+
run: yarn version $PACKAGE_VERSION --immediate
5059

5160
- name: Install dependencies
52-
run: npm ci --no-audit
61+
run: yarn install --immutable
5362

5463
- name: Build and package the extension
55-
run: npm run extension:package
64+
run: yarn extension:package
5665

5766
- name: Run linter
58-
run: npm run lint
67+
run: yarn lint
5968

6069
- name: Run unit tests
61-
run: npm run test:nocoverage
70+
run: yarn test:nocoverage
6271

6372
- name: Generate SSL certs for E2E test
64-
run: npm run test:e2e:sslcerts
73+
run: yarn test:e2e:sslcerts
6574

6675
- name: Fetch E2E image
6776
run: |

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ node_modules
77
launch.json
88
*.vsix
99
.yo-*
10+
11+
.yarn/cache
12+
.yarn/unplugged
13+
.yarn/build-state.yml
14+
.yarn/install-state.gz
1015
yarn-error.log
16+
1117
*.pem
1218
*.crt
1319
*.p12

.vscode/launch.json.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"envFile": "${workspaceFolder}/.env"
2121
},
2222
{
23-
// This configuration requires npm run dev to be running externally
23+
// This configuration requires yarn dev to be running externally
2424
// It will pick up the re-compiled extension code but not hot-swap it
2525
"name": "Extension (watch/external)",
2626
"type": "extensionHost",

.vscodeignore

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,81 @@
1-
# Allowed:
1+
# ---- ALLOWED ----
22
# build/
33
# resources/
44
# images/
55
# LICENSE
66

7-
__mocks__/
8-
__tests__/
9-
.generated/
10-
e2e/
11-
.npm/
7+
# ---- IGNORED ----
128

13-
# Don't package anything from here specifically:
14-
resources/rovo-dev/
9+
# Source code
10+
src/**
11+
12+
# Test
13+
testsutil/**
14+
__mocks__/**
15+
__tests__/**
16+
e2e/**
17+
coverage/**
18+
test-results/**
19+
.vscode-test/**
20+
*.test.ts
21+
*.test.tsx
22+
*.spec.ts
23+
*.spec.tsx
1524

25+
# Build configs
26+
webpack.*
27+
tsconfig.json
28+
tsconfig.notest.json
29+
eslint.config.mjs
30+
jest.config.ts
31+
jest.react.config.ts
32+
jest.unit.config.ts
33+
playwright.config.js
34+
.prettierignore
35+
.nvmrc
36+
37+
# Dev files
1638
.env
1739
.env.example
18-
.nvmrc
19-
.prettierignore
40+
.devcontainer/**
41+
.github/**
42+
.vscode/**
43+
.readme/**
44+
devhtml/**
45+
scripts/**
46+
.gitignore
47+
bitbucket-pipelines.yml
2048
CODEOWNERS
21-
changelog.md
2249
nightlyver.sh
23-
package.json
24-
readme.md
25-
eslint.config.mjs
26-
tsconfig.json
27-
tsconfig.notest.json
2850
vscode-stylenames.txt
29-
.devcontainer/
30-
.github/
31-
coverage/
32-
scripts/
33-
test-results/
34-
35-
.vscode/
36-
.vscode-test/
37-
out/test/
51+
.eslintcache
52+
53+
# node_modules
54+
node_modules/**
55+
!node_modules/@vscode/codicons/dist/**
56+
57+
# Yarn cache and internals
58+
.yarn/**
59+
!.yarn/releases
60+
!.yarn/plugins
61+
.yarnrc.yml
62+
yarn.lock
63+
64+
# Source maps
65+
**/*.map
3866
out/**/*.map
39-
src/
40-
testsutil/
41-
.gitignore
42-
bitbucket-pipelines.yml
67+
build/**/*.map
68+
69+
# Certificates
4370
*.pem
4471
*.crt
4572
*.p12
4673
*.vsix
4774
*.orig
48-
node_modules/
49-
!node_modules/@vscode/codicons/dist/**
50-
webpack.*
51-
build/**/*.map
52-
.readme/
53-
devhtml/
54-
jest.config.ts
55-
jest.react.config.ts
56-
jest.unit.config.ts
57-
playwright.config.js
75+
76+
# Generated files
77+
.generated/**
78+
.npm/**
79+
80+
# Don't package anything from here specifically:
81+
resources/rovo-dev/**

.yarnrc.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
5+
npmAuditExcludePackages:
6+
# This package isnt used directly in the code but remains as a dependency of @atlaskit/media-viewer package for internal support reasons
7+
# TODO: Remove this once @atlaskit/media-viewer is updated to a version that doesn't depend on this package
8+
# See https://asecurityteam.atlassian.net/browse/PBAC-2014
9+
10+
- pdfjs-dist
11+
12+
nodeLinker: node-modules

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ https://support.atlassian.com/bitbucket-cloud/docs/use-the-atlassian-for-vs-code
9090

9191
Running and debugging the extension:
9292

93-
- Atlassian for VS Code is a node project, as such you'll need to run `npm install` before building.
93+
- Atlassian for VS Code is a node project, as such you'll need to run `yarn install` before building.
9494
- To debug the extension from within VS Code you'll need a `launch.json`.
9595
** An example `launch.json` that will be suitable for most users is included as `.vscode/launch.json.example`.
9696
** To use the example file simply copy it to `launch.json`.
@@ -119,7 +119,7 @@ VSCode provides some very helpful [documentation](https://code.visualstudio.com/
119119
To run `atlascode` in such a way, please follow the VSCode documentation:
120120

121121
- Install [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) VSCode Extension
122-
- Run `npm install` like you normally would
122+
- Run `yarn install` like you normally would
123123
- In VSCode, choose `Dev Containers: Rebuild and Reopen in Container` from the command pallette
124124
- Wait for the VSCode to re-open in the container evnironment - you'll be able to see the difference in the header/search bar
125125
- Proceed to run or debug the extension as usual - it will now be running as it would in remote execution
@@ -133,7 +133,7 @@ Note: for advanced use-cases, it is possible to run scripts in dev containers vi
133133
## Tests
134134

135135
```
136-
npm run test
136+
yarn test
137137
```
138138

139139
## Contributions

0 commit comments

Comments
 (0)