Skip to content

Commit 36258f6

Browse files
feat(upgrade): upgrade to 18.1
1 parent 868ade9 commit 36258f6

File tree

13 files changed

+3568
-2937
lines changed

13 files changed

+3568
-2937
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# To validate changes, use an online parser, eg.
1010
# http://yaml-online-parser.appspot.com/
1111

12-
var_1: &docker_image cimg/node:18.18.2
12+
var_1: &docker_image cimg/node:20.15.1
1313
var_2: &cache_key v2-ng-layout-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.7.0
1414

1515
# Settings common to each job
@@ -53,7 +53,7 @@ var_8: &docker-firefox-image
5353
# TODO(devversion): Temporarily use a image that includes Firefox 62 because the
5454
# ngcontainer image does include an old Firefox version that does not support headless.
5555
# See the PR that fixes this: https://github.com/angular/angular/pull/26435
56-
- image: cimg/node:18.18.2-browsers
56+
- image: cimg/node:20.15.1-browsers
5757

5858
# Attaches the release output which has been stored in the workspace to the current job.
5959
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs

angular.json

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@
3939
"prefix": "app",
4040
"architect": {
4141
"build": {
42-
"builder": "@angular-devkit/build-angular:browser",
42+
"builder": "@angular-devkit/build-angular:application",
4343
"options": {
44-
"outputPath": "dist/apps/demo-app",
44+
"outputPath": {
45+
"base": "dist/apps/demo-app"
46+
},
4547
"index": "projects/apps/demo-app/src/index.html",
46-
"main": "projects/apps/demo-app/src/main.ts",
47-
"polyfills": "projects/apps/demo-app/src/polyfills.ts",
48+
"polyfills": [
49+
"projects/apps/demo-app/src/polyfills.ts"
50+
],
4851
"tsConfig": "projects/apps/demo-app/tsconfig.app.json",
4952
"assets": [
5053
"projects/apps/demo-app/src/favicon.ico",
5154
"projects/apps/demo-app/src/assets"
5255
],
5356
"styles": ["projects/apps/demo-app/src/styles.scss"],
54-
"scripts": []
57+
"scripts": [],
58+
"browser": "projects/apps/demo-app/src/main.ts"
5559
},
5660
"configurations": {
5761
"production": {
@@ -76,9 +80,7 @@
7680
"outputHashing": "all"
7781
},
7882
"development": {
79-
"buildOptimizer": false,
8083
"optimization": false,
81-
"vendorChunk": true,
8284
"extractLicenses": false,
8385
"sourceMap": true,
8486
"namedChunks": true
@@ -134,19 +136,30 @@
134136
"prefix": "app",
135137
"architect": {
136138
"build": {
137-
"builder": "@angular-devkit/build-angular:browser",
139+
"builder": "@angular-devkit/build-angular:application",
138140
"options": {
139-
"outputPath": "dist/universal-demo-app/browser",
141+
"outputPath": {
142+
"base": "dist/universal-demo-app"
143+
},
140144
"index": "projects/apps/universal-demo-app/src/index.html",
141-
"main": "projects/apps/universal-demo-app/src/main.ts",
142-
"polyfills": "projects/apps/universal-demo-app/src/polyfills.ts",
145+
"polyfills": [
146+
"projects/apps/universal-demo-app/src/polyfills.ts"
147+
],
143148
"tsConfig": "projects/apps/universal-demo-app/tsconfig.app.json",
144149
"assets": [
145150
"projects/apps/universal-demo-app/src/favicon.ico",
146151
"projects/apps/universal-demo-app/src/assets"
147152
],
148-
"styles": ["projects/apps/universal-demo-app/src/styles.scss"],
149-
"scripts": []
153+
"styles": [
154+
"projects/apps/universal-demo-app/src/styles.scss"
155+
],
156+
"scripts": [],
157+
"browser": "projects/apps/universal-demo-app/src/main.ts",
158+
"server": "projects/apps/universal-demo-app/src/main.server.ts",
159+
"prerender": true,
160+
"ssr": {
161+
"entry": "projects/apps/universal-demo-app/server.ts"
162+
}
150163
},
151164
"configurations": {
152165
"production": {
@@ -171,51 +184,14 @@
171184
"outputHashing": "all"
172185
},
173186
"development": {
174-
"buildOptimizer": false,
175187
"optimization": false,
176-
"vendorChunk": true,
177188
"extractLicenses": false,
178189
"sourceMap": true,
179190
"namedChunks": true
180191
}
181192
},
182193
"defaultConfiguration": "production"
183194
},
184-
"server": {
185-
"builder": "@angular-devkit/build-angular:server",
186-
"options": {
187-
"outputPath": "dist/universal-demo-app/server",
188-
"main": "projects/apps/universal-demo-app/server.ts",
189-
"tsConfig": "projects/apps/universal-demo-app/tsconfig.server.json",
190-
"preserveSymlinks": true,
191-
"sourceMap": true,
192-
"optimization": false,
193-
"buildOptimizer": false
194-
},
195-
"configurations": {
196-
"production": {
197-
"optimization": true,
198-
"fileReplacements": [
199-
{
200-
"replace": "projects/apps/universal-demo-app/src/environments/environment.ts",
201-
"with": "projects/apps/universal-demo-app/src/environments/environment.prod.ts"
202-
}
203-
],
204-
"buildOptimizer": true
205-
}
206-
}
207-
},
208-
"serve-ssr": {
209-
"builder": "@angular-devkit/build-angular:ssr-dev-server",
210-
"defaultConfiguration": "production",
211-
"options": {},
212-
"configurations": {
213-
"production": {
214-
"browserTarget": "universal-demo-app:build:production",
215-
"serverTarget": "universal-demo-app:server:production"
216-
}
217-
}
218-
},
219195
"serve": {
220196
"builder": "@angular-devkit/build-angular:dev-server",
221197
"configurations": {

package.json

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ngx-layout-srcs",
33
"description": "ngx-layout",
4-
"version": "17.0.1",
4+
"version": "18.0.0",
55
"homepage": "https://github.com/ngbracket/ngx-layout",
66
"bugs": "https://github.com/ngbracket/ngx-layout/issues",
77
"repository": {
@@ -10,7 +10,7 @@
1010
},
1111
"license": "MIT",
1212
"engines": {
13-
"node": "^18.10.0 || >=20.9.0",
13+
"node": "^18.20.4 || >=20.15.1",
1414
"yarn": ">=1.22.4 <2",
1515
"npm": "Please use yarn instead of NPM to install dependencies"
1616
},
@@ -26,34 +26,35 @@
2626
"test:ssr": "webpack --config test/webpack-spec-ssr-bundle.js && jasmine --config=test/jasmine-ssr.json",
2727
"lint": "stylelint projects/libs/**/*.scss --config=stylelint-config.json && tslint --project ./tsconfig.json --config tslint.json",
2828
"release": "yarn build && yarn stamp",
29-
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
29+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
30+
"serve:ssr:universal-demo-app": "node dist/universal-demo-app/server/server.mjs"
3031
},
3132
"private": true,
32-
"requiredAngularVersion": ">=17.0.0",
33+
"requiredAngularVersion": ">=18.0.0",
3334
"dependencies": {
34-
"@angular/animations": "17.0.9",
35-
"@angular/common": "17.0.9",
36-
"@angular/compiler": "17.0.9",
37-
"@angular/core": "17.0.9",
38-
"@angular/forms": "17.0.9",
39-
"@angular/material": "^17.0.5",
40-
"@angular/platform-browser": "17.0.9",
41-
"@angular/platform-browser-dynamic": "17.0.9",
42-
"@angular/platform-server": "17.0.9",
43-
"@angular/router": "17.0.9",
44-
"@angular/ssr": "^17.0.10",
35+
"@angular/animations": "18.1.0",
36+
"@angular/common": "18.1.0",
37+
"@angular/compiler": "18.1.0",
38+
"@angular/core": "18.1.0",
39+
"@angular/forms": "18.1.0",
40+
"@angular/material": "^18.1.0",
41+
"@angular/platform-browser": "18.1.0",
42+
"@angular/platform-browser-dynamic": "18.1.0",
43+
"@angular/platform-server": "18.1.0",
44+
"@angular/router": "18.1.0",
45+
"@angular/ssr": "^18.1.0",
4546
"express": "^4.18.2",
4647
"rxjs": "^7.8.1",
4748
"tslib": "^2.6.2",
4849
"zone.js": "^0.14.2"
4950
},
5051
"devDependencies": {
51-
"@angular-devkit/build-angular": "^17.0.10",
52-
"@angular/cdk": "^17.0.5",
53-
"@angular/cli": "17.0.10",
54-
"@angular/compiler-cli": "17.0.9",
52+
"@angular-devkit/build-angular": "^18.1.0",
53+
"@angular/cdk": "^18.1.0",
54+
"@angular/cli": "18.1.0",
55+
"@angular/compiler-cli": "18.1.0",
5556
"@ngtools/webpack": "^17.0.10",
56-
"@types/express": "^4.17.21",
57+
"@types/express": "^4.17.17",
5758
"@types/jasmine": "^5.1.2",
5859
"@types/minimatch": "^5.1.2",
5960
"@types/node": "^20.9.0",
@@ -69,18 +70,21 @@
6970
"karma-parallel": "^0.3.1",
7071
"karma-sauce-launcher": "^4.1.4",
7172
"minimatch": "^9.0.3",
72-
"ng-packagr": "^17.0.3",
73+
"ng-packagr": "^18.1.0",
7374
"postcss": "^8.4.31",
7475
"postcss-scss": "^4.0.9",
7576
"protractor": "^7.0.0",
7677
"stylelint": "^15.11.0",
7778
"ts-node": "^10.9.1",
7879
"tslint": "^6.1.3",
79-
"typescript": "5.2.2",
80+
"typescript": "^5.5.3",
8081
"webpack": "^5.89.0",
8182
"webpack-cli": "^5.1.4"
8283
},
8384
"resolutions": {
8485
"browser-sync-client": "2.29.3"
86+
},
87+
"volta": {
88+
"node": "20.15.1"
8589
}
8690
}
Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,40 @@
1-
import 'zone.js/node';
2-
31
import { APP_BASE_HREF } from '@angular/common';
42
import { CommonEngine } from '@angular/ssr';
5-
import * as express from 'express';
6-
import { existsSync } from 'node:fs';
7-
import { join } from 'node:path';
8-
import bootstrap from './src/main.server';
3+
import express from 'express';
4+
import { fileURLToPath } from 'node:url';
5+
import { dirname, join, resolve } from 'node:path';
6+
import AppServerModule from './src/main.server';
97

108
// The Express app is exported so that it can be used by serverless Functions.
119
export function app(): express.Express {
1210
const server = express();
13-
const distFolder = join(process.cwd(), 'dist/universal-demo-app/browser');
14-
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
15-
? join(distFolder, 'index.original.html')
16-
: join(distFolder, 'index.html');
11+
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
12+
const browserDistFolder = resolve(serverDistFolder, '../browser');
13+
const indexHtml = join(serverDistFolder, 'index.server.html');
1714

1815
const commonEngine = new CommonEngine();
1916

2017
server.set('view engine', 'html');
21-
server.set('views', distFolder);
18+
server.set('views', browserDistFolder);
2219

2320
// Example Express Rest API endpoints
2421
// server.get('/api/**', (req, res) => { });
2522
// Serve static files from /browser
26-
server.get(
27-
'*.*',
28-
express.static(distFolder, {
29-
maxAge: '1y',
30-
})
31-
);
23+
server.get('**', express.static(browserDistFolder, {
24+
maxAge: '1y',
25+
index: 'index.html',
26+
}));
3227

3328
// All regular routes use the Angular engine
34-
server.get('*', (req, res, next) => {
29+
server.get('**', (req, res, next) => {
3530
const { protocol, originalUrl, baseUrl, headers } = req;
3631

3732
commonEngine
3833
.render({
39-
bootstrap,
34+
bootstrap: AppServerModule,
4035
documentFilePath: indexHtml,
4136
url: `${protocol}://${headers.host}${originalUrl}`,
42-
publicPath: distFolder,
37+
publicPath: browserDistFolder,
4338
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
4439
})
4540
.then((html) => res.send(html))
@@ -59,14 +54,4 @@ function run(): void {
5954
});
6055
}
6156

62-
// Webpack will replace 'require' with '__webpack_require__'
63-
// '__non_webpack_require__' is a proxy to Node 'require'
64-
// The below code is to ensure that the server is run only when not requiring the bundle.
65-
declare const __non_webpack_require__: NodeRequire;
66-
const mainModule = __non_webpack_require__.main;
67-
const moduleFilename = (mainModule && mainModule.filename) || '';
68-
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
69-
run();
70-
}
71-
72-
export default bootstrap;
57+
run();

projects/apps/universal-demo-app/tsconfig.app.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
"noImplicitAny": false,
66
"strict": false,
77
"outDir": "../../../out-tsc/app",
8-
"types": []
8+
"types": [
9+
"node"
10+
]
911
},
1012
"files": [
1113
"src/main.ts",
12-
"src/polyfills.ts"
14+
"src/polyfills.ts",
15+
"src/main.server.ts",
16+
"server.ts"
1317
],
1418
"include": [
1519
"src/**/*.d.ts"

projects/apps/universal-demo-app/tsconfig.server.json

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
1-
# ngx-layout
1+
# @ngbracket/ngx-layout
22

3-
The sources for this package are in the main [ngbracket/ngx-layout](https://github.com/ngbracket/ngx-layout) repo.
4-
Please file issues and pull requests against that repo.
3+
This project is a continuation of the original, open-source Angular project, @angular/flex-layout, which is no longer maintained. Please consider collaborating with us rather than creating your own, private flex libraries. Many hands make light work!
4+
5+
If you would like to contribute to the project please get in touch with me on [twitter](https://twitter.com/duncanfaulkner). Alternatively, if you would like to sponsor the project details can be found on our [GitHub page](https://github.com/sponsors/ngbracket).
6+
7+
Thank you for your support.
8+
9+
### Getting Started
10+
11+
Start by installing the ngx-layout library from `npm`
12+
13+
```
14+
npm i -s @ngbracket/ngx-layout @angular/cdk
15+
```
16+
17+
Next, you'll need to import the Layout module in your app's module.
18+
19+
**app.module.ts**
20+
21+
```ts
22+
23+
import { FlexLayoutModule } from '@ngbracket/ngx-layout';
24+
...
25+
26+
@NgModule({
27+
...
28+
imports: [ FlexLayoutModule ],
29+
...
30+
});
31+
```
32+
33+
After that is configured, you can use the ngx-layout attributes in your HTML tags for flex layout:
34+
35+
```html
36+
<div fxLayout="row" fxLayoutAlign="space-between"></div>
37+
```
38+
39+
---
540

641
License: MIT

0 commit comments

Comments
 (0)