Skip to content

Commit afa228c

Browse files
authored
feat: remove internal build process (#571)
Deprecate the built-in build process in favor of `dependsOn` Nx feature. Add support for libraries that doesn't require build process. BREAKING CHANGE: - `ngx-deploy-npm:install`: Added `--dist-folder-path` option as required. - `ngx-deploy-npm:install`: Drop the option `--projects`, now, each project needs to be specified independently using `--project`. - `ngx-deploy-npm:deploy`: `distFolderPath` option is now required. - `ngx-deploy-npm:deploy`: Remove options `noBuild` and `buildTarget`.
1 parent af95f44 commit afa228c

File tree

81 files changed

+4402
-2856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4402
-2856
lines changed

.eslintrc.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
"ignorePatterns": ["**/*"],
44
"plugins": ["@nx"],
55
"overrides": [
6-
{
7-
"files": ["package.json"],
8-
"parser": "jsonc-eslint-parser",
9-
"rules": {
10-
"@nx/dependency-checks": "error"
11-
}
12-
},
136
{
147
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
158
"rules": {

.github/workflows/backwards-compatibility-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- cron: '0 0 * * *' # daily at 00:00
66

77
jobs:
8-
integration-test:
8+
backwards-compatibility-test:
99
strategy:
1010
matrix:
1111
nx-version: [latest, '16.10.0']

.github/workflows/basic-test.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
name: Essential Test
22

3-
on:
4-
workflow_call:
5-
inputs:
6-
# Enable reports on workflow (lint and coverage)
7-
reports:
8-
type: boolean
9-
default: true
10-
required: false
3+
on: workflow_call
114

125
jobs:
136
lint:
@@ -17,14 +10,12 @@ jobs:
1710
- uses: ./.github/actions/setup
1811

1912
- name: Lint
20-
run: npx nx lint --outputFile=""
13+
run: npx nx lint ngx-deploy-npm
2114

22-
- if: inputs.reports == true
23-
name: Lint report
24-
run: npx nx lint --format=./tools/sonarqube-linter-reporter.js
15+
- name: Lint report
16+
run: npx nx lint-report ngx-deploy-npm
2517

26-
- if: inputs.reports == true
27-
name: Archive lint report results
18+
- name: Archive lint report results
2819
uses: actions/upload-artifact@v3
2920
with:
3021
name: lint-report-${{ github.sha }}
@@ -36,7 +27,7 @@ jobs:
3627
- uses: actions/checkout@v3
3728
- uses: ./.github/actions/setup
3829

39-
- run: npx nx build
30+
- run: npx nx build ngx-deploy-npm
4031

4132
- name: Archive build result
4233
uses: actions/upload-artifact@v3
@@ -53,9 +44,10 @@ jobs:
5344
- uses: actions/checkout@v3
5445
- uses: ./.github/actions/setup
5546

56-
- run: npx nx test --configuration="ci"
47+
- run: npx nx test ngx-deploy-npm --configuration="ci"
5748

58-
- name: Archive coverage report
49+
- if: ${{ matrix.os == 'ubuntu-latest' }}
50+
name: Archive coverage report
5951
uses: actions/upload-artifact@v3
6052
with:
6153
name: ngx-deploy-npm-coverage-report-${{ github.sha }}

.github/workflows/integration-test.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
nx-version:
77
type: string
88
description: The Nx Workspace version to run the integration test
9-
required: true
9+
required: false
1010

1111
jobs:
1212
integration-test:
@@ -15,5 +15,17 @@ jobs:
1515
- uses: actions/checkout@v3
1616
- uses: ./.github/actions/setup
1717

18+
- name: Read package.json Nx and set default parameter
19+
id: set-default-param
20+
run: |
21+
version=$(jq -r '.devDependencies.nx'package.json)
22+
if [ -z "${{ github.event.inputs.nx-version }}" ]; then
23+
echo "Setting default value for nx-version parameter: $version"
24+
echo "NX_VERSION=$version" >> $GITHUB_ENV
25+
else
26+
echo "Using provided value for nx-version parameter: ${{ github.event.inputs.nx-version }}"
27+
echo "NX_VERSION=${{ github.event.inputs.nx-version }}" >> $GITHUB_ENV
28+
fi
29+
1830
- name: Integration Test
19-
run: npx nx create-nx-workspace -- ${{ inputs.nx-version }}
31+
run: npx nx create-nx-workspace ngx-deploy-npm -- $NX_VERSION

.github/workflows/ci.yml renamed to .github/workflows/pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: Check if Prettier was run
3737
run: npx pretty-quick --check
3838

39+
automated-manual-test:
40+
uses: ./.github/workflows/integration-test.yml
41+
3942
pr-analysis:
4043
name: SonarCloud Pr Analysis
4144
runs-on: ubuntu-latest

.github/workflows/publishment.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
1818
uses: ./.github/workflows/integration-test-plugins.yml
1919

20+
automated-manual-test:
21+
uses: ./.github/workflows/integration-test.yml
22+
2023
analysis:
2124
name: SonarCloud Main Analysis
2225
runs-on: ubuntu-latest
@@ -43,12 +46,12 @@ jobs:
4346
- uses: ./.github/actions/setup
4447

4548
- name: Preliminar Version
46-
run: npx nx version --dry-run
49+
run: npx nx version ngx-deploy-npm --dry-run
4750

4851
release:
4952
environment: production
5053
runs-on: ubuntu-latest
51-
needs: [release-preliminar, e2e-test, test]
54+
needs: [release-preliminar, e2e-test, test, automated-manual-test]
5255
steps:
5356
- uses: actions/checkout@v3
5457
- uses: ./.github/actions/setup
@@ -70,7 +73,7 @@ jobs:
7073
# which is set up by `setup-node` action.
7174

7275
- name: Version and Publishment
73-
run: npx nx version
76+
run: npx nx version ngx-deploy-npm
7477
env:
7578
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7679

.github/workflows/test-nx-next.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
nx-version: 'next'
1616
- name: Lint
17-
run: npx nx lint
17+
run: npx nx lint ngx-deploy-npm
1818

1919
build-next:
2020
runs-on: ubuntu-latest
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
nx-version: 'next'
2727
- name: Build
28-
run: npx nx build
28+
run: npx nx build ngx-deploy-npm
2929

3030
test-next:
3131
runs-on: ubuntu-latest
@@ -36,7 +36,7 @@ jobs:
3636
with:
3737
nx-version: 'next'
3838
- name: Test
39-
run: npx nx test
39+
run: npx nx test ngx-deploy-npm
4040

4141
e2e-next:
4242
runs-on: ubuntu-latest

.verdaccio/config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# path to a directory with all packages
2+
storage: ../tmp/local-registry/storage
3+
4+
# a list of other known repositories we can talk to
5+
uplinks:
6+
npmjs:
7+
url: https://registry.npmjs.org/
8+
maxage: 60m
9+
10+
packages:
11+
'**':
12+
# give all users (including non-authenticated users) full access
13+
# because it is a local registry
14+
access: $all
15+
publish: $all
16+
unpublish: $all
17+
18+
# if package is not available locally, proxy requests to npm registry
19+
proxy: npmjs
20+
21+
# log settings
22+
logs:
23+
type: stdout
24+
format: pretty
25+
level: warn
26+
27+
publish:
28+
allow_offline: true # set offline to true to allow publish offline

README.md

Lines changed: 21 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# ngx-deploy-npm 🚀 <!-- omit in toc -->
22

3-
<!-- [![Nx supported versions][supported-nx-versions]][nx-url] -->
4-
53
[![NPM version][npm-image]][npm-url]
64
[![NPM donwoads][downloads-image]][npm-url]
75
[![The MIT License][mit-licence-image]][mit-licence-url]
@@ -18,17 +16,6 @@
1816
[![Publishment Status][publishment-image]][publishment-link]
1917
[![Test nx@next][next-tests-image]][next-tests-link]
2018

21-
## Supported Library Generators
22-
23-
[![Angular][angular-image]][angular-link]
24-
[![NestJS][nest-js-image]][nest-js-link]
25-
[![Next JS][next-js-image]][next-js-link]
26-
[![Node][node-image]][node-link]
27-
[![JS][js-image]][js-link]
28-
[![Nx Plugin][nx-image]][nx-plugin-link]
29-
[![React][react-image]][react-link]
30-
[![React Native][react-native-image]][react-native-link]
31-
3219
<!-- Images -->
3320

3421
[sonar-reliability-image]: https://sonarcloud.io/api/project_badges/measure?project=bikecoders_ngx-deploy-npm&metric=reliability_rating
@@ -45,17 +32,6 @@
4532
[macos-image]: https://img.shields.io/badge/mac%20os-000000?style=flat&logo=macos&logoColor=F0F0F0
4633
[windows-image]: https://img.shields.io/badge/Windows-0078D6?style=flat&logo=windows&logoColor=white
4734

48-
<!-- Projects -->
49-
50-
[angular-image]: https://img.shields.io/badge/angular-%23DD0031.svg?style=flat&logo=angular&logoColor=white
51-
[nest-js-image]: https://img.shields.io/badge/nestjs-%23E0234E.svg?style=flat&logo=nestjs&logoColor=white
52-
[next-js-image]: https://img.shields.io/badge/Next-black?style=flat&logo=next.js&logoColor=white
53-
[node-image]: https://img.shields.io/badge/node.js-6DA55F?style=flat&logo=node.js&logoColor=white
54-
[js-image]: https://img.shields.io/badge/javascript-%23323330.svg?style=flat&logo=javascript&logoColor=%23F7DF1E
55-
[nx-image]: https://img.shields.io/badge/nx-143055?style=flat&logo=nx&logoColor=white
56-
[react-image]: https://img.shields.io/badge/react-%2320232a.svg?style=flat&logo=react&logoColor=%2361DAFB
57-
[react-native-image]: https://img.shields.io/badge/react_native-%2320232a.svg?style=flat&logo=react&logoColor=%2361DAFB
58-
5935
<!-- URLs -->
6036

6137
[sonar-link]: https://sonarcloud.io/summary/new_code?id=bikecoders_ngx-deploy-npm
@@ -64,18 +40,6 @@
6440
[mit-licence-url]: http://opensource.org/licenses/MIT
6541
[conventional-commits-url]: https://conventionalcommits.org
6642
[next-tests-link]: https://github.com/bikecoders/ngx-deploy-npm/actions/workflows/test-nx-next.yml
67-
[nx-url]: https://nx.dev/
68-
69-
<!-- Projects -->
70-
71-
[angular-link]: https://nx.dev/packages/angular
72-
[nest-js-link]: https://nx.dev/packages/nest
73-
[next-js-link]: https://nx.dev/packages/next
74-
[node-link]: https://nx.dev/packages/node
75-
[js-link]: https://nx.dev/packages/js
76-
[nx-plugin-link]: https://nx.dev/packages/nx-plugin
77-
[react-link]: https://nx.dev/packages/react
78-
[react-native-link]: https://nx.dev/packages/react-native
7943

8044
![Cover Image](docs/cover.png)
8145

@@ -85,14 +49,12 @@
8549

8650
- [🚀 Quick Start (local development)](#quick-start-local-development)
8751
- [🚀 Continuous Delivery](#continuous-delivery)
88-
- [❓What is done when executing `nx deploy`](#what-is-done-when-executing-nx-deploy)
8952
- [📦 Options](#options)
9053
- [install](#install)
91-
- [`--projects`](#--projects)
54+
- [`--dist-folder-path`](#--dist-folder-path-install)
55+
- [`--project`](#--project)
9256
- [`--access`](#--access-install)
9357
- [deploy](#deploy)
94-
- [`--build-target`](#--build-target)
95-
- [`--no-build`](#--no-build)
9658
- [`--package-version`](#--package-version)
9759
- [`--tag`](#--tag)
9860
- [`--access`](#--access)
@@ -173,63 +135,45 @@ jobs:
173135

174136
> You can check the steps suggested in the [CircleCI's guide](https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/)
175137
176-
## ❓What is done when executing `nx deploy` <a name="what-is-done-when-executing-nx-deploy"></a>
177-
178-
1. Will build the application using the target `build`
179-
- This will be omitted if the parameter `--no-build` is set
180-
2. Execute `npm publish`
138+
## 📦 Options <a name="options"></a>
181139
182-
The following is the activity diagram.
140+
### install
183141
184-
![Execution activity diagram](docs/UML/principal-activity-diagram.jpg)
142+
#### `--dist-folder-path` <a name="--dist-folder-path-install"></a>
185143
186-
## 📦 Options <a name="options"></a>
144+
- **required**
145+
- Example:
146+
- `nx generate ngx-deploy-npm:install --project=lib-1 --dist-folder-path="dist/libs/lib-1"`
187147
188-
### install
148+
Indicates the dist folder path. The path where is located the bundle of your library. The path should be relative to the project's root.
189149

190-
#### `--projects`
150+
#### `--project`
191151

192-
- **optional**
152+
- **required**
193153
- Example:
194-
- `nx generate ngx-deploy-npm:install --projects=lib-1,lib-2` – Only `lib-1` and `lib-2` are going to configure
154+
- `nx generate ngx-deploy-npm:install --project=lib-1 --dist-folder-path="dist/libs/lib-1"``lib-1` will be configured. It will create the target deploy with the default options on the project `lib-1`.
195155

196-
Specify which libraries should be configured. Useful when you have a workspace with several libraries and don't want to overwrite existing configuration
197-
Should be `,` separated, without spaces.
156+
Specify which library should be configured.
198157

199158
#### `--access` <a name="--access-install"></a>
200159

201160
- **optional**
202161
- Default: `public`
203162
- Example:
204-
- `nx generate ngx-deploy-npm:install --access=restricted`
163+
- `nx generate ngx-deploy-npm:install --access=restricted --project=lib-1 --dist-folder-path="dist/libs/lib-1"`
205164

206165
Tells the registry whether to publish the package as public or restricted. It only applies to scoped packages, which default to restricted. If you don't have a paid account, you must publish with --access public to publish scoped packages.
207166
208167
### deploy
209168
210-
#### `--build-target`
211-
212-
- **optional**
213-
- Example:
214-
- `nx deploy --build-target=production` – The configuration `production` is being used to build your package
215-
216-
The `buildTarget` points to an existing target configuration on your project,
217-
as specified in the `configurations` section of `workspace.json`.
218-
219-
This option is equivalent to calling the command `nx build --configuration=XXX`.
220-
This command has no effect if the option `--no-build` option is active.
221-
222-
#### `--no-build`
169+
#### `--dist-folder-path`
223170
224-
- **optional**
225-
- Default: `false` (string)
171+
- **required**
226172
- Example:
227-
- `nx deploy` – The library is built in production mode before the deployment
228-
- `nx deploy --no-build` – The library is NOT built, but the deployment process is being made
173+
- `nx deploy --dist-folder-path='dist/libs/my-project'`
229174
230-
Skip build process during deployment.
231-
This option is useful when the building process is handled by something else.
232-
This command causes the `--build-target` setting to have no effect.
175+
Indicate the dist folder path.
176+
The path must relative to project's root.
233177

234178
#### `--package-version`
235179

@@ -281,20 +225,11 @@ Configure npm to use any compatible registry you like, and even run your own reg
281225

282226
For testing: Run through without making any changes. Execute with `--dry-run`, and nothing will happen. It will show a list of the options used on the console.
283227

284-
#### `--dist-folder-path`
285-
286-
- **optional**
287-
- Example:
288-
- `nx deploy --dist-folder-path 'dist/my-unsupported-project'`
289-
290-
Indicate a custom dist folder path.
291-
The path must relative to project's root.
292-
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
293-
294228
## Compatibility overview with Nx
295229

296230
| Version | Nx Workspace Version |
297231
| ------- | ---------------------- |
232+
| v8.0.0 | `^16.0.0 \|\| ^17.0.0` |
298233
| v7.1.0 | `^16.0.0 \|\| ^17.0.0` |
299234
| v7.0.1 | `^16.0.0` |
300235

@@ -344,7 +279,7 @@ We use `@jscutlery/semver` here on `ngx-deploy-npm` to generate the package's ne
344279
345280
### Only publishable libraries are being configured <!-- omit in toc -->
346281
347-
For an Nx workspace, only publishable libraries are going to be configured.
282+
Only publishable libraries are going to be configured.
348283
349284
## 🎉 Do you Want to Contribute? <a name="do-you-want-to-contribute"></a>
350285

0 commit comments

Comments
 (0)