Skip to content

Commit

Permalink
feat: upgrade to Angular 18
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt committed Sep 9, 2024
1 parent c8b18ff commit 4d2daca
Show file tree
Hide file tree
Showing 17 changed files with 4,518 additions and 4,361 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/single-spa-angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '18.13'
node-version: '20.11.1'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ migrations.json
!.yarn/sdks
!.yarn/versions

.nx/cache
.nx/cache
.nx/workspace-data
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ assets
.husky
*.ejs

/.nx/cache
/.nx/cache
/.nx/workspace-data
4 changes: 2 additions & 2 deletions apps/chat/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "chat:build:development"
"buildTarget": "chat:build:development"
},
"configurations": {
"production": {
"browserTarget": "chat:build:production"
"buildTarget": "chat:build:production"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/elements/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "elements:build:development"
"buildTarget": "elements:build:development"
},
"configurations": {
"production": {
"browserTarget": "elements:build:production"
"buildTarget": "elements:build:production"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions apps/elements/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { NgModule, Injector, DoBootstrap } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { createCustomElement } from '@angular/elements';

import { AppComponent } from './app.component';

@NgModule({
imports: [BrowserModule, HttpClientModule],
declarations: [AppComponent],
imports: [BrowserModule],
providers: [provideHttpClient(withInterceptorsFromDi())],
})
export class AppModule implements DoBootstrap {
constructor(private injector: Injector) {}
Expand Down
4 changes: 2 additions & 2 deletions apps/navbar/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "navbar:build:development"
"buildTarget": "navbar:build:development"
},
"configurations": {
"production": {
"browserTarget": "navbar:build:production"
"buildTarget": "navbar:build:production"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/noop-zone/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "noop-zone:build:development"
"buildTarget": "noop-zone:build:development"
},
"configurations": {
"production": {
"browserTarget": "noop-zone:build:production"
"buildTarget": "noop-zone:build:production"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/parcel/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "parcel:build:development"
"buildTarget": "parcel:build:development"
},
"configurations": {
"production": {
"browserTarget": "parcel:build:production"
"buildTarget": "parcel:build:production"
}
}
}
Expand Down
31 changes: 10 additions & 21 deletions apps/root-config/src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.8.2/css/bulma.min.css"
/>

<% if (htmlWebpackPlugin.options.isDevelopment) { %>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.13.1/zone.js">
</script>
<% } else { %>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.13.1/zone.min.js"
integrity="sha512-+cWrFbFSw+41uXDoayGA63htnbwihSP7gbW5dwd7zK2lf7uvy0TmORZPtlWr/41sHRwSZTkO3Fav7bd8fvLiqg=="
crossorigin="anonymous"
referrerpolicy="no-referrer">
</script>
<% } %>

<meta name="importmap-type" content="systemjs-importmap" />
<script type="systemjs-importmap">
{
Expand All @@ -48,6 +35,7 @@
"@angular/compiler": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-compiler.js",
"@angular/core/primitives/signals": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core-primitives-signals.js",
"@angular/core/primitives/event-dispatch": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core-primitives-event-dispatch.js",
"@angular/core": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core.js",
"@angular/common": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-common.js",
Expand All @@ -65,10 +53,10 @@
"@angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-elements.js",
"single-spa-angular/internals": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-internals.js",
"single-spa-angular": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular.js",
"single-spa-angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-elements.js",
"single-spa-angular/parcel": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-parcel.js"
"single-spa-angular/internals": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-internals.js",
"single-spa-angular": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular.js",
"single-spa-angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-elements.js",
"single-spa-angular/parcel": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-parcel.js"
}
}
</script>
Expand All @@ -79,6 +67,7 @@
"single-spa": "https://cdnjs.cloudflare.com/ajax/libs/single-spa/5.9.3/system/single-spa.min.js",
"@angular/core/primitives/signals": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core-primitives-signals.min.js",
"@angular/core/primitives/event-dispatch": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core-primitives-event-dispatch.min.js",
"@angular/core": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-core.min.js",
"@angular/common": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-common.min.js",
Expand All @@ -96,10 +85,10 @@
"@angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular/system/es2022/angular-elements.min.js",
"single-spa-angular/internals": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-internals.min.js",
"single-spa-angular": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular.min.js",
"single-spa-angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-elements.min.js",
"single-spa-angular/parcel": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.0.1/system/es2022/single-spa-angular-parcel.min.js"
"single-spa-angular/internals": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-internals.min.js",
"single-spa-angular": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular.min.js",
"single-spa-angular/elements": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-elements.min.js",
"single-spa-angular/parcel": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@9.1.2/system/es2022/single-spa-angular-parcel.min.js"
}
}
</script>
Expand Down
76 changes: 39 additions & 37 deletions apps/root-config/src/main.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
System.import('single-spa').then(({ registerApplication, start }) => {
registerApplication({
name: 'navbar',
app: () => System.import('navbar'),
activeWhen: () => true,
});
import('zone.js').then(() => {
System.import('single-spa').then(({ registerApplication, start }) => {
registerApplication({
name: 'navbar',
app: () => System.import('navbar'),
activeWhen: () => true,
});

registerApplication({
name: 'shop',
app: () => System.import('shop'),
activeWhen: location => location.pathname.startsWith('/shop'),
});
registerApplication({
name: 'shop',
app: () => System.import('shop'),
activeWhen: location => location.pathname.startsWith('/shop'),
});

registerApplication({
name: 'chat',
app: () => System.import('chat'),
activeWhen: location => location.pathname.startsWith('/chat'),
});
registerApplication({
name: 'chat',
app: () => System.import('chat'),
activeWhen: location => location.pathname.startsWith('/chat'),
});

registerApplication({
name: 'noop-zone',
app: () => System.import('noop-zone'),
activeWhen: location => location.pathname.startsWith('/noop-zone'),
});
registerApplication({
name: 'noop-zone',
app: () => System.import('noop-zone'),
activeWhen: location => location.pathname.startsWith('/noop-zone'),
});

registerApplication({
name: 'elements',
app: () => System.import('elements'),
activeWhen: location => location.pathname.startsWith('/elements'),
});
registerApplication({
name: 'elements',
app: () => System.import('elements'),
activeWhen: location => location.pathname.startsWith('/elements'),
});

registerApplication({
name: 'parcel',
app: () => System.import('parcel'),
activeWhen: location => location.pathname.startsWith('/parcel'),
});
registerApplication({
name: 'parcel',
app: () => System.import('parcel'),
activeWhen: location => location.pathname.startsWith('/parcel'),
});

registerApplication({
name: 'standalone',
app: () => System.import('standalone'),
activeWhen: location => location.pathname.startsWith('/standalone'),
});
registerApplication({
name: 'standalone',
app: () => System.import('standalone'),
activeWhen: location => location.pathname.startsWith('/standalone'),
});

start();
start();
});
});
4 changes: 2 additions & 2 deletions apps/shop/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "shop:build:development"
"buildTarget": "shop:build:development"
},
"configurations": {
"production": {
"browserTarget": "shop:build:production"
"buildTarget": "shop:build:production"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/standalone/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
"serve": {
"executor": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "standalone:build:development"
"buildTarget": "standalone:build:development"
},
"configurations": {
"production": {
"browserTarget": "standalone:build:production"
"buildTarget": "standalone:build:production"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions libs/single-spa-angular/webpack/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const externals = [
'@angular/compiler',

'@angular/core/primitives/signals',
'@angular/core/primitives/event-dispatch',
'@angular/core',
'@angular/core/rxjs-interop',

Expand Down
7 changes: 3 additions & 4 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"affected": {
"defaultBase": "master"
},
"tasksRunnerOptions": {
"default": {
"options": {
Expand Down Expand Up @@ -63,5 +60,7 @@
}
},
"nxCloudAccessToken": "YmQwMTE3MTMtOTE0YS00ZjUwLTliN2ItMWI4N2NmMmQ1MTUzfHJlYWQtd3JpdGU=",
"parallel": 1
"parallel": 1,
"useInferencePlugins": false,
"defaultBase": "master"
}
Loading

0 comments on commit 4d2daca

Please sign in to comment.