Skip to content

Commit

Permalink
chore(): update to angular17, tfjs 4.13
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitMY committed Nov 8, 2023
1 parent d61a5d3 commit f57f88a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 51 deletions.
14 changes: 7 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,25 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sign-translate:build",
"headers": {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp"
}
},
"buildTarget": "sign-translate:build"
},
"configurations": {
"production": {
"browserTarget": "sign-translate:build:production"
"buildTarget": "sign-translate:build:production"
},
"development": {
"browserTarget": "sign-translate:build:development"
"buildTarget": "sign-translate:build:development"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sign-translate:build"
"buildTarget": "sign-translate:build"
}
},
"test": {
Expand Down Expand Up @@ -247,7 +247,7 @@
"defaultConfiguration": "production"
},
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"builder": "@angular-devkit/build-angular:ssr-dev-server",
"configurations": {
"development": {
"browserTarget": "sign-translate:build",
Expand All @@ -261,7 +261,7 @@
"defaultConfiguration": "development"
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"builder": "@angular-devkit/build-angular:prerender",
"options": {
"routes": [
"/",
Expand Down
55 changes: 27 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@
},
"private": true,
"dependencies": {
"@angular/animations": "16.2.12",
"@angular/cdk": "16.2.11",
"@angular/common": "16.2.12",
"@angular/compiler": "16.2.12",
"@angular/core": "16.2.12",
"@angular/forms": "16.2.12",
"@angular/material": "16.2.11",
"@angular/platform-browser": "16.2.12",
"@angular/platform-browser-dynamic": "16.2.12",
"@angular/platform-server": "16.2.12",
"@angular/router": "16.2.12",
"@angular/service-worker": "16.2.12",
"@angular/animations": "17.0.0",
"@angular/cdk": "17.0.0",
"@angular/common": "17.0.0",
"@angular/compiler": "17.0.0",
"@angular/core": "17.0.0",
"@angular/forms": "17.0.0",
"@angular/material": "17.0.0",
"@angular/platform-browser": "17.0.0",
"@angular/platform-browser-dynamic": "17.0.0",
"@angular/platform-server": "17.0.0",
"@angular/router": "17.0.0",
"@angular/service-worker": "17.0.0",
"@angular/ssr": "^17.0.0",
"@asymmetrik/ngx-leaflet": "16.0.1",
"@capacitor-firebase/analytics": "5.2.0",
"@capacitor-firebase/app": "5.2.0",
Expand All @@ -64,19 +65,18 @@
"@mediapipe/drawing_utils": "0.3.1675466124",
"@mediapipe/holistic": "0.5.1675471629",
"@ngneat/transloco": "6.0.0",
"@nguniversal/express-engine": "16.2.0",
"@ngxs/store": "3.8.1",
"@sign-mt/browsermt": "0.2.1",
"@sign-mt/i18n": "git://github.com/sign/i18n.git",
"@sutton-signwriting/font-ttf": "1.5.2",
"@sutton-signwriting/sgnw-components": "1.1.0",
"@tensorflow/tfjs": "4.10.0",
"@tensorflow/tfjs-backend-wasm": "4.10.0",
"@tensorflow/tfjs-backend-webgl": "4.10.0",
"@tensorflow/tfjs-backend-webgpu": "4.10.0",
"@tensorflow/tfjs-converter": "4.10.0",
"@tensorflow/tfjs-core": "4.10.0",
"@tensorflow/tfjs-layers": "4.10.0",
"@tensorflow/tfjs": "4.13.0",
"@tensorflow/tfjs-backend-wasm": "4.13.0",
"@tensorflow/tfjs-backend-webgl": "4.13.0",
"@tensorflow/tfjs-backend-webgpu": "4.13.0",
"@tensorflow/tfjs-converter": "4.13.0",
"@tensorflow/tfjs-core": "4.13.0",
"@tensorflow/tfjs-layers": "4.13.0",
"base64-blob": "1.4.1",
"capacitor-blob-writer": "1.1.14",
"cld3-asm": "3.1.1",
Expand All @@ -98,25 +98,24 @@
"zone.js": "0.14.2"
},
"devDependencies": {
"@angular-devkit/architect": "0.1602.9",
"@angular-devkit/build-angular": "16.2.9",
"@angular-devkit/architect": "0.1700.0",
"@angular-devkit/build-angular": "17.0.0",
"@angular-eslint/builder": "16.2.0",
"@angular-eslint/eslint-plugin": "16.2.0",
"@angular-eslint/eslint-plugin-template": "16.2.0",
"@angular-eslint/schematics": "16.2.0",
"@angular-eslint/template-parser": "16.2.0",
"@angular/cli": "16.2.9",
"@angular/compiler-cli": "16.2.12",
"@angular/cli": "17.0.0",
"@angular/compiler-cli": "17.0.0",
"@capacitor/assets": "3.0.1",
"@capacitor/cli": "5.5.1",
"@ionic/angular-server": "7.5.3",
"@nguniversal/builders": "16.2.0",
"@playwright/test": "1.37.1",
"@playwright/test": "1.39.0",
"@sign-mt/configuration": "git://github.com/sign/.github.git",
"@trapezedev/project": "7.0.10",
"@types/dom-mediacapture-transform": "0.1.9",
"@types/dom-speech-recognition": "0.0.4",
"@types/dom-webcodecs": "0.1.5",
"@types/dom-webcodecs": "0.1.10",
"@types/jasmine": "5.1.2",
"@types/jasminewd2": "2.0.13",
"@types/offscreencanvas": "2019.7.3",
Expand Down Expand Up @@ -151,7 +150,7 @@
"tiny-async-pool": "2.1.0",
"ts-node": "10.9.1",
"tsx": "3.14.0",
"typescript": "5.0.4",
"typescript": "5.2.2",
"webpack-bundle-analyzer": "4.9.1",
"zod": "3.22.4"
}
Expand Down
34 changes: 20 additions & 14 deletions server.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import 'zone.js/node';

import {APP_BASE_HREF} from '@angular/common';
import {ngExpressEngine} from '@nguniversal/express-engine';
import {Express} from 'express';
import {existsSync} from 'node:fs';
import {join} from 'node:path';
import {CommonEngine} from '@angular/ssr';
import {AppServerModule} from './src/main.server';

const express = require('express');

// The Express app is exported so that it can be used by serverless Functions.
export function app(): Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/sign-translate/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/main/modules/express-engine)
server.engine(
'html',
ngExpressEngine({
bootstrap: AppServerModule,
})
);
const commonEngine = new CommonEngine();

server.set('view engine', 'html');
server.set('views', distFolder);
Expand All @@ -36,9 +31,20 @@ export function app(): Express {
})
);

