Skip to content

Commit a0fb46c

Browse files
jansavNokel81
andauthored
Switch to using NPM workspaces (lensapp#7115)
* Switch to using npm over yarn Signed-off-by: Janne Savolainen <[email protected]> * Remove reference to `yarn` from documentation Signed-off-by: Sebastian Malton <[email protected]> * Enable NPM workspaces Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Introduce script for installing all dependencies Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Remove usage of lerna bootstrap for no longer being used Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Fix build by not bundling libraries for application in node environment (main) as Electron does that Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Tweak evil static import paths in build of application Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Consolidate npmrc configs to root since required by workspaces Co-authored-by: Mikko Aspiala <[email protected]> Signed-off-by: Janne Savolainen <[email protected]> * Make application build not fail for not detecting electron version Signed-off-by: Janne Savolainen <[email protected]> * Update package-lock Signed-off-by: Janne Savolainen <[email protected]> * Make sure native dependencies are rebuilt for electron Signed-off-by: Janne Savolainen <[email protected]> * Remove unused binary for causing trouble when installing dependencies Signed-off-by: Janne Savolainen <[email protected]> * Update package-lock Signed-off-by: Janne Savolainen <[email protected]> * Disable caching in CI for Windows Installing Electron in Windows seems to be broken in this regards. Signed-off-by: Janne Savolainen <[email protected]> --------- Signed-off-by: Janne Savolainen <[email protected]> Signed-off-by: Sebastian Malton <[email protected]> Co-authored-by: Sebastian Malton <[email protected]>
1 parent 219a683 commit a0fb46c

37 files changed

+32995
-40670
lines changed

.github/workflows/check-docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424

2525
- name: Generate Extensions API Reference using typedocs
2626
run: |
27-
yarn install
28-
yarn run build:docs
27+
npm install
28+
npm run build:docs
2929
3030
- name: Verify that the markdown is valid
3131
run: |
32-
yarn run mkdocs:verify
32+
npm run mkdocs:verify

.github/workflows/daily-alpha.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121

2222
- name: Install deps
2323
run: |
24-
yarn install
24+
npm install
2525
sudo apt-get install -y ripgrep
26-
cd packages/bump-version-for-cron && yarn build
26+
cd packages/bump-version-for-cron && npm run build
2727
env:
2828
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929
- name: Bump version
@@ -85,14 +85,14 @@ jobs:
8585
- name: Build package
8686
shell: bash
8787
run: |
88-
yarn install --frozen-lockfile
89-
yarn run build
88+
npm ci
89+
npm run build
9090
env:
9191
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9292
- name: Release to GitHub NPM registry
9393
run: |
9494
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
95-
yarn lerna \
95+
npx lerna \
9696
publish from-package \
9797
--no-push \
9898
--no-git-tag-version \

.github/workflows/linter.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
node-version: ${{ matrix.node-version }}
2121

2222
- name: Install deps
23-
run: yarn install
23+
run: npm install
2424

2525
- name: Lint
26-
run: yarn run lint
26+
run: npm run lint

.github/workflows/main.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434

3535
- name: Generate Extensions API Reference using typedocs
3636
run: |
37-
yarn install
38-
yarn run build:docs
37+
npm install
38+
npm run build:docs
3939
4040
- name: Verify that the markdown is valid
4141
run: |
42-
yarn run mkdocs:verify
42+
npm run mkdocs:verify
4343
4444
build:
4545
name: Deploy docs
@@ -77,8 +77,8 @@ jobs:
7777

7878
- name: Generate Extensions API Reference using typedocs
7979
run: |
80-
yarn install --frozen-lockfile
81-
yarn build:docs
80+
npm ci
81+
npm run build:docs
8282
8383
- name: mkdocs deploy master
8484
if: contains(github.ref, 'refs/heads/master')

.github/workflows/mkdocs-manual.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737

3838
- name: Generate Extensions API Reference using typedocs
3939
run: |
40-
yarn install
41-
yarn typedocs-extensions-api
40+
npm install
41+
npm run typedocs-extensions-api
4242
4343
- name: Checkout master branch from lens
4444
uses: actions/checkout@v3

.github/workflows/publish-release-npm.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ jobs:
3232

3333
- name: Generate NPM packages
3434
run: |
35-
yarn install --frozen-lockfile
36-
yarn run build
35+
npm ci
36+
npm run build
3737
3838
- name: Publish NPM packages
3939
run: |
4040
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
4141
VERSION=$(cat lerna.json | jq '.version' --raw-output)
4242
echo ${VERSION}
4343
DIST_TAG=$(node packages/semver/dist/index.js --prerelease 0 ${VERSION})
44-
yarn lerna \
44+
npx lerna \
4545
publish from-package \
4646
--no-push \
4747
--no-git-tag-version \

.github/workflows/test.yml

+14-12
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,30 @@ jobs:
3232
with:
3333
node-version: ${{ matrix.node-version }}
3434

35-
- name: Get yarn cache directory path
36-
id: yarn-cache-dir-path
35+
- name: Get npm cache directory path
36+
if: ${{ runner.os != 'Windows' }}
37+
id: npm-cache-dir-path
3738
shell: bash
38-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
39+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
3940

4041
- uses: actions/cache@v3
41-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
42+
if: ${{ runner.os != 'Windows' }}
43+
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
4244
with:
43-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
44-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
45+
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
46+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
4547
restore-keys: |
46-
${{ runner.os }}-yarn-
48+
${{ runner.os }}-npm-
4749
4850
- uses: nick-fields/retry@v2
4951
name: Install dependencies
5052
with:
5153
timeout_minutes: 20
5254
max_attempts: 3
5355
retry_on: error
54-
command: yarn install --frozen-lockfile
56+
command: npm ci
5557

56-
- run: yarn run test:unit
58+
- run: npm run test:unit
5759
name: Run tests
5860
if: ${{ matrix.type == 'unit' }}
5961

@@ -64,15 +66,15 @@ jobs:
6466
minikube-version: latest
6567
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
6668

67-
- run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' yarn run test:integration
69+
- run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' npm run test:integration
6870
name: Run Linux integration tests
6971
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
7072

71-
- run: yarn run test:integration
73+
- run: npm run test:integration
7274
name: Run macOS integration tests
7375
shell: bash
7476
if: ${{ runner.os == 'macOS' && matrix.type == 'smoke' }}
7577

76-
- run: yarn run test:integration
78+
- run: npm run test:integration
7779
name: Run Windows integration tests
7880
if: ${{ runner.os == 'Windows' && matrix.type == 'smoke' }}

.npmrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
engine-strict=true
1+
disturl "https://electronjs.org/headers"
2+
target "19.0.4"
3+
runtime "electron"

.yarnrc

-3
This file was deleted.

RELEASE_GUIDE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ All releases will be made by creating a PR which bumps the version field in the
55

66
## Prerequisites
77

8-
- `yarn`
9-
- Running `yarn` (to install all dependencies)
8+
- `npm`
9+
- Running `npm install`
1010
- `gh` (Github's CLI) with a version at least 2.15.0
1111

1212
## Steps
1313

1414
1. If you are making a minor or major release (or prereleases for one) make sure you are on the `master` branch.
1515
1. If you are making a patch release (or a prerelease for one) make sure you are on the `release/v<MAJOR>.<MINOR>` branch.
16-
1. Run `yarn create-release-pr <release-type>`. If you are making a subsequent prerelease release, provide the `--check-commits` flag.
16+
1. Run `npm run create-release-pr <release-type>`. If you are making a subsequent prerelease release, provide the `--check-commits` flag.
1717
1. If you are checking the commits, type `y<ENTER>` to pick a commit, and `n<ENTER>` to skip it. You will want to skip the commits that were part of previous prerelease releases.
1818
1. Once the PR is created, approved, and then merged the `Release Open Lens` workflow will create a tag and release for you.
1919
1. If you are making a major or minor release, create a `release/v<MAJOR>.<MINOR>` branch and push it to `origin` so that future patch releases can be made from it.

lerna.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"useWorkspaces": false,
4-
"packages": [
5-
"packages/*"
6-
],
3+
"useWorkspaces": true,
74
"version": "6.4.0-beta.13",
8-
"npmClient": "yarn",
5+
"npmClient": "npm",
96
"npmClientArgs": [
107
"--network-timeout=100000"
118
]

0 commit comments

Comments
 (0)