Skip to content

Commit f74e385

Browse files
jobalaLukas Holzer
and
Lukas Holzer
authored
fix: build packages with lerna (#4524)
* chore: add lerna * chore: update files, exports & main paths in package.json * chore: use independent versioning * chore: add build step in workflow.yml * chore: build before lint * chore: update run utils * chore: update copy path * chore: add build packages step in the test job * chore: use npm workspaces instead of lerna * chore: build workspace * chore: use lerna and add prebuild step * chore: copy into lib directory * chore: update import path in tests to point to lib instead of src * chore: update regex * chore: build workspaces before releasing and use npm install * chore: build workspaces in prelease workflow Co-authored-by: Lukas Holzer <[email protected]>
1 parent e06bd63 commit f74e385

File tree

37 files changed

+27582
-10523
lines changed

37 files changed

+27582
-10523
lines changed

Diff for: .github/workflows/pre-release.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
run: git config --global user.name github-actions
3939
- name: Setup git email
4040
run: git config --global user.email [email protected]
41+
- name: Build workspaces
42+
run: npx lerna run build
4143
- name: Create fake .git in package subdirectory
4244
# See https://github.com/npm/cli/issues/2010,https://github.com/npm/npm/issues/9111
4345
run: mkdir packages/${{ steps.extract.outputs.package }}/.git
@@ -55,7 +57,7 @@ jobs:
5557
- name: Push changes
5658
run: git push --follow-tags
5759
- name: Install dependencies
58-
run: npm ci
60+
run: npm install
5961
- run: npm publish packages/${{ steps.extract.outputs.package }}/ --tag=${{ steps.extract.outputs.tag }}
6062
env:
6163
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Diff for: .github/workflows/release-please.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ jobs:
2727
check-latest: true
2828
registry-url: 'https://registry.npmjs.org'
2929
if: ${{ steps.release.outputs.releases_created }}
30+
- name: Build workspaces
31+
run: npx lerna run build
3032
- name: Install dependencies
31-
run: npm ci
33+
run: npm install
3234
if: ${{ steps.release.outputs.releases_created }}
3335
# Publish new releases in order of dependencies
3436
- run: npm publish packages/git-utils/

Diff for: .github/workflows/workflow.yml

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
- name: Install dependencies
3232
run: npm ci
3333
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
34+
- name: Build workspaces
35+
run: npx lerna run build
36+
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
3437
- name: Linting
3538
run: npm run format:ci
3639
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
@@ -106,6 +109,9 @@ jobs:
106109
- name: Install npm@7
107110
run: npm install -g npm@7
108111
if: ${{ matrix.node-version == '12.20.0' && !steps.release-check.outputs.IS_RELEASE }}
112+
- name: Build workspaces
113+
run: npx lerna run build
114+
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
109115
- name: Install dependencies
110116
run: ${{ matrix.install-command }}
111117
if: ${{ !steps.release-check.outputs.IS_RELEASE }}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ coverage
99
.cache
1010
.vscode
1111
packages/*/package-lock.json
12+
packages/*/lib/
1213
**/fixtures/**/test_netlify.toml
1314
**/fixtures/**/test_headers
1415
**/fixtures/**/test_redirects

Diff for: lerna.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"useNx": true,
4+
"useWorkspaces": true,
5+
"version": "independent"
6+
}

Diff for: nx.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tasksRunnerOptions": {
3+
"default": {
4+
"runner": "nx/tasks-runners/default",
5+
"options": {
6+
"cacheableOperations": ["build", "test"]
7+
}
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)