-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from scalprum/adopt-nx
[WIP] Adopt NX to manage the monorepo packages
- Loading branch information
Showing
150 changed files
with
25,616 additions
and
31,664 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"], | ||
"rules": { | ||
"body-max-line-length": [0] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
/**/node_modules | ||
/**/dist | ||
/**/coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,53 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"modules": true, | ||
"experimentalObjectRestSpread": true | ||
} | ||
}, | ||
"settings": { | ||
"import/resolver": { "typescript": {} } | ||
}, | ||
"plugins": ["prettier"], | ||
"root": true, | ||
"ignorePatterns": ["**/*"], | ||
"plugins": ["@nx", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
"plugin:prettier/recommended" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": "*.json", | ||
"parser": "jsonc-eslint-parser", | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"extends": ["plugin:@nx/typescript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": ["plugin:@nx/javascript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], | ||
"env": { | ||
"jest": true | ||
}, | ||
"rules": {} | ||
} | ||
], | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/ban-types": "off", | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "after-used", "argsIgnorePattern": "^_", "ignoreRestSiblings": false }] | ||
"@nx/dependency-checks": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Cypress runner cache | ||
description: Retrieve and cache the cypress runner | ||
runs: | ||
using: "composite" | ||
steps: | ||
# cache cypress runner | ||
- uses: actions/cache@v3 | ||
id: cypress-cache | ||
with: | ||
path: /home/runner/.cache/Cypress | ||
key: cypress-runner-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Lint project | ||
description: verify linting rules | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: nrwl/nx-set-shas@v3 | ||
- uses: './.github/actions/node-cache' | ||
- name: Install deps | ||
shell: bash | ||
run: npm i | ||
- name: Lint affected | ||
shell: bash | ||
run: npx nx affected -t lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Node modules cache | ||
description: Retrieve and cache project node_modules | ||
runs: | ||
using: "composite" | ||
steps: | ||
# cache node modules for all jobs to use | ||
- uses: actions/cache@v3 | ||
id: node_modules-cache | ||
with: | ||
path: | | ||
**/node_modules | ||
key: install-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release job | ||
description: build affected packages and publish them to npm | ||
inputs: | ||
npm_token: | ||
description: 'NPM token' | ||
required: true | ||
gh_token: | ||
description: 'Github token' | ||
required: true | ||
gh_actor: | ||
description: 'Github actor' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
- uses: './.github/actions/node-cache' | ||
- name: Install deps | ||
shell: bash | ||
run: npm i | ||
- name: git config | ||
shell: bash | ||
run: | | ||
git config user.name "${{ inputs.gh_actor }}" | ||
git config user.email "${{ inputs.gh_actor }}@users.noreply.github.com" | ||
- name: Build | ||
shell: bash | ||
run: npx nx run-many -t build | ||
- name: Set publish config | ||
env: | ||
NPM_TOKEN: ${{ inputs.npm_token }} | ||
shell: bash | ||
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | ||
- name: Version | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ inputs.gh_token }} | ||
GITHUB_TOKEN: ${{ inputs.gh_token }} | ||
run: npx nx affected --base=last-release --parallel=1 --target=version --postTargets=syncDependencies,npm,github --trackDeps | ||
- name: Tag last-release | ||
shell: bash | ||
run: | | ||
git tag -f last-release | ||
git push origin last-release --force | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: E2E tests | ||
description: verify e2e tests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: nrwl/nx-set-shas@v3 | ||
- uses: './.github/actions/node-cache' | ||
- uses: './.github/actions/cypress-cache' | ||
- uses: './.github/actions/webpack-cache' | ||
- name: Install deps | ||
shell: bash | ||
run: npm i | ||
- name: Run e2e tests | ||
shell: bash | ||
run: npx nx run test-app-e2e:e2e --ci | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Unit tests | ||
description: verify unit tests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: nrwl/nx-set-shas@v3 | ||
- uses: './.github/actions/node-cache' | ||
- name: Install deps | ||
shell: bash | ||
run: npm i | ||
- name: Test affected | ||
shell: bash | ||
run: npx nx affected -t test --configuration=ci | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Webpack dev server cache | ||
description: Cache for e2e test runs | ||
runs: | ||
using: "composite" | ||
steps: | ||
# cache node modules for all jobs to use | ||
- uses: actions/cache@v3 | ||
id: webpack-cache | ||
with: | ||
path: | | ||
**/.webpack-cache | ||
key: webpack-cache-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: nrwl/nx-set-shas@v3 | ||
# cache node modules for all jobs to use | ||
- uses: './.github/actions/node-cache' | ||
# cache cypress runner | ||
- uses: './.github/actions/cypress-cache' | ||
- name: Install deps | ||
run: npm ci | ||
lint: | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: './.github/actions/lint' | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: [install] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: './.github/actions/test-unit' | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: [install] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: nrwl/nx-set-shas@v3 | ||
- uses: './.github/actions/node-cache' | ||
- name: Install deps | ||
run: npm i | ||
- name: Build affected | ||
run: npx nx affected -t build | ||
test-e2e: | ||
runs-on: ubuntu-latest | ||
needs: [install, build] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: './.github/actions/test-e2e' | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [install, lint, test, build, test-e2e] | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: './.github/actions/release' | ||
with: | ||
gh_token: ${{ secrets.GITHUB_TOKEN }} | ||
npm_token: ${{ secrets.NPM_TOKEN }} | ||
gh_actor: ${GITHUB_ACTOR} |
Oops, something went wrong.