Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove internal build process #527

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backwards-compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- cron: '0 0 * * *' # daily at 00:00

jobs:
integration-test:
backwards-compatibility-test:
strategy:
matrix:
nx-version: [latest, '16.10.0']
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/basic-test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Essential Test

on:
workflow_call:
inputs:
# Enable reports on workflow (lint and coverage)
reports:
type: boolean
default: true
required: false
on: workflow_call

jobs:
lint:
Expand All @@ -17,14 +10,12 @@ jobs:
- uses: ./.github/actions/setup

- name: Lint
run: npx nx lint --outputFile=""
run: npx nx lint ngx-deploy-npm

- if: inputs.reports == true
name: Lint report
run: npx nx lint --format=./tools/sonarqube-linter-reporter.js
- name: Lint report
run: npx nx lint-report ngx-deploy-npm

- if: inputs.reports == true
name: Archive lint report results
- name: Archive lint report results
uses: actions/upload-artifact@v3
with:
name: lint-report-${{ github.sha }}
Expand All @@ -36,7 +27,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup

- run: npx nx build
- run: npx nx build ngx-deploy-npm

- name: Archive build result
uses: actions/upload-artifact@v3
Expand All @@ -53,9 +44,10 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup

- run: npx nx test --configuration="ci"
- run: npx nx test ngx-deploy-npm --configuration="ci"

- name: Archive coverage report
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Archive coverage report
uses: actions/upload-artifact@v3
with:
name: ngx-deploy-npm-coverage-report-${{ github.sha }}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
nx-version:
type: string
description: The Nx Workspace version to run the integration test
required: true
required: false

jobs:
integration-test:
Expand All @@ -15,5 +15,17 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup

- name: Read package.json Nx and set default parameter
id: set-default-param
run: |
version=$(jq -r '.devDependencies.nx'package.json)
if [ -z "${{ github.event.inputs.nx-version }}" ]; then
echo "Setting default value for nx-version parameter: $version"
echo "NX_VERSION=$version" >> $GITHUB_ENV
else
echo "Using provided value for nx-version parameter: ${{ github.event.inputs.nx-version }}"
echo "NX_VERSION=${{ github.event.inputs.nx-version }}" >> $GITHUB_ENV
fi

- name: Integration Test
run: npx nx create-nx-workspace -- ${{ inputs.nx-version }}
run: npx nx create-nx-workspace ngx-deploy-npm -- $NX_VERSION
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Check if Prettier was run
run: npx pretty-quick --check

automated-manual-test:
uses: ./.github/workflows/integration-test.yml

pr-analysis:
name: SonarCloud Pr Analysis
runs-on: ubuntu-latest
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/publishment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
uses: ./.github/workflows/integration-test-plugins.yml

automated-manual-test:
uses: ./.github/workflows/integration-test.yml

analysis:
name: SonarCloud Main Analysis
runs-on: ubuntu-latest
Expand All @@ -43,12 +46,12 @@ jobs:
- uses: ./.github/actions/setup

- name: Preliminar Version
run: npx nx version --dry-run
run: npx nx version ngx-deploy-npm --dry-run

release:
environment: production
runs-on: ubuntu-latest
needs: [release-preliminar, e2e-test, test]
needs: [release-preliminar, e2e-test, test, automated-manual-test]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
Expand All @@ -70,7 +73,7 @@ jobs:
# which is set up by `setup-node` action.

- name: Version and Publishment
run: npx nx version
run: npx nx version ngx-deploy-npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-nx-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
nx-version: 'next'
- name: Lint
run: npx nx lint
run: npx nx lint ngx-deploy-npm

build-next:
runs-on: ubuntu-latest
Expand All @@ -25,7 +25,7 @@ jobs:
with:
nx-version: 'next'
- name: Build
run: npx nx build
run: npx nx build ngx-deploy-npm

test-next:
runs-on: ubuntu-latest
Expand All @@ -36,7 +36,7 @@ jobs:
with:
nx-version: 'next'
- name: Test
run: npx nx test
run: npx nx test ngx-deploy-npm

e2e-next:
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage

# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
logs:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
69 changes: 20 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@

