Skip to content

Commit 12fa355

Browse files
author
Shubham Kanodia
committed
Move from npm to yarn
1 parent e33163c commit 12fa355

File tree

15 files changed

+19758
-51
lines changed

15 files changed

+19758
-51
lines changed

.github/PULL_REQUEST_TEMPLATE.md

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

2727
Basic checks:
2828

29-
- [ ] `npm run lint`
30-
- [ ] `npm run test`
29+
- [ ] `yarn lint`
30+
- [ ] `yarn test`

.github/workflows/build.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: 20
28-
cache: 'npm'
28+
cache: 'yarn'
2929

3030
- name: Install dependencies
31-
run: npm install
31+
run: yarn install
3232

3333
- name: Run linter
34-
run: npm run lint
34+
run: yarn lint
3535

3636
- name: Run unit tests
37-
run: npm run test
37+
run: yarn test
3838

3939
- name: Fetch E2E image
4040
run: |
@@ -44,4 +44,4 @@ jobs:
4444
- name: Run E2E tests
4545
env:
4646
ATLASCODE_TEST_USER_API_TOKEN: ${{ secrets.ATLASCODE_TEST_USER_API_TOKEN }}
47-
run: npm run test:e2e:docker
47+
run: yarn test:e2e:docker

.github/workflows/release-nightly.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ jobs:
3636
uses: actions/setup-node@v4
3737
with:
3838
node-version: 20
39-
cache: 'npm'
39+
cache: 'yarn'
4040

4141
- name: Set version
4242
run: |
4343
npm -no-git-tag-version --allow-same-version -f version $PACKAGE_VERSION
4444
4545
- name: Install dependencies
46-
run: npm install
46+
run: yarn install
4747

4848
- name: Run linter
49-
run: npm run lint
49+
run: yarn lint
5050

5151
- name: Run unit tests
52-
run: npm run test
52+
run: yarn test
5353

5454
- name: Fetch E2E image
5555
run: |
@@ -59,11 +59,10 @@ jobs:
5959
- name: Run E2E tests
6060
env:
6161
ATLASCODE_TEST_USER_API_TOKEN: ${{ secrets.ATLASCODE_TEST_USER_API_TOKEN }}
62-
run: npm run test:e2e:docker
62+
run: yarn test:e2e:docker
6363

64-
# TODO: might want to run this first, and reuse the .vsix in E2E tests instead
65-
- name: Build the extension
66-
run: npm run extension:package:prerelease
64+
- name: Package extension (prerelease)
65+
run: yarn extension:package:prerelease
6766

6867
- name: Publish the pre-release extension
6968
run: |

.github/workflows/release.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ jobs:
4343
uses: actions/setup-node@v4
4444
with:
4545
node-version: 20
46-
cache: 'npm'
46+
cache: 'yarn'
4747

4848
- name: Set version
4949
run: npm -no-git-tag-version --allow-same-version -f version $PACKAGE_VERSION
5050

5151
- name: Install dependencies
52-
run: npm install
52+
run: yarn install
5353

5454
- name: Run linter
55-
run: npm run lint
55+
run: yarn lint
5656

5757
- name: Run unit tests
58-
run: npm run test
58+
run: yarn test
5959

6060
- name: Fetch E2E image
6161
run: |
@@ -65,11 +65,10 @@ jobs:
6565
- name: Run E2E tests
6666
env:
6767
ATLASCODE_TEST_USER_API_TOKEN: ${{ secrets.ATLASCODE_TEST_USER_API_TOKEN }}
68-
run: npm run test:e2e:docker
68+
run: yarn test:e2e:docker
6969

70-
# TODO: might want to run this first, and reuse the .vsix in E2E tests instead
71-
- name: Build the extension
72-
run: npm run extension:package
70+
- name: Package extension
71+
run: yarn extension:package
7372

