Skip to content

Commit 2657df2

Browse files
authored
Restructure to monorepo (lensapp#6907)
* wip: restructure to monorepo Signed-off-by: Jari Kolehmainen <[email protected]> * refactor create-release-pr to a package Signed-off-by: Jari Kolehmainen <[email protected]> * build fixes Signed-off-by: Jari Kolehmainen <[email protected]> * github workflow fixes Signed-off-by: Jari Kolehmainen <[email protected]> * fix typo Signed-off-by: Jari Kolehmainen <[email protected]> * add webpack-env types to core Signed-off-by: Jari Kolehmainen <[email protected]> * fix github workflows Signed-off-by: Jari Kolehmainen <[email protected]> * refactor/fix integration tests Signed-off-by: Jari Kolehmainen <[email protected]> * lint fix Signed-off-by: Jari Kolehmainen <[email protected]> * yarn run dev Signed-off-by: Jari Kolehmainen <[email protected]> * eslint settings for vscode Signed-off-by: Jari Kolehmainen <[email protected]> * move templates to right package Signed-off-by: Jari Kolehmainen <[email protected]> * open-lens build fixes Signed-off-by: Jari Kolehmainen <[email protected]> * integration test fix Signed-off-by: Jari Kolehmainen <[email protected]> * fix nx task dependencies Signed-off-by: Jari Kolehmainen <[email protected]> * use bash shell for unit tests in test workflow Signed-off-by: Jari Kolehmainen <[email protected]> * fix test:unit for windows Signed-off-by: Jari Kolehmainen <[email protected]> * fix win-ca webpack error in open-lens Signed-off-by: Jari Kolehmainen <[email protected]> * fix win-ca webpack error in open-lens Signed-off-by: Jari Kolehmainen <[email protected]> * fix build:app on windows Signed-off-by: Jari Kolehmainen <[email protected]> * remove ELECTRON_BUILDER_EXTRA_ARGS Signed-off-by: Jari Kolehmainen <[email protected]> * sync src/ from master Signed-off-by: Jari Kolehmainen <[email protected]> * remove Makefile from core Signed-off-by: Jari Kolehmainen <[email protected]> Signed-off-by: Jari Kolehmainen <[email protected]>
1 parent 0066ca4 commit 2657df2

File tree

3,321 files changed

+28741
-11489
lines changed

Some content is hidden

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

3,321 files changed

+28741
-11489
lines changed

.github/workflows/bump-master-version.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,25 @@ jobs:
1919
fetch-depth: 0
2020
- name: Install dependencies
2121
run: |
22-
npm i --location=global semver
22+
yarn install --frozen-lockfile
2323
- name: Bump version to first alpha of next minor version
2424
id: bump
2525
run: |
26-
CURRENT_VERSION=$(cat package.json | jq .version --raw-output)
26+
CURRENT_VERSION=$(cat lerna.json | jq .version --raw-output)
2727
2828
if ! [[ "${CURRENT_VERSION}" =~ ^\d+\.\d+\.0$ ]]; then
2929
echo "Not a minor release"
3030
echo "status=skip" >> $GITHUB_OUTPUT
3131
exit 0
3232
fi
3333
34-
NEW_VERSION=$(cat package.json | jq .version --raw-output | xargs semver -i preminor --preid alpha)
35-
cat package.json | jq --arg new_version "$NEW_VERSION" '.version = $new_version' > new-package.json
36-
mv new-package.json package.json
34+
yarn bump-version preminor
3735
3836
echo "status=create" >> $GITHUB_OUTPUT
3937
- uses: peter-evans/create-pull-request@v4
4038
if: ${{ steps.bump.outputs.status == 'create' }}
4139
with:
42-
add-paths: package.json
40+
add-paths: lerna.json,packages/*/package.json
4341
commit-message: Update package.json version to next preminor because of recent release
4442
signoff: true
4543
delete-branch: true

.github/workflows/check-docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
- name: Generate Extensions API Reference using typedocs
2525
run: |
2626
yarn install
27-
yarn typedocs-extensions-api
27+
yarn run build:docs
2828
2929
- name: Verify that the markdown is valid
3030
run: |
31-
yarn run verify-docs
31+
yarn run mkdocs:verify

.github/workflows/electronegativity.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: doyensec/[email protected]
2020
with:
21-
input: src/
21+
input: packages/core/src/
2222
electron-version: "19.0.4"
2323
severity: medium
2424

.github/workflows/license-header.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
set -e
2626
export PATH=${PATH}:`go env GOPATH`/bin
2727
28-
addlicense -check -l mit -c "OpenLens Authors" src/**/*.?css
28+
addlicense -check -l mit -c "OpenLens Authors" packages/*/src/**/*.?css

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
- name: Generate Extensions API Reference using typedocs
3636
run: |
3737
yarn install
38-
yarn typedocs-extensions-api
38+
yarn run build:docs
3939
4040
- name: Verify that the markdown is valid
4141
run: |
42-
yarn run verify-docs
42+
yarn 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
81-
yarn typedocs-extensions-api
80+
yarn install --frozen-lockfile
81+
yarn build:docs
8282
8383
- name: mkdocs deploy master
8484
if: contains(github.ref, 'refs/heads/master')

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ jobs:
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727

28-
- name: Generate NPM package
28+
- name: Generate NPM packages
2929
run: |
30-
make build-extensions-npm
30+
yarn install --frozen-lockfile
31+
yarn run build
3132
32-
- name: publish new release
33+
- name: Publish NPM package
3334
run: |
34-
make publish-extensions-npm
35-
env:
36-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37-
NPM_RELEASE_TAG: master
35+
yarn lerna publish from-package --dist-tag master --no-push --no-git-tag-version --yes

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

+7-33
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ on:
1212
type: string
1313
description: The version to release manually
1414
jobs:
15-
publish-extensions:
16-
name: Publish Extensions NPM Package Release
15+
publish-npm-packages:
16+
name: Publish NPM Packages
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
@@ -30,39 +30,13 @@ jobs:
3030
with:
3131
node-version: ${{ matrix.node-version }}
3232

33-
- name: Generate NPM package
33+
- name: Generate NPM packages
3434
run: |
35-
make build-extensions-npm
35+
yarn install --frozen-lockfile
36+
yarn run build
3637
37-
- name: Publish NPM package
38+
- name: Publish NPM packages
3839
run: |
39-
make publish-extensions-npm
40-
env:
41-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42-
publish-library:
43-
name: Publish Library NPM Package Release
44-
runs-on: ubuntu-latest
45-
strategy:
46-
matrix:
47-
node-version: [16.x]
48-
steps:
49-
- name: Checkout Release
50-
uses: actions/checkout@v3
51-
with:
52-
fetch-depth: 0
53-
ref: ${{ inputs.version }}
54-
55-
- name: Using Node.js ${{ matrix.node-version }}
56-
uses: actions/setup-node@v3
57-
with:
58-
node-version: ${{ matrix.node-version }}
59-
60-
- name: Generate NPM package
61-
run: |
62-
make build-library-npm
63-
64-
- name: Publish NPM package
65-
run: |
66-
make publish-library-npm
40+
yarn lerna publish from-package --no-push --no-git-tag-version --yes
6741
env:
6842
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ jobs:
5151
timeout_minutes: 10
5252
max_attempts: 3
5353
retry_on: error
54-
command: make node_modules
54+
command: yarn install --frozen-lockfile
5555

5656
- run: make test
5757
name: Run tests
58+
shell: bash
5859
if: ${{ matrix.type == 'unit' }}
5960

6061
- run: make ci-validate-dev
@@ -68,20 +69,16 @@ jobs:
6869
minikube-version: latest
6970
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
7071

71-
- run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' make integration
72+
- run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' yarn run test:integration
7273
name: Run Linux integration tests
7374
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
7475

75-
- run: make integration
76+
- run: yarn run test:integration
7677
name: Run macOS integration tests
7778
shell: bash
78-
env:
79-
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --arm64"
8079
if: ${{ runner.os == 'macOS' && matrix.type == 'smoke' }}
8180

82-
- run: make integration
81+
- run: yarn run test:integration
8382
name: Run Windows integration tests
8483
shell: bash
85-
env:
86-
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --ia32"
8784
if: ${{ runner.os == 'Windows' && matrix.type == 'smoke' }}

.gitignore

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
dist/
21
node_modules/
32
.DS_Store
43
yarn-error.log
5-
coverage/
64
tmp/
7-
locales/**/**.js
85
lens.log
9-
static/build
10-
static/types
11-
binaries/client/
12-
binaries/server/
136
docs/extensions/api
147
site/
15-
build/webpack/
8+
lerna-debug.log

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.workingDirectories": [{ "mode": "auto" }]
3+
}

.yarnrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
disturl "https://electronjs.org/headers"
2-
target "19.0.4"
3-
runtime "electron"
1+
--install.check-files true
2+
--install.network-timeout 100000

Makefile

+11-92
Original file line numberDiff line numberDiff line change
@@ -5,108 +5,27 @@ CMD_ARGS = $(filter-out $@,$(MAKECMDGOALS))
55

66
ELECTRON_BUILDER_EXTRA_ARGS ?=
77

8-
ifeq ($(OS),Windows_NT)
9-
DETECTED_OS := Windows
10-
else
11-
DETECTED_OS := $(shell uname)
12-
endif
13-
14-
node_modules: yarn.lock
15-
yarn install --check-files --frozen-lockfile --network-timeout=100000
16-
17-
binaries/client: node_modules
18-
yarn download:binaries
19-
20-
.PHONY: compile-dev
21-
compile-dev: node_modules
22-
yarn compile:main --cache
23-
yarn compile:renderer --cache
24-
25-
.PHONY: validate-dev
26-
ci-validate-dev: binaries/client compile-dev
27-
28-
.PHONY: dev
29-
dev: binaries/client
30-
rm -rf static/build/
31-
yarn run build:tray-icons
32-
yarn dev
8+
.PHONY: bootstrap
9+
bootstrap:
10+
yarn install
3311

