Skip to content

Commit 302ff23

Browse files
authored
build: add Angular 17 support & update packages (#477)
Hello @santoshyadavdev, This PR fixes #476. What I did: - I couldn't use `yarn` at all this time, I switched to `npm` (even after everything was updated with `npm` and switching back to `yarn`) - I updated all packages to latest versions (except `jasmine-core`) - The nx cache is now located in the root folder of the repo, I added `.nx` in `.gitignore` - There was some problem with how the tsconfigs were done, I fixed all of them (it was causing problems with nx migrations) - I applied the migrations from nx - I migrated `ngu-carousel-example` to use the new control-flow - I did not update the `README.md` - I removed the cypress component testing config from `ngu-carousel-example` as it was more or less useless - I fixed errors found by the linter - I fixed unit tests - I removed `updateBuildableProjectDepsInPackageJson` from `ngu-carousel` as it was deprecated - removing it keeps the same behavior as if it was enable, that's what we want - I added missing `tsconfig.json` (cypress) in the `.eslintrc.json` of `ngu-carousel` - I updated the current SSR setup - I first tried to migrate the new `application` builder, but it was not working properly with modules. ~~I will investigate later if it comes from `nx` or the `Angular CLI`~~ (thanks @JeanMeche for his help) - Could be related to angular/angular#52998 - As said in https://riegler.fr/blog/2023-10-13-v17-builders: - `An interesting point to note is that if either 'ssr' or 'prerender' are set to 'true' in the configuration file, the pages served with 'ng serve' will be generated server side.` - This was not working, that's one of the reason I kept the same setup with `ssr-dev-server` & co. - I already did the migration to `browser-esbuild` when I migrated to `Angular 16`, so it is already using esbuild. - Another reason is that `ng serve` using the ssr is not using `server.ts` (which should not affect this repo, but let's play it safe), track angular/angular-cli#26323 - I cleaned `polyfills` usage - I updated the `CI` setup - Angular supports node starting version `18.13.0`, the CI now runs on `['18.13.0', '20']` - Updated to `actions/checkout@v4` & `actions/setup-node@v4` - Updated to use `npm` - I bumped `ngu-carousel` for `Angular 17` - I bumped `ngu-carousel` to `9.0.0` and I updated `README.md` TODO on your side: - Release a new major version `9.0.0` - Close branches related to package update Tell me if everything looks ok for you. Have a nice day.
1 parent ba7c77e commit 302ff23

Some content is hidden

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

49 files changed

+31657
-15782
lines changed

.github/workflows/nodejs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: ['16', '18']
18+
node-version: ['18.13.0', '20']
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626
- name: Install dependencies
27-
run: yarn
27+
run: npm ci
2828
- name: Build
2929
run: |
30-
yarn nx run-many --target=build --all
30+
npx nx run-many --target=build --all
3131
env:
3232
CI: true

.github/workflows/npm-publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-node@v3
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1919
with:
20-
node-version: 18
21-
- run: yarn
20+
node-version: 18.13.0
21+
- run: npm ci
2222

2323
publish-npm:
2424
needs: build
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v3
28-
- uses: actions/setup-node@v3
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
2929
with:
30-
node-version: 18
30+
node-version: 18.13.0
3131
registry-url: https://registry.npmjs.org/
3232
scope: '@ngu'
3333
- name: Build and Publish
3434
run: |
35-
yarn install
36-
yarn nx run-many --target=build --all
35+
npm ci
36+
npx nx run-many --target=build --all
3737
cd dist/libs/ngu/carousel
3838
npm publish --access=public
3939
shell: bash

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ chrome-profiler-events*.json
3131
.history/*
3232

3333
# misc
34-
/.angular/cache
34+
.angular
3535
/.sass-cache
3636
/connect.lock
3737
/coverage
@@ -41,6 +41,7 @@ yarn-error.log
4141
testem.log
4242
/typings
4343
**/reports
44+
.nx
4445

4546
# System Files
4647
.DS_Store

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
package.json
22
*.yml
3+
4+
/.nx/cache
5+
.angular

README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
[![npm version](https://badge.fury.io/js/%40ngu%2Fcarousel.svg)](https://badge.fury.io/js/%40ngu%2Fcarousel)
66

77
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
8+
89
[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-)
10+
911
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1012

1113
Angular Universal carousel
@@ -22,17 +24,18 @@ Demo available [Here](https://ngu-carousel.netlify.app)
2224

2325
`ngu-carousel` supports touch actions and requires `hammerjs` to be installed before the `ngu-carousel` is installed.
2426

25-
| Angular Version | ngu-carousel Version |
26-
| --------------- | ----------------------------------- |
27-
| Angular >= 16 standalone | `npm i --save @ngu/carousel@latest` |
28-
| Angular >= 16 | `npm i --save @ngu/[email protected]` |
29-
| Angular >= 15 | `npm i --save @ngu/[email protected]` |
30-
| Angular >= 14 | `npm i --save @ngu/[email protected]` |
31-
| Angular >= 13 | `npm i --save @ngu/[email protected]` |
32-
| Angular >= 12 | `npm i --save @ngu/[email protected]` |
33-
| Angular >= 10 | `npm i --save @ngu/[email protected]` |
34-
| Angular = 9 | `npm i --save @ngu/[email protected]` |
35-
| Angular < 9 | `npm i --save @ngu/[email protected]` |
27+
| Angular Version | ngu-carousel Version |
28+
| ------------------------ | -------------------------------------------- |
29+
| Angular >= 17 | `npm i --save @ngu/carousel@carousel@latest` |
30+
| Angular >= 16 standalone | `npm i --save @ngu/[email protected]` |
31+
| Angular >= 16 | `npm i --save @ngu/[email protected]` |
32+
| Angular >= 15 | `npm i --save @ngu/[email protected]` |
33+
| Angular >= 14 | `npm i --save @ngu/[email protected]` |
34+
| Angular >= 13 | `npm i --save @ngu/[email protected]` |
35+
| Angular >= 12 | `npm i --save @ngu/[email protected]` |
36+
| Angular >= 10 | `npm i --save @ngu/[email protected]` |
37+
| Angular = 9 | `npm i --save @ngu/[email protected]` |
38+
| Angular < 9 | `npm i --save @ngu/[email protected]` |
3639

3740
## Usage
3841

@@ -49,13 +52,13 @@ import {
4952

5053
@NgModule({
5154
imports: [
52-
NguCarousel,
53-
NguTileComponent,
54-
NguCarousel,
55-
NguCarouselDefDirective,
56-
NguCarouselNextDirective,
57-
NguCarouselPrevDirective,
58-
NguItemComponent
55+
NguCarousel,
56+
NguTileComponent,
57+
NguCarousel,
58+
NguCarouselDefDirective,
59+
NguCarouselNextDirective,
60+
NguCarouselPrevDirective,
61+
NguItemComponent
5962
]
6063
})
6164
export class AppModule {}
@@ -64,19 +67,17 @@ OR
6467

6568
@Component({
6669
imports: [
67-
NguCarousel,
68-
NguTileComponent,
69-
NguCarousel,
70-
NguCarouselDefDirective,
71-
NguCarouselNextDirective,
72-
NguCarouselPrevDirective,
73-
NguItemComponent
70+
NguCarousel,
71+
NguTileComponent,
72+
NguCarousel,
73+
NguCarouselDefDirective,
74+
NguCarouselNextDirective,
75+
NguCarouselPrevDirective,
76+
NguItemComponent
7477
],
7578
standalone: true
7679
})
7780
export class AppComponent {}
78-
79-
8081
```
8182

8283
2. Then use in your component:

apps/ngu-carousel-e2e/cypress.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
33

44
export default defineConfig({
55
e2e: {
6-
...nxE2EPreset(__dirname),
6+
...nxE2EPreset(__dirname, {
7+
devServerTargets: {
8+
default: 'ngu-carousel-example:serve:development',
9+
production: 'ngu-carousel-example:serve:production'
10+
}
11+
}),
712
/**
813
* TODO(@nx/cypress): In Cypress v12,the testIsolation option is turned on by default.
914
* This can cause tests to start breaking where not indended.

apps/ngu-carousel-e2e/project.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,8 @@
44
"sourceRoot": "apps/ngu-carousel-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"e2e": {
8-
"executor": "@nx/cypress:cypress",
9-
"options": {
10-
"cypressConfig": "apps/ngu-carousel-e2e/cypress.config.ts",
11-
"devServerTarget": "ngu-carousel-example:serve:development",
12-
"testingType": "e2e"
13-
},
14-
"configurations": {
15-
"production": {
16-
"devServerTarget": "ngu-carousel-example:serve:production"
17-
}
18-
}
19-
},
207
"lint": {
21-
"executor": "@nx/linter:eslint",
8+
"executor": "@nx/eslint:lint",
229
"outputs": ["{options.outputFile}"],
2310
"options": {
2411
"lintFilePatterns": ["apps/ngu-carousel-e2e/**/*.{js,ts}"]

apps/ngu-carousel-example/cypress.config.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/ngu-carousel-example/cypress/fixtures/example.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/ngu-carousel-example/cypress/support/commands.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)