Skip to content

Commit

Permalink
feat: add support for Angular v17
Browse files Browse the repository at this point in the history
  • Loading branch information
ocombe committed Oct 11, 2023
1 parent 6ed662a commit 175ed14
Show file tree
Hide file tree
Showing 80 changed files with 2,009 additions and 245 deletions.
32 changes: 25 additions & 7 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
"mainFile": "index.ts",
"rootDir": "angular/devkit/common"
},
"dev-services/ng-compat": {
"name": "dev-services/ng-compat",
"scope": "",
"version": "",
"mainFile": "index.ts",
"rootDir": "angular/devkit/ng-compat"
},
"dev-services/compiler/elements": {
"name": "dev-services/compiler/elements",
"scope": "bitdev.angular",
Expand Down Expand Up @@ -65,6 +58,14 @@
"mainFile": "index.js",
"rootDir": "angular/devkit/linter/eslint"
},
"dev-services/ng-compat": {
"name": "dev-services/ng-compat",
"scope": "",
"version": "",
"defaultScope": "bitdev.angular",
"mainFile": "index.ts",
"rootDir": "angular/devkit/ng-compat"
},
"dev-services/ngcc": {
"name": "dev-services/ngcc",
"scope": "bitdev.angular",
Expand Down Expand Up @@ -97,6 +98,7 @@
"name": "dev-services/vite",
"scope": "",
"version": "",
"defaultScope": "bitdev.angular",
"mainFile": "index.ts",
"rootDir": "angular/devkit/vite"
},
Expand Down Expand Up @@ -142,6 +144,14 @@
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v16-env"
},
"envs/angular-v17-env": {
"name": "envs/angular-v17-env",
"scope": "",
"version": "",
"defaultScope": "bitdev.angular",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v17-env"
},
"envs/base-env": {
"name": "envs/base-env",
"scope": "bitdev.angular",
Expand Down Expand Up @@ -191,6 +201,14 @@
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v16-env"
},
"examples/my-angular-v17-env": {
"name": "examples/my-angular-v17-env",
"scope": "",
"version": "",
"defaultScope": "bitdev.angular",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v17-env"
},
/*"readme": {
"scope": "bitdev.angular",
"version": "1.0.1",
Expand Down
121 changes: 121 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,97 @@ jobs:
name: debug-log
path: $HOME/Library/Caches/Bit/logs

# Test angular-v17
v17:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
steps:
- uses: teambit/[email protected]
with:
name: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}

- uses: actions/checkout@v3

- name: Keep v17
run: npm i [email protected] && node scripts/keep-env.js --version=17

- name: Cleanup node modules
run: rm -rf node_modules

- name: Install dependencies
run: bit install --log

- name: Remove default
run: bit remove angular-env -s -f --log

- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v16
run: bit remove envs/angular-v16-env -s -f --log

- name: Remove v16 fork
run: bit remove examples/my-angular-v16-env -s -f --log

- name: Remove v15
run: bit remove envs/angular-v15-env -s -f --log

- name: Remove v15 fork
run: bit remove examples/my-angular-v15-env -s -f --log

- name: Remove v14
run: bit remove envs/angular-v14-env -s -f --log

- name: Remove v14 fork
run: bit remove examples/my-angular-v14-env -s -f --log

- name: Remove v13
run: bit remove envs/angular-v13-env -s -f --log

- name: Remove v13 fork
run: bit remove examples/my-angular-v13-env -s -f --log

- name: Remove v12
run: bit remove envs/angular-v12-env -s -f --log

- name: Remove v12 fork
run: bit remove examples/my-angular-v12-env -s -f --log

- name: Add example component
run: bit add integration/demo-lib-v17 --log

- name: Bit cc
run: bit cc

- name: Cleanup capsules
run: bit capsule delete --all

- name: Cleanup node modules
run: rm -rf node_modules

- name: Cleanup package-lock.json
run: rm -rf package-lock.json

- name: Cleanup .git/bit
run: rm -rf .git/bit

- name: Install dependencies
run: bit install --log

- name: Bit test
run: bit test --log

- name: Bit build
run: bit build --log

- uses: actions/upload-artifact@v3
with:
name: debug-log
path: $HOME/Library/Caches/Bit/logs

# Test angular-v16
v16:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -127,6 +218,12 @@ jobs:
- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v17
run: bit remove envs/angular-v17-env -s -f --log

- name: Remove v17 fork
run: bit remove examples/my-angular-v17-env -s -f --log

- name: Remove v15
run: bit remove envs/angular-v15-env -s -f --log

Expand Down Expand Up @@ -213,6 +310,12 @@ jobs:
- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v17
run: bit remove envs/angular-v17-env -s -f --log

- name: Remove v17 fork
run: bit remove examples/my-angular-v17-env -s -f --log

- name: Remove v16
run: bit remove envs/angular-v16-env -s -f --log

Expand Down Expand Up @@ -298,6 +401,12 @@ jobs:
- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v17
run: bit remove envs/angular-v17-env -s -f --log

- name: Remove v17 fork
run: bit remove examples/my-angular-v17-env -s -f --log

- name: Remove v16
run: bit remove envs/angular-v16-env -s -f --log

Expand Down Expand Up @@ -383,6 +492,12 @@ jobs:
- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v17
run: bit remove envs/angular-v17-env -s -f --log

- name: Remove v17 fork
run: bit remove examples/my-angular-v17-env -s -f --log

- name: Remove v16
run: bit remove envs/angular-v16-env -s -f --log

Expand Down Expand Up @@ -469,6 +584,12 @@ jobs:
- name: Remove default fork
run: bit remove examples/my-angular-env -s -f --log

- name: Remove v17
run: bit remove envs/angular-v17-env -s -f --log

- name: Remove v17 fork
run: bit remove examples/my-angular-v17-env -s -f --log

- name: Remove v16
run: bit remove envs/angular-v16-env -s -f --log

Expand Down
6 changes: 3 additions & 3 deletions angular/app-types/angular-app-type/angular.application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export class AngularApp implements Application {
return join(artifactsDir, this.name);
}

private getDevServerContext(context: AppContext, appRootPath: string): DevServerContext {
private getDevServerContext(context: AppContext): DevServerContext {
return Object.assign(cloneDeep(context), {
entry: [],
rootPath: appRootPath,
rootPath: '',
publicPath: `${this.publicDir}/${this.options.name}`,
title: this.options.name
});
Expand Down Expand Up @@ -121,7 +121,7 @@ export class AngularApp implements Application {
const workspaceCmpsIDs = await this.workspace.listIds();
const bitCmps = await this.workspace.getMany(workspaceCmpsIDs);
this.generateTsConfig(bitCmps, appRootPath, tsconfigPath);
const devServerContext = this.getDevServerContext(context, this.options.bundler === 'vite' ? '' : appRootPath);
const devServerContext = this.getDevServerContext(context);
const preview = this.preview(this.envContext);

return preview.getDevServer(devServerContext)(this.envContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VERSION } from '@angular/cli';

export let IndexHtmlWebpackPlugin: any;
if (VERSION.major === '16' && Number(VERSION.minor) >= 2) {
if ((VERSION.major === '16' && Number(VERSION.minor) >= 2) || Number(VERSION.major) > 16) {
// 16.2+
IndexHtmlWebpackPlugin = require('@angular-devkit/build-angular/src/tools/webpack/plugins/index-html-webpack-plugin').IndexHtmlWebpackPlugin;
} else {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/ng-compat/build-angular/webpack/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { VERSION } from '@angular/cli';

type configFn = (wco: any) => Promise<Configuration> | Configuration;
let configs: any;
if (VERSION.major === '16' && Number(VERSION.minor) >= 2) {
if ((VERSION.major === '16' && Number(VERSION.minor) >= 2) || Number(VERSION.major) > 16) {
// 16.2+
configs = require('@angular-devkit/build-angular/src/tools/webpack/configs');
} else {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/ng-compat/build-angular/webpack/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BrowserBuilderSchema } from '../browser-schema';

export let createWebpackLoggingCallback: (options: typeof BrowserBuilderSchema, logger: logging.LoggerApi) => WebpackLoggingCallback;

if (VERSION.major === '16' && Number(VERSION.minor) >= 2) {
if ((VERSION.major === '16' && Number(VERSION.minor) >= 2) || Number(VERSION.major) > 16) {
createWebpackLoggingCallback = require('@angular-devkit/build-angular/src/tools/webpack/utils/stats').createWebpackLoggingCallback;
} else {
createWebpackLoggingCallback = require('@angular-devkit/build-angular/src/webpack/utils/stats').createWebpackLoggingCallback;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/** *************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.

/** *************************************************************************************************
* APPLICATION IMPORTS
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/preview/preview/preview-app/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/zone-testing';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/preview/runtime/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Only load those if we are in the browser
if (typeof window !== 'undefined') {
require('./native-shim.js');
require('zone.js/dist/zone');
require('zone.js');
}
import { Injector, NgModuleRef, Type } from '@angular/core';
import { createCustomElement } from '@angular/elements';
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/preview/runtime/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
require('zone.js/dist/zone');
require('zone.js');
const i0 = require('@angular/core') as any;
import { BrowserModule } from '@angular/platform-browser';

Expand Down
3 changes: 2 additions & 1 deletion angular/envs/angular-env/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@angular/elements": "~16.2.0",
"@angular/platform-browser": "~16.2.0",
"@angular/platform-browser-dynamic": "~16.2.0",
"@jest/globals": "^29.3.1",
"@ngtools/webpack": "~16.2.0",
"@types/eslint": "^8.40.0",
"@types/jest": "^29.5.0",
Expand Down Expand Up @@ -56,7 +57,7 @@
"webpack": "5.81.0",
"webpack-dev-middleware": "6.0.2",
"webpack-dev-server": "4.13.3",
"zone.js": "~0.13.0"
"zone.js": "~0.14.0"
},
"peerDependencies": {
"rxjs": "^6.5.5 || ^7.4.0"
Expand Down
4 changes: 2 additions & 2 deletions angular/envs/angular-env/env.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
},
{
"name": "zone.js",
"version": "0.13.1",
"supportedRange": "0.13.1"
"version": "~0.14.0",
"supportedRange": "~0.14.0"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion angular/envs/angular-v12-env/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"webpack": "^5.37.0",
"webpack-dev-middleware": "5.1.0",
"webpack-dev-server": "4.3.1",
"zone.js": "~0.11.4"
"zone.js": "~0.14.0"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions angular/envs/angular-v12-env/env.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
},
{
"name": "zone.js",
"version": "~0.11.4",
"supportedRange": "~0.11.0"
"version": "~0.14.0",
"supportedRange": "~0.14.0"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion angular/envs/angular-v13-env/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"webpack": "5.60.0",
"webpack-dev-middleware": "5.2.1",
"webpack-dev-server": "4.4.0",
"zone.js": "~0.11.4"
"zone.js": "~0.14.0"
}
}
}
Expand Down
Loading

0 comments on commit 175ed14

Please sign in to comment.