3412
.PHONY: lint
3513
lint: node_modules
3614
yarn lint
3715

38-
.PHONY: tag-release
39-
tag-release:
40-
scripts/tag-release.sh $(CMD_ARGS)
41-
4216
.PHONY: test
43-
test: node_modules binaries/client
44-
yarn run jest $(or $(CMD_ARGS), "src")
17+
test: node_modules
18+
yarn run test:unit
4519

4620
.PHONY: integration
4721
integration: build
48-
yarn integration
49-
50-
.PHONY: build-impl
51-
build-impl:
52-
yarn run download:binaries
53-
yarn run build:tray-icons
54-
yarn run compile
55-
ifeq "$(DETECTED_OS)" "Windows"
56-
# https://github.com/ukoloff/win-ca#clear-pem-folder-on-publish
57-
rm -rf node_modules/win-ca/pem
58-
endif
59-
yarn run electron-builder --publish onTag $(ELECTRON_BUILDER_EXTRA_ARGS)
22+
yarn test:integration
6023

6124
.PHONY: build
62-
build: node_modules binaries/client build-impl
63-
64-
src/extensions/npm/extensions/__mocks__:
65-
cp -r __mocks__ src/extensions/npm/extensions/
66-
67-
packages/extensions/dist: packages/extensions/node_modules
68-
yarn compile:extension-types
69-
70-
packages/extensions/node_modules: packages/extensions/package.json
71-
cd packages/extensions/ && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
72-
73-
.PHONY: build-extensions-npm
74-
build-extensions-npm: build-extension-types
75-
yarn npm:fix-extensions-package-version
76-
77-
.PHONY: build-library-npm
78-
build-library-npm: node_modules
79-
yarn compile-library
80-
81-
.PHONY: build-extension-types
82-
build-extension-types: node_modules packages/extensions/dist
83-
84-
.PHONY: publish-extensions-npm
85-
publish-extensions-npm: node_modules build-extensions-npm
86-
./scripts/publish-extensions-npm.sh
87-
88-
.PHONY: publish-library-npm
89-
publish-library-npm: node_modules build-library-npm
90-
./scripts/publish-library-npm.sh
91-
92-
.PHONY: build-docs
93-
build-docs:
94-
yarn typedocs-extensions-api
95-
96-
.PHONY: docs
97-
docs: build-docs
98-
yarn mkdocs-serve-local
99-
100-
.PHONY: clean-npm
101-
clean-npm:
102-
rm -rf packages/extensions/{dist,__mocks__,node_modules}
103-
rm -rf static/build/library/
25+
build:
26+
yarn lerna run build:app
10427

10528
.PHONY: clean
106-
clean: clean-npm
107-
rm -rf binaries/client
108-
rm -rf dist
109-
rm -rf static/build
110-
rm -rf node_modules
111-
rm -rf site
112-
rm -rf docs/extensions/api
29+
clean:
30+
yarn run clean
31+
yarn run clean:node_modules

build/set_extensions_npm_version.ts

-25
This file was deleted.

lerna.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"useWorkspaces": false,
4+
"packages": [
5+
"packages/*"
6+
],
7+
"version": "6.4.0-alpha.2",
8+
"npmClient": "yarn"
9+
}

0 commit comments

Comments
 (0)