Skip to content

Commit

Permalink
fix: build packages with lerna (#4524)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
jobala and Lukas Holzer authored Sep 23, 2022
1 parent e06bd63 commit f74e385
Show file tree
Hide file tree
Showing 37 changed files with 27,582 additions and 10,523 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
run: git config --global user.name github-actions
- name: Setup git email
run: git config --global user.email [email protected]
- name: Build workspaces
run: npx lerna run build
- name: Create fake .git in package subdirectory
# See https://github.com/npm/cli/issues/2010,https://github.com/npm/npm/issues/9111
run: mkdir packages/${{ steps.extract.outputs.package }}/.git
Expand All @@ -55,7 +57,7 @@ jobs:
- name: Push changes
run: git push --follow-tags
- name: Install dependencies
run: npm ci
run: npm install
- run: npm publish packages/${{ steps.extract.outputs.package }}/ --tag=${{ steps.extract.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4 changes: 3 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
check-latest: true
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.releases_created }}
- name: Build workspaces
run: npx lerna run build
- name: Install dependencies
run: npm ci
run: npm install
if: ${{ steps.release.outputs.releases_created }}
# Publish new releases in order of dependencies
- run: npm publish packages/git-utils/
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Install dependencies
run: npm ci
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
- name: Build workspaces
run: npx lerna run build
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
- name: Linting
run: npm run format:ci
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
Expand Down Expand Up @@ -106,6 +109,9 @@ jobs:
- name: Install npm@7
run: npm install -g npm@7
if: ${{ matrix.node-version == '12.20.0' && !steps.release-check.outputs.IS_RELEASE }}
- name: Build workspaces
run: npx lerna run build
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
- name: Install dependencies
run: ${{ matrix.install-command }}
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ coverage
.cache
.vscode
packages/*/package-lock.json
packages/*/lib/
**/fixtures/**/test_netlify.toml
**/fixtures/**/test_headers
**/fixtures/**/test_redirects
Expand Down
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": true,
"useWorkspaces": true,
"version": "independent"
}
10 changes: 10 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "test"]
}
}
}
}
Loading

0 comments on commit f74e385

Please sign in to comment.