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 1cb59bc
Show file tree
Hide file tree
Showing 80 changed files with 2,015 additions and 275 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
157 changes: 127 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
- name: Install dependencies
run: bit install --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 @@ -98,18 +104,99 @@ jobs:
name: debug-log
path: $HOME/Library/Caches/Bit/logs

# Test angular-v16
v16:
# Test angular-v17
v17:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
image: bitsrc/stable:latest
steps:
- uses: teambit/[email protected]
- 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: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}
name: debug-log
path: $HOME/Library/Caches/Bit/logs

# Test angular-v16
v16:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: bitsrc/stable:latest
steps:
- uses: actions/checkout@v3

- name: Keep v16
Expand All @@ -127,6 +214,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 @@ -189,13 +282,8 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
image: bitsrc/stable:latest
steps:
- uses: teambit/[email protected]
with:
name: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}

- uses: actions/checkout@v3

- name: Keep v15
Expand All @@ -213,6 +301,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 @@ -274,13 +368,8 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
image: bitsrc/stable:latest
steps:
- uses: teambit/[email protected]
with:
name: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}

- uses: actions/checkout@v3

- name: Keep v14
Expand All @@ -298,6 +387,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 @@ -359,13 +454,8 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
image: bitsrc/stable:latest
steps:
- uses: teambit/[email protected]
with:
name: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}

- uses: actions/checkout@v3

- name: Keep v13
Expand All @@ -383,6 +473,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 @@ -445,13 +541,8 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
container:
image: docker://bitcli/bit:latest
image: bitsrc/stable:latest
steps:
- uses: teambit/[email protected]
with:
name: angular-github-actions
BIT_TOKEN: ${{ env.BIT_TOKEN }}

- uses: actions/checkout@v3

- name: Keep v12
Expand All @@ -469,6 +560,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
Loading

0 comments on commit 1cb59bc

Please sign in to comment.