Skip to content

Commit

Permalink
feat: add support to nx 17 (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
dianjuar committed Nov 9, 2023
1 parent c7b0c5d commit 367362b
Show file tree
Hide file tree
Showing 19 changed files with 552 additions and 396 deletions.
2 changes: 1 addition & 1 deletion .github/actions/migrate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ runs:
- name: Migrate
shell: bash
run: |
npx nx migrate {nx-version}
npx nx migrate ${{ inputs.nx-version }}
npm install --force --ignore-scripts
npx nx migrate --run-migrations --if-exists
14 changes: 14 additions & 0 deletions .github/workflows/backwards-compatibility-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Backwards Compatibility Test
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # daily at 00:00

jobs:
integration-test:
strategy:
matrix:
nx-version: [latest, '16.10.0']
uses: ./.github/workflows/integration-test.yml
with:
nx-version: ${{matrix.nx-version}}
6 changes: 0 additions & 6 deletions .github/workflows/basic-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- name: Lint
Expand All @@ -36,8 +34,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- run: npx nx build
Expand All @@ -55,8 +51,6 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- run: npx nx test --code-coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
pr-e2e-test:
uses: ./.github/workflows/e2e-test.yml

pr-integration-test:
uses: ./.github/workflows/integration-test.yml
pr-plugin-integration-test:
uses: ./.github/workflows/integration-test-plugins.yml

check-commit-lint:
name: Check commit message follows guidelines
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- run: npx nx e2e ngx-deploy-npm-e2e
13 changes: 13 additions & 0 deletions .github/workflows/integration-test-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Integration Test (Official Plugins)

on: workflow_call

jobs:
plugins-integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup

- name: Plugins Integration Test
run: npx nx integration ngx-deploy-npm-e2e
12 changes: 8 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: Integration Test

on: workflow_call
on:
workflow_call:
inputs:
nx-version:
type: string
description: The Nx Workspace version to run the integration test
required: true

jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- name: Integration Test
run: npx nx integration ngx-deploy-npm-e2e
run: npx nx create-nx-workspace -- ${{ inputs.nx-version }}
2 changes: 1 addition & 1 deletion .github/workflows/publishment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

integration-test:
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
uses: ./.github/workflows/integration-test.yml
uses: ./.github/workflows/integration-test-plugins.yml

angular-e2e-test:
needs: test
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ testem.log
Thumbs.db

reports/*
.nx/cache

# Created by https://www.toptal.com/developers/gitignore/api/sonarqube
# Edit at https://www.toptal.com/developers/gitignore?templates=sonarqube
Expand All @@ -56,4 +57,4 @@ reports/*
# SonarLint working directories, configuration files (including credentials)
.sonarlint/

# End of https://www.toptal.com/developers/gitignore/api/sonarqube
# End of https://www.toptal.com/developers/gitignore/api/sonarqube
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
- [`--otp`](#--otp)
- [`--dry-run`](#--dry-run)
- [`--dist-folder-path`](#--dist-folder-path)
- [Compatibility overview with Nx](#compatibility-overview-with-nx)
- [📁 Configuration File](#configuration-file)
- [🧐 Essential considerations](#essential-considerations)
- [Version Generation](#version-generation)
Expand Down Expand Up @@ -305,6 +306,13 @@ Indicate a custom dist folder path.
The path must relative to project's root.
Especially useful when ngx-deploy-npm can not detect your library dist folder path automatically. [Write us an issue](https://github.com/bikecoders/ngx-deploy-npm/issues/new) if you think we should support the library you are trying to publish

## Compatibility overview with Nx

| Version | Nx Workspace Version |
| ------- | ---------------------- |
| v7.1.0 | `^16.0.0 \|\| ^17.0.0` |
| v7.0.1 | `^16.0.0` |

## 📁 Configuration File <a name="configuration-file"></a>

To avoid all these command-line cmd options, you can write down your
Expand Down
2 changes: 1 addition & 1 deletion e2e/ngx-deploy-npm-e2e/tests/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('build', () => {
initNgxDeployNPMProject();
installDependencies(nxPlugin);

generateLib(nxPlugin, publishableLib, `--dir="libs/${publishableLib}"`);
generateLib(nxPlugin, publishableLib, `--dir="libs"`);

// Install the project
installNgxDeployNPMProject();
Expand Down
8 changes: 4 additions & 4 deletions e2e/ngx-deploy-npm-e2e/tests/install-ng-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('install/ng-add', () => {
installDependencies('@nx/node');

// Init libs and projects
generateLib('@nx/node', publicLib, `--dir="libs/${publicLib}"`);
generateLib('@nx/node', publicLib2, `--dir="libs/${publicLib2}"`);
generateLib('@nx/node', restrictedLib, `--dir="libs/${restrictedLib}"`);
generateLib('@nx/node', libNOTset, `--dir="libs/${libNOTset}"`);
generateLib('@nx/node', publicLib, `--dir="libs"`);
generateLib('@nx/node', publicLib2, `--dir="libs"`);
generateLib('@nx/node', restrictedLib, `--dir="libs"`);
generateLib('@nx/node', libNOTset, `--dir="libs"`);

installNgxDeployNPMProject(`--projects ${publicLib},${publicLib2}`);

Expand Down
20 changes: 10 additions & 10 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"npmScope": "bikecoders",
"affected": {
"defaultBase": "main"
},
"tasksRunnerOptions": {
"default": {
"runner": "@nx/workspace/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
"options": {}
}
},
"targetDependencies": {
Expand All @@ -23,9 +20,6 @@
"appsDir": "e2e",
"libsDir": "packages"
},
"cli": {
"defaultCollection": "@nx/node"
},
"defaultProject": "ngx-deploy-npm",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
Expand All @@ -41,13 +35,19 @@
},
"targetDefaults": {
"build": {
"inputs": ["production", "^production"]
"inputs": ["production", "^production"],
"cache": true
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"e2e": {
"cache": true
}
}
}

0 comments on commit 367362b

Please sign in to comment.