- [🚀 Quick Start (local development)](#quick-start-local-development)
- [🚀 Continuous Delivery](#continuous-delivery)
- [❓What is done when executing `nx deploy`](#what-is-done-when-executing-nx-deploy)
- [📦 Options](#options)
- [install](#install)
- [`--projects`](#--projects)
- [`--dist-folder-path`](#--dist-folder-path-install)
- [`--project`](#--project)
- [`--access`](#--access-install)
- [deploy](#deploy)
- [`--build-target`](#--build-target)
- [`--no-build`](#--no-build)
- [`--package-version`](#--package-version)
- [`--tag`](#--tag)
- [`--access`](#--access)
Expand Down Expand Up @@ -173,63 +171,45 @@ jobs:

> You can check the steps suggested in the [CircleCI's guide](https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/)

## ❓What is done when executing `nx deploy` <a name="what-is-done-when-executing-nx-deploy"></a>

1. Will build the application using the target `build`
- This will be omitted if the parameter `--no-build` is set
2. Execute `npm publish`
## 📦 Options <a name="options"></a>

The following is the activity diagram.
### install

![Execution activity diagram](docs/UML/principal-activity-diagram.jpg)
#### `--dist-folder-path` <a name="--dist-folder-path-install"></a>

## 📦 Options <a name="options"></a>
- **required**
- Example:
- `nx generate ngx-deploy-npm:install --project=lib-1 --dist-folder-path="dist/libs/lib-1"`

### install
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.

#### `--projects`
#### `--project`

- **optional**
- **required**
- Example:
- `nx generate ngx-deploy-npm:install --projects=lib-1,lib-2` – Only `lib-1` and `lib-2` are going to configure
- `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`.

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

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

- **optional**
- Default: `public`
- Example:
- `nx generate ngx-deploy-npm:install --access=restricted`
- `nx generate ngx-deploy-npm:install --access=restricted --project=lib-1 --dist-folder-path="dist/libs/lib-1"`

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.

### deploy

#### `--build-target`

- **optional**
- Example:
- `nx deploy --build-target=production` – The configuration `production` is being used to build your package

The `buildTarget` points to an existing target configuration on your project,
as specified in the `configurations` section of `workspace.json`.

This option is equivalent to calling the command `nx build --configuration=XXX`.
This command has no effect if the option `--no-build` option is active.

#### `--no-build`
#### `--dist-folder-path`

- **optional**
- Default: `false` (string)
- **required**
- Example:
- `nx deploy` – The library is built in production mode before the deployment
- `nx deploy --no-build` – The library is NOT built, but the deployment process is being made
- `nx deploy --dist-folder-path='dist/libs/my-project'`

Skip build process during deployment.
This option is useful when the building process is handled by something else.
This command causes the `--build-target` setting to have no effect.
Indicate the dist folder path.
The path must relative to project's root.

#### `--package-version`

Expand Down Expand Up @@ -281,20 +261,11 @@ Configure npm to use any compatible registry you like, and even run your own reg

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.

#### `--dist-folder-path`

- **optional**
- Example:
- `nx deploy --dist-folder-path 'dist/my-unsupported-project'`

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 |
| ------- | ---------------------- |
| v8.0.0 | `^16.0.0 \|\| ^17.0.0` |
| v7.1.0 | `^16.0.0 \|\| ^17.0.0` |
| v7.0.1 | `^16.0.0` |

Expand Down
4 changes: 2 additions & 2 deletions docs/README_contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ There are two ways of debugging:

#### Option A), the easy one

> ⚡ **Pre Step:** follow the steps of [yarn link](###angular-workspace) as pre step
> ⚡ **Pre Step:** follow the steps of [yarn link](#angular-workspace) as pre step
>
> ⚠️ Only works on VsCode!

Expand All @@ -77,7 +77,7 @@ On VsCode, create a [_JavaScript Debug Terminal_](https://code.visualstudio.com/

#### Option B), the traditional one

> ⚡ **Pre Step:** follow the steps of [yarn link](###angular-workspace) as pre step
> ⚡ **Pre Step:** follow the steps of [yarn link](#angular-workspace) as pre step

1. Use your favorite [Inspector Client](https://nodejs.org/de/docs/guides/debugging-getting-started/#inspector-clients) to debug

Expand Down
Loading