Skip to content

Commit

Permalink
build: update to Angular v17.2.0 (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Feb 16, 2024
1 parent 8f6e2d7 commit f444e18
Show file tree
Hide file tree
Showing 11 changed files with 1,964 additions and 659 deletions.
4 changes: 2 additions & 2 deletions apps/create-analog-e2e/tests/create-analog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('create-analog e2e', () => {
{ cwd: process.cwd() }
);

await runCommandAsync(`npm i`, {
await runCommandAsync(`npm i --legacy-peer-deps`, {
cwd: tmpDir,
});

Expand Down Expand Up @@ -86,7 +86,7 @@ describe('create-analog e2e', () => {
{ cwd: process.cwd() }
);

await runCommandAsync(`npm i`, {
await runCommandAsync(`npm i --legacy-peer-deps`, {
cwd: tmpDir,
});

Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
"apps/docs-app"
],
"dependencies": {
"@angular/animations": "^17.1.0",
"@angular/animations": "^17.2.0",
"@angular/cdk": "^17.1.0",
"@angular/common": "^17.1.0",
"@angular/compiler": "^17.1.0",
"@angular/core": "^17.1.0",
"@angular/forms": "^17.1.0",
"@angular/common": "^17.2.0",
"@angular/compiler": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/forms": "^17.2.0",
"@angular/material": "^17.1.0",
"@angular/platform-browser": "^17.1.0",
"@angular/platform-browser-dynamic": "^17.1.0",
"@angular/platform-server": "^17.1.0",
"@angular/router": "^17.1.0",
"@angular/platform-browser": "^17.2.0",
"@angular/platform-browser-dynamic": "^17.2.0",
"@angular/platform-server": "^17.2.0",
"@angular/router": "^17.2.0",
"@astrojs/mdx": "^1.1.0",
"@astrojs/react": "^3.0.0",
"@babel/core": "^7.21.8",
Expand Down Expand Up @@ -84,20 +84,20 @@
"zone.js": "^0.14.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.1.0",
"@angular-devkit/core": "^17.1.0",
"@angular-devkit/schematics": "^17.1.0",
"@angular-devkit/build-angular": "^17.2.0",
"@angular-devkit/core": "^17.2.0",
"@angular-devkit/schematics": "^17.2.0",
"@angular-eslint/eslint-plugin": "16.0.1",
"@angular-eslint/eslint-plugin-template": "16.0.1",
"@angular-eslint/template-parser": "16.0.1",
"@angular/cli": "~17.1.0",
"@angular/compiler-cli": "^17.1.0",
"@angular/language-service": "^17.1.0",
"@angular/cli": "~17.2.0",
"@angular/compiler-cli": "^17.2.0",
"@angular/language-service": "^17.2.0",
"@astrojs/markdown-component": "^1.0.5",
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@netlify/functions": "^2.3.0",
"@ngtools/webpack": "^17.1.0",
"@ngtools/webpack": "^17.2.0",
"@nx/cypress": "18.0.4",
"@nx/eslint": "18.0.4",
"@nx/eslint-plugin": "18.0.4",
Expand All @@ -106,7 +106,7 @@
"@nx/plugin": "18.0.4",
"@nx/vite": "18.0.4",
"@nx/web": "18.0.4",
"@schematics/angular": "^17.1.0",
"@schematics/angular": "^17.2.0",
"@swc-node/register": "1.8.0",
"@swc/cli": "0.1.62",
"@swc/core": "~1.3.85",
Expand Down Expand Up @@ -143,7 +143,7 @@
"kolorist": "^1.6.0",
"lint-staged": "^13.1.0",
"minimist": "^1.2.7",
"ng-packagr": "^17.1.0",
"ng-packagr": "^17.2.0",
"nitropack": "^2.6.0",
"nx": "18.0.4",
"playwright": "^1.30.0",
Expand Down
30 changes: 15 additions & 15 deletions packages/create-analog/template-angular-v17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
"dependencies": {
"@analogjs/content": "^0.2.0",
"@analogjs/router": "^0.2.0",
"@angular/animations": "^17.1.0",
"@angular/common": "^17.1.0",
"@angular/compiler": "^17.1.0",
"@angular/core": "^17.1.0",
"@angular/forms": "^17.1.0",
"@angular/platform-browser": "^17.1.0",
"@angular/platform-browser-dynamic": "^17.1.0",
"@angular/platform-server": "^17.1.0",
"@angular/router": "^17.1.0",
"@nx/angular": "~17.2.0",
"@angular/animations": "^17.2.0",
"@angular/common": "^17.2.0",
"@angular/compiler": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/forms": "^17.2.0",
"@angular/platform-browser": "^17.2.0",
"@angular/platform-browser-dynamic": "^17.2.0",
"@angular/platform-server": "^17.2.0",
"@angular/router": "^17.2.0",
"@nx/angular": "~18.0.0",
"front-matter": "^4.0.2",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.1.0",
Expand All @@ -38,11 +38,11 @@
},
"devDependencies": {
"@analogjs/platform": "^0.2.0",
"@angular-devkit/build-angular": "^17.1.0",
"@angular/cli": "^17.1.0",
"@angular/compiler-cli": "^17.1.0",
"@nx/vite": "~17.2.0",
"nx": "~17.2.0",
"@angular-devkit/build-angular": "^17.2.0",
"@angular/cli": "^17.2.0",
"@angular/compiler-cli": "^17.2.0",
"@nx/vite": "~18.0.0",
"nx": "~18.0.0",
"jsdom": "^22.1.0",
"typescript": "~5.3.0",
"vite": "~5.0.0",
Expand Down
30 changes: 15 additions & 15 deletions packages/create-analog/template-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
"dependencies": {
"@analogjs/content": "^0.2.0",
"@analogjs/router": "^0.2.0",
"@angular/animations": "^17.1.0",
"@angular/common": "^17.1.0",
"@angular/compiler": "^17.1.0",
"@angular/core": "^17.1.0",
"@angular/forms": "^17.1.0",
"@angular/platform-browser": "^17.1.0",
"@angular/platform-browser-dynamic": "^17.1.0",
"@angular/platform-server": "^17.1.0",
"@angular/router": "^17.1.0",
"@nx/angular": "~17.2.0",
"@angular/animations": "^17.2.0",
"@angular/common": "^17.2.0",
"@angular/compiler": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/forms": "^17.2.0",
"@angular/platform-browser": "^17.2.0",
"@angular/platform-browser-dynamic": "^17.2.0",
"@angular/platform-server": "^17.2.0",
"@angular/router": "^17.2.0",
"@nx/angular": "~18.0.0",
"front-matter": "^4.0.2",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.1.0",
Expand All @@ -38,11 +38,11 @@
},
"devDependencies": {
"@analogjs/platform": "^0.2.0",
"@angular-devkit/build-angular": "^17.1.0",
"@angular/cli": "^17.1.0",
"@angular/compiler-cli": "^17.1.0",
"@nx/vite": "~17.2.0",
"nx": "~17.2.0",
"@angular-devkit/build-angular": "^17.2.0",
"@angular/cli": "^17.2.0",
"@angular/compiler-cli": "^17.2.0",
"@nx/vite": "~18.0.0",
"nx": "~18.0.0",
"jsdom": "^22.1.0",
"typescript": "~5.3.0",
"vite": "~5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ const initWithNxNamespace = async (
addDependenciesToPackageJson(
tree,
{
'@angular/animations': '^17.1.0',
'@angular/common': '^17.1.0',
'@angular/compiler': '^17.1.0',
'@angular/core': '^17.1.0',
'@angular/forms': '^17.1.0',
'@angular/platform-browser': '^17.1.0',
'@angular/platform-browser-dynamic': '^17.1.0',
'@angular/platform-server': '^17.1.0',
'@angular/router': '^17.1.0',
'@angular/animations': '^17.2.0',
'@angular/common': '^17.2.0',
'@angular/compiler': '^17.2.0',
'@angular/core': '^17.2.0',
'@angular/forms': '^17.2.0',
'@angular/platform-browser': '^17.2.0',
'@angular/platform-browser-dynamic': '^17.2.0',
'@angular/platform-server': '^17.2.0',
'@angular/router': '^17.2.0',
rxjs: '~7.5.6',
tslib: '^2.4.0',
'zone.js': '~0.14.0',
},
{
'@angular-devkit/build-angular': '^17.1.0',
'@angular/compiler-cli': '^17.1.0',
'@angular-devkit/build-angular': '^17.2.0',
'@angular/compiler-cli': '^17.2.0',
'@nx/angular': versions['@nx/angular'],
'@nx/devkit': versions['@nx/devkit'],
'@nx/eslint': versions['@nx/eslint'],
Expand Down
4 changes: 2 additions & 2 deletions packages/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@analogjs/vite-plugin-nitro": "^0.2.37"
},
"peerDependencies": {
"@nx/devkit": "^16.0.0 || ^17.0.0",
"@nx/vite": "^16.0.0 || ^17.0.0"
"@nx/devkit": "^16.0.0 || ^17.0.0 || ^18.0.0",
"@nx/vite": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
"builders": "./src/lib/nx-plugin/executors.json",
"executors": "./src/lib/nx-plugin/executors.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`authoring ng file > should process component as an analog file 1`] = `
"import { Component, ChangeDetectionStrategy } from '@angular/core';
import { signal, input, ViewChild, afterNextRender, ElementRef } from "@angular/core";
import { signal, input, ViewChild, afterNextRender, ElementRef, viewChild, viewChildren, contentChild, contentChildren } from "@angular/core";
@Component({
standalone: true,
Expand Down Expand Up @@ -44,6 +44,12 @@ export default class VirtualAnalogComponent {
const requiredInputWithTransform = this.requiredInputWithTransform
const output = this.output
const outputWithType = this.outputWithType
const viewChildEl = this.viewChildEl
const viewChildRequiredEl = this.viewChildRequiredEl
const viewChildrenEl = this.viewChildrenEl
const contentChildEl = this.contentChildEl
const contentChildRequiredEl = this.contentChildRequiredEl
const contentChildrenEl = this.contentChildrenEl
afterNextRender(() => {
Expand Down Expand Up @@ -75,6 +81,12 @@ export default class VirtualAnalogComponent {
});
protected output = new EventEmitter();
protected outputWithType = new EventEmitter<string>();
protected viewChildEl = viewChild<HTMLDivElement>('divElement');
protected viewChildRequiredEl = viewChild.required<HTMLDivElement>('divElement');
protected viewChildrenEl = viewChildren<HTMLDivElement[]>('divElement');
protected contentChildEl = contentChild<ElementRef>('divElement');
protected contentChildRequiredEl = contentChild.required<ElementRef>('divElement');
protected contentChildrenEl = contentChildren<HTMLDivElement[]>('divElement');
}
Expand Down
12 changes: 11 additions & 1 deletion packages/vite-plugin-angular/src/lib/authoring/analog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { compileAnalogFile } from './analog';

const COMPONENT_CONTENT = `
<script lang="ts">
import { signal, input, ViewChild, afterNextRender, ElementRef } from '@angular/core';
import { signal, input, ViewChild, afterNextRender, ElementRef, viewChild, viewChildren, contentChild, contentChildren } from '@angular/core';
defineMetadata({
exposes: [Math],
Expand Down Expand Up @@ -59,6 +59,16 @@ const requiredInputWithTransform = input.required<unknown, number>({
const output = new EventEmitter();
const outputWithType = new EventEmitter<string>();
const viewChildEl = viewChild<HTMLDivElement>('divElement');
const viewChildRequiredEl = viewChild.required<HTMLDivElement>('divElement');
const viewChildrenEl = viewChildren<HTMLDivElement[]>('divElement');
const contentChildEl = contentChild<ElementRef>('divElement');
const contentChildRequiredEl = contentChild.required<ElementRef>('divElement');
const contentChildrenEl = contentChildren<HTMLDivElement[]>('divElement');
afterNextRender(() => {
console.log('the div', divElement);
})
Expand Down
6 changes: 4 additions & 2 deletions packages/vite-plugin-angular/src/lib/authoring/analog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
INVALID_METADATA_PROPERTIES,
ON_DESTROY,
ON_INIT,
REQUIRED_SIGNALS_MAP,
SCRIPT_TAG_REGEX,
SIGNALS_MAP,
STYLE_TAG_REGEX,
TEMPLATE_TAG_REGEX,
} from './constants';
Expand Down Expand Up @@ -528,8 +530,8 @@ function getIOStructure(

if (
(Node.isPropertyAccessExpression(expression) &&
expression.getText() === 'input.required') ||
(Node.isIdentifier(expression) && expression.getText() === 'input')
REQUIRED_SIGNALS_MAP[expression.getText()]) ||
(Node.isIdentifier(expression) && SIGNALS_MAP[expression.getText()])
) {
return { initializer: initializer.getText() };
}
Expand Down
22 changes: 22 additions & 0 deletions packages/vite-plugin-angular/src/lib/authoring/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,30 @@ export const STYLE_TAG_REGEX = /<style>([\s\S]*?)<\/style>/i;

export const ON_INIT = 'onInit';
export const ON_DESTROY = 'onDestroy';
export const INPUT = 'input';
export const INPUT_REQUIRED = 'input.required';
export const VIEWCHILD = 'viewChild';
export const VIEWCHILD_REQUIRED = 'viewChild.required';
export const VIEWCHILDREN = 'viewChildren';
export const CONTENT_CHILD = 'contentChild';
export const CONTENT_CHILD_REQUIRED = 'contentChild.required';
export const CONTENTCHILDREN = 'contentChildren';

export const HOOKS_MAP = {
[ON_INIT]: 'ngOnInit',
[ON_DESTROY]: 'ngOnDestroy',
} as const;

export const SIGNALS_MAP: Record<string, string> = {
[INPUT]: 'input',
[VIEWCHILD]: 'viewChild',
[VIEWCHILDREN]: 'viewChildren',
[CONTENT_CHILD]: 'contentChild',
[CONTENTCHILDREN]: 'contentChildren',
};

export const REQUIRED_SIGNALS_MAP: Record<string, string> = {
[INPUT_REQUIRED]: 'input.required',
[VIEWCHILD_REQUIRED]: 'viewChild.required',
[CONTENT_CHILD_REQUIRED]: 'contentChild.required',
};
Loading

0 comments on commit f444e18

Please sign in to comment.