// All regular routes use the Universal engine
server.get('*', (req, res) => {
res.render(indexHtml, {req, providers: [{provide: APP_BASE_HREF, useValue: req.baseUrl}]});
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const {protocol, originalUrl, baseUrl, headers} = req;

commonEngine
.render({
bootstrap: AppServerModule,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{provide: APP_BASE_HREF, useValue: baseUrl}],
})
.then(html => res.send(html))
.catch(err => next(err));
});

return server;
Expand All @@ -64,4 +70,4 @@ if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}

export * from './src/main.server';
export default AppServerModule;
3 changes: 1 addition & 2 deletions update-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Update client dependencies
bun x npm-check-updates --cacheClear -u --reject filesize,@types/dom-webcodecs,typescript,@playwright/test,@tensorflow/tfjs,@tensorflow/tfjs-backend-wasm,@tensorflow/tfjs-backend-webgl,@tensorflow/tfjs-backend-webgpu,@tensorflow/tfjs-converter,@tensorflow/tfjs-core,@tensorflow/tfjs-layers
bun x npm-check-updates --cacheClear -u --reject filesize,typescript
npm install

# filesize: ngx-filesize 3 requires filesize >= 6.0.0 < 10.0.0 as a peer dependency

# TODO @playwright/test 0.140 is buggy for us until updating typescript probably
# TODO @tensorflow/tfjs 4.11.0 https://github.com/tensorflow/tfjs/issues/7974

# Update server dependencies
bun x npm-check-updates --cacheClear --cwd functions -u --reject node-fetch
Expand Down

0 comments on commit f57f88a

Please sign in to comment.