7473
- name: Publish the extension
7574
run: |

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ coverage
1919
.generated/
2020
e2e/.resources/
2121
e2e/.test-extensions/
22+
23+
# Yarn Berry
24+
.yarn/*
25+
!.yarn/patches
26+
!.yarn/plugins
27+
!.yarn/releases
28+
!.yarn/sdks
29+
!.yarn/versions
30+
.pnp.*

.vscode/launch.json.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"outFiles": [
3838
"${workspaceFolder}/build/**/*.js"
3939
],
40-
"preLaunchTask": "npm: devcompile"
40+
"preLaunchTask": "yarn: devcompile"
4141
},
4242
{
43-
// This configuration requires npm run dev to be running externally
43+
// This configuration requires yarn dev to be running externally
4444
// It will pick up the re-compiled extension code but not hot-swap it
4545
"name": "Extension (watch/external)",
4646
"type": "extensionHost",

.yarn/releases/yarn-4.7.0.cjs

Lines changed: 935 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.7.0.cjs
4+
5+
# npmRegistryServer: "https://packages.atlassian.com/api/npm/npm-remote"
6+
# unsafeHttpWhitelist: ["packages.atlassian.com"]

HOMEPAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Please read our [Code of Conduct](CODE_OF_CONDUCT.md).
6363

6464
Running and debugging the extension:
6565

66-
- Atlassian for VS Code is a node project, as such you'll need to run `npm install` before building.
66+
- Atlassian for VS Code is a node project, as such you'll need to run `yarn install` before building.
6767
- To debug the extension from within VS Code you'll need a `launch.json`.
6868
** An example `launch.json` that will be suitable for most users is included as `.vscode/launch.json.example`.
6969
** To use the example file simply copy it to `launch.json`.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Please use the in-app feedback form to tell us what you think! It's available fr
5555

5656
Running and debugging the extension:
5757

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

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

102102
```
103-
npm run test
103+
yarn test
104104
```
105105

106106
## Contributions

e2e/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor
1313
&& apt update \
1414
&& apt install -y code \
1515
&& rm -rf /var/lib/apt/lists/* \
16-
&& npm install -g npm@latest
16+
&& npm install -g yarn
17+
18+
# Install corepack to enable Yarn
19+
RUN corepack enable
1720

1821
# Running vscode as root is not recommended, so let's create a user.
1922
# We need that user's $HOME to exist for the test process to work properly.

e2e/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ What do these tests use?
1818
Commands related to e2e tests:
1919

2020
# Compile the tests in this folder into JS
21-
npm run test:e2e:compile
21+
yarn test:e2e:compile
2222

2323
# Build the extension, e2e tests, configure the test runner,
2424
# then run the E2E tests
25-
npm run test:e2e
25+
yarn test:e2e
2626

2727
# Run the tests without rebuilding the extension
2828
# Use this one when iterating
29-
npm run test:e2e:rerun
29+
yarn test:e2e:rerun
3030

3131
### Running E2E Tests Headless
3232

3333
I'm sure we all love looking at the VSCode UI - but sometimes one might want to take a break from that, and run their tests in console only 😉 Unfortunately, [vscode-extension-tester](https://github.com/redhat-developer/vscode-extension-tester) doesn't have built-in support for [headless](https://en.wikipedia.org/wiki/Headless_browser) execution.
3434

3535
However, we can work around that - by running our tests in Docker! We can mount our whole working directory, and run tests in [xvfb](https://en.wikipedia.org/wiki/Xvfb).
3636

37-
In this folder, there's a `Dockerfile` with a rather lightweight image - `vscode`, `xvfb`, their dependencies, and `npm`/`node` - and some scripts to run it. The intended usage is as follows:
37+
In this folder, there's a `Dockerfile` with a rather lightweight image - `vscode`, `xvfb`, their dependencies, and `node`/`yarn` - and some scripts to run it. The intended usage is as follows:
3838

39-
- Build the docker image by running `npm run test:e2e:docker:build`. You only need to do it once
39+
- Build the docker image by running `yarn test:e2e:docker:build`. You only need to do it once
4040
- Run one of the two commands:
41-
- `npm run test:e2e:docker` - this will do the full cycle of building the extension and setting up tests. You typically want to run this when you've just updated the extension
42-
- `npm run test:e2e:docker:rerun` - a much faster command to rerun the tests against an already prepared setup. Use this when iterating on tests themselves
41+
- `yarn test:e2e:docker` - this will do the full cycle of building the extension and setting up tests. You typically want to run this when you've just updated the extension
42+
- `yarn test:e2e:docker:rerun` - a much faster command to rerun the tests against an already prepared setup. Use this when iterating on tests themselves

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,36 @@
4848
"scripts": {
4949
"precommit": "pretty-quick --staged",
5050
"vscode:uninstall": "node ./build/extension/uninstall.js",
51-
"vscode:prepublish": "npm run compile",
51+
"vscode:prepublish": "yarn compile",
5252
"clean": "rm -rf ./build",
5353
"format": "prettier --write --log-level warn src e2e",
5454
"lint": "eslint ./src ./e2e --ext .js,.jsx,.ts,.tsx",
5555
"lint:fix": "eslint --fix ./src ./e2e --ext .js,.jsx,.ts,.tsx",
56-
"compile": "npm run clean && npm run compile:react && npm run compile:extension",
56+
"compile": "yarn clean && yarn compile:react && yarn compile:extension",
5757
"compile:extension": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack.extension.prod.js",
5858
"compile:react": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack.react.prod.js",
5959
"postinstall": "cp ./scripts/githooks/pre-commit ./.git/hooks && patch-package",
6060
"extension:clean": "rm -rf ./atlascode-*.vsix",
61-
"extension:package:prerelease": "npm run extension:clean && vsce package --pre-release --baseContentUrl https://raw.githubusercontent.com/atlassian/atlascode/main/",
62-
"extension:package": "npm run extension:clean && vsce package --baseContentUrl https://raw.githubusercontent.com/atlassian/atlascode/main/",
63-
"extension:install": "npm run extension:package && code --install-extension ./atlascode-*.vsix --force",
64-
"test": "rm -rf coverage && npm run test:unit && npm run test:react && istanbul-merge --out coverage/coverage-final.json coverage/react/coverage-final.json coverage/unit/coverage-final.json && echo '\n\nTotal test coverage:' && nyc report --reporter clover --reporter lcov --reporter html --reporter text-summary -t coverage/ --report-dir coverage/",
61+
"extension:package:prerelease": "yarn extension:clean && vsce package --pre-release --baseContentUrl https://raw.githubusercontent.com/atlassian/atlascode/main/",
62+
"extension:package": "yarn extension:clean && vsce package --baseContentUrl https://raw.githubusercontent.com/atlassian/atlascode/main/",
63+
"extension:install": "yarn extension:package && code --install-extension ./atlascode-*.vsix --force",
64+
"test": "rm -rf coverage && yarn test:unit && yarn test:react && istanbul-merge --out coverage/coverage-final.json coverage/react/coverage-final.json coverage/unit/coverage-final.json && echo '\n\nTotal test coverage:' && nyc report --reporter clover --reporter lcov --reporter html --reporter text-summary -t coverage/ --report-dir coverage/",
6565
"test:unit": "jest -c jest.unit.config.js",
6666
"test:react": "jest -c jest.react.config.js",
6767
"test:e2e": "echo 'token length' && echo ${#ATLASCODE_TEST_USER_API_TOKEN} && npm run test:e2e:compile && e2e/scripts/run",
6868
"test:e2e:compile": "tsc --project e2e/tsconfig.e2e.json",
69-
"test:e2e:rerun": "npm run test:e2e:compile && e2e/scripts/run --rerun",
69+
"test:e2e:rerun": "yarn test:e2e:compile && e2e/scripts/run --rerun",
7070
"test:e2e:docker": "e2e/scripts/in-docker npm run test:e2e",
7171
"test:e2e:docker:build": "e2e/scripts/build-docker",
72-
"test:e2e:docker:rerun": "e2e/scripts/in-docker npm run test:e2e:rerun",
72+
"test:e2e:docker:rerun": "e2e/scripts/in-docker yarn test:e2e:rerun",
7373
"devcompile": "npm-run-all --parallel devcompile:react devcompile:extension",
7474
"devcompile:react": "webpack --mode development --config webpack.react.dev.js",
7575
"devcompile:extension": "webpack --mode development --config webpack.extension.dev.js",
7676
"release:stable": "scripts/release.sh",
77-
"watch": "concurrently -r \"npm:watch:*\"",
77+
"watch": "concurrently -r \"yarn watch:extension\" \"yarn watch:react\"",
7878
"watch:extension": "WATCH=true webpack --mode development --config webpack.react.dev.js --progress --watch",
7979
"watch:react": "WATCH=true webpack --mode development --config webpack.extension.dev.js --progress --watch",
80-
"dev": "concurrently -r npm:watch:extension npm:watch:react",
80+
"dev": "concurrently -r yarn:watch:extension yarn:watch:react",
8181
"mui:atlascodeSettings:dark": "cross-env PAGETSX=\"config/ConfigPage.tsx\" VIEW=\"atlascodeSettingsV2\" THEME=\"dark\" webpack-dev-server --open --config webpack.mui.webview.js",
8282
"mui:atlascodeSettings:light": "cross-env PAGETSX=\"config/ConfigPage.tsx\" VIEW=\"atlascodeSettingsV2\" THEME=\"light\" webpack-dev-server --open --config webpack.mui.webview.js",
8383
"mui:atlascodeOnboarding:dark": "cross-env PAGETSX=\"onboarding/OnboardingPage.tsx\" VIEW=\"atlascodeOnboardingV2\" THEME=\"dark\" webpack-dev-server --open --config webpack.mui.webview.js",
@@ -1606,7 +1606,6 @@
16061606
"@types/lodash.debounce": "^4.0.6",
16071607
"@types/lodash.orderby": "^4.6.6",
16081608
"@types/lodash.truncate": "^4.4.6",
1609-
"@types/mocha": "^10.0.10",
16101609
"@types/node": "^18.16.19",
16111610
"@types/node-ipc": "^9.2.0",
16121611
"@types/prosemirror-state": "^1.2.5",
@@ -1619,10 +1618,10 @@
16191618
"@types/terser-webpack-plugin": "^2.2.0",
16201619
"@types/turndown": "^5.0.1",
16211620
"@types/uuid": "^3.4.7",
1622-
"@types/vscode": "^1.77.0",
1621+
"@types/vscode": "1.96.0",
16231622
"@types/webpack": "^5.28.5",
16241623
"@types/webpack-manifest-plugin": "^2.1.0",
1625-
"@types/websocket": "^1.0.0",
1624+
"@types/websocket": "1.0.0",
16261625
"@typescript-eslint/eslint-plugin": "^8.7.0",
16271626
"@typescript-eslint/parser": "^8.7.0",
16281627
"@vscode/vsce": "^3.1.0",
@@ -1648,6 +1647,7 @@
16481647
"jest-environment-jsdom": "^29.7.0",
16491648
"jest-mock-vscode": "^4.0.4",
16501649
"mini-css-extract-plugin": "^2.9.1",
1650+
"mocha": "11.0.1",
16511651
"npm-run-all": "^4.1.5",
16521652
"nyc": "^17.1.0",
16531653
"ovsx": "^0.10.1",

scripts/githooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npm run lint
1+
yarn lint

0 commit comments

Comments
 (0)