Skip to content

Commit

Permalink
chore(tools): move from lerna to npm workspace + nx (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart authored Feb 1, 2022
1 parent 87a9446 commit df62729
Show file tree
Hide file tree
Showing 100 changed files with 58,588 additions and 271,107 deletions.
6 changes: 6 additions & 0 deletions .ci.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated files
CHANGELOG.md
package-lock.json

# Prettier run at the package level.
packages/
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
/lib
/packages/angular/dist
/packages/cli-e2e/ui-packages
/packages
41 changes: 2 additions & 39 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,41 +1,4 @@
{
"ignorePatterns": ["node_modules"],
"env": {
"jest": true
},
"extends": ["prettier"],
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["./node_modules/gts"],
"parserOptions": {
"jsxPragma": "h"
},
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{"ignoreRestSiblings": true, "argsIgnorePattern": "^_"}
],
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/prefer-for-of": "error"
}
},
{
"files": ["**/*.js", "**/*.jsx"],
"extends": ["eslint:recommended"],
"rules": {
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
},
"env": {
"node": true
}
}
],
"root": true
"extends": "./base.eslintrc",
"ignorePatterns": ["node_modules", "packages"]
}
2 changes: 1 addition & 1 deletion .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup
run: npm run setup
- name: Get tag
run: node ./scripts/get-tag.js
run: node ./scripts/get-tag.js # ToDo (PRE_NX): replace by some jq magic
- name: Create install kits
working-directory: ./packages/cli
run: ./node_modules/@oclif/dev-cli/bin/run pack${{ matrix.pack-command }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
# ID of the organization to log into for the e2e tests
ORG_ID: ${{ secrets.ORG_ID }}
COVEO_DISABLE_AUTOUPDATE: true
UI_TEMPLATE_VERSION: '0.0.0'
steps:
- name: Setup runner
if: ${{matrix.os == 'ubuntu-latest'}}
Expand All @@ -41,7 +40,7 @@ jobs:
with:
node-version: ${{matrix.node}}
- name: Setup repo
run: npm run setup
run: npm install
- name: Check linting
run: npm run lint
- name: Tests
Expand Down
33 changes: 5 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ jobs:
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
with:
# pulls all commits (needed for lerna to correctly version)
# see https://stackoverflow.com/a/60184319/9285308 & https://github.com/actions/checkout
# pulls all commits (needed for computing the next version)
fetch-depth: 0
# pulls all tags (needed for lerna to correctly version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # see https://stackoverflow.com/a/60184319/9285308
# pulls all tags (needed for computing the next version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*``
- uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # renovate: tag=v2
with:
node-version: '16'
Expand Down Expand Up @@ -54,27 +53,5 @@ jobs:
echo -n ~ >> ~/.ssh/config
echo "/.ssh/id_rsa" >> ~/.ssh/config
git remote set-url origin git@coveo-cli:coveo/cli.git
- run: node_modules/.bin/lerna changed
if: ${{ github.event.inputs.version == ''}}
- name: Manually bump version
if: ${{ github.event.inputs.version != ''}}
run: node_modules/.bin/lerna publish ${{ github.event.inputs.version }} ---conventional-commits --force-publish -y --no-push --no-git-tag-version --no-git-reset --no-verify-access
- name: Semantically bump version
if: ${{ github.event.inputs.version == ''}}
run: node_modules/.bin/lerna publish ---conventional-commits -y --no-push --no-git-tag-version --no-git-reset --no-verify-access
- name: Wait for NPM cache to be updated
run: node ./scripts/wait-for-packages.js
- name: Normalize package.json and package-lock.json files
run: |
npm run npm:pkglock
npm run npm:cleanPackage
- name: Get the version
run: node ./scripts/get-version.js
- name: Commit changes, tag and push
run: |
echo -e "[Version bump] chore(release): publish v${{ env.tag }}\nlerna.json\nCHANGELOG.md\n**/CHANGELOG.md\n**/README.md" | git commit --all --file -
git tag "v${{ env.tag }}"
git push
git push --tags
- name: Create GitHub release.
run: npm run release:changelog
- name: Release
run: npm run release
5 changes: 5 additions & 0 deletions .github/workflows/snyk-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
- uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # renovate: tag=v2
- name: Prepare snyk
run: |
npm i
npm run snyk:prepare
- name: Snyk test
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ artifacts

ui-projects

!.vscode/extensions.json
!.vscode/extensions.json
topology.json
7 changes: 0 additions & 7 deletions .prettierignore

This file was deleted.

41 changes: 41 additions & 0 deletions base.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"ignorePatterns": ["node_modules"],
"env": {
"jest": true
},
"extends": ["prettier"],
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["./node_modules/gts"],
"parserOptions": {
"jsxPragma": "h"
},
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{"ignoreRestSiblings": true, "argsIgnorePattern": "^_"}
],
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/prefer-for-of": "error"
}
},
{
"files": ["**/*.js", "**/*.jsx"],
"extends": ["eslint:recommended"],
"rules": {
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
},
"env": {
"node": true
}
}
],
"root": true
}
9 changes: 0 additions & 9 deletions lerna.json

This file was deleted.

18 changes: 18 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "@nrwl/workspace/presets/core.json",
"npmScope": "cli-tools",
"affected": {
"defaultBase": "master"
},
"cli": {
"defaultCollection": "@nrwl/workspace"
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
}
}
Loading

0 comments on commit df62729

Please sign in to comment.