Skip to content

Commit

Permalink
chore: remove angular v12 & ngcc
Browse files Browse the repository at this point in the history
  • Loading branch information
ocombe committed Oct 18, 2023
1 parent c1cca91 commit 2878e4c
Show file tree
Hide file tree
Showing 57 changed files with 11 additions and 1,648 deletions.
21 changes: 0 additions & 21 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@
"mainFile": "index.ts",
"rootDir": "angular/devkit/ng-compat"
},
"dev-services/ngcc": {
"name": "dev-services/ngcc",
"scope": "bitdev.angular",
"version": "1.0.0",
"mainFile": "index.ts",
"rootDir": "angular/devkit/ngcc"
},
"dev-services/preview/mounter": {
"name": "dev-services/preview/mounter",
"scope": "bitdev.angular",
Expand Down Expand Up @@ -109,13 +102,6 @@
"mainFile": "index.ts",
"rootDir": "angular/devkit/webpack"
},
"envs/angular-v12-env": {
"name": "envs/angular-v12-env",
"scope": "bitdev.angular",
"version": "1.0.1",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v12-env"
},
"envs/angular-v13-env": {
"name": "envs/angular-v13-env",
"scope": "bitdev.angular",
Expand Down Expand Up @@ -166,13 +152,6 @@
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-env"
},
"examples/my-angular-v12-env": {
"name": "examples/my-angular-v12-env",
"scope": "bitdev.angular",
"version": "1.0.1",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v12-env"
},
"examples/my-angular-v13-env": {
"name": "examples/my-angular-v13-env",
"scope": "bitdev.angular",
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,39 +234,3 @@ jobs:
with:
name: debug-log
path: $HOME/Library/Caches/Bit/logs


# Test angular-v12
v12:
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 v12
run: npm i [email protected] [email protected] && node scripts/keep-env.js --version=12

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

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

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

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

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

- name: Bit build
run: NODE_OPTIONS=--openssl-legacy-provider bit build --log

- uses: actions/upload-artifact@v3
with:
name: debug-log
path: $HOME/Library/Caches/Bit/logs
5 changes: 0 additions & 5 deletions angular/devkit/common/env-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ export type AngularEnvOptions = {
* This transforms compositions into Web Components and replaces the Angular bundler by the React bundler.
*/
useAngularElementsPreview?: boolean;

/**
* Whether ngcc should be run as part of postinstall / compile / build ...
*/
useNgcc?: boolean;
jestConfigPath: string;
jestModulePath: string;
ngPackagrModulePath: string;
Expand Down
32 changes: 0 additions & 32 deletions angular/devkit/compiler/elements/angular-elements.compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getNodeModulesPaths,
getWorkspace
} from '@bitdev/angular.dev-services.common';
import { NgccProcessor } from '@bitdev/angular.dev-services.ngcc';
import { ApplicationAspect, ApplicationMain } from '@teambit/application';
import {
ArtifactDefinition,
Expand Down Expand Up @@ -41,8 +40,6 @@ export class AngularElementsCompiler implements Compiler {

displayName = 'Angular elements compiler';

ngccProcessor?: NgccProcessor;

rollupCompiler: RollupCompiler;

private constructor(
Expand All @@ -59,21 +56,10 @@ export class AngularElementsCompiler implements Compiler {
private ngEnvOptions: AngularEnvOptions
) {
this.rollupCompiler = new RollupCompiler(this.tsCompilerOptions, this.logger);
if (this.ngEnvOptions.useNgcc) {
this.ngccProcessor = new NgccProcessor();
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async compositionsCompilation(component: Component, componentDir: string, outputDir: string, watch = false) {
// Process all node_modules folders (only works if the modules are hoisted)
if (this.ngEnvOptions.useNgcc) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < this.nodeModulesPaths.length; i++) {
// eslint-disable-next-line no-await-in-loop
await this.ngccProcessor?.process(this.nodeModulesPaths[i]);
}
}
// Build compositions with rollup
this.logger.console('\nBuilding compositions');
const timer = Timer.create();
Expand Down Expand Up @@ -108,15 +94,6 @@ Built Angular Compositions
if (isApp) {
return;
}
// if (params.initiator === CompilationInitiator.PreStart || params.initiator === CompilationInitiator.Start) {
// Process all node_modules folders (only works if the modules are hoisted)
if (this.ngEnvOptions.useNgcc) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < this.nodeModulesPaths.length; i++) {
// eslint-disable-next-line no-await-in-loop
await this.ngccProcessor?.process(this.nodeModulesPaths[i]);
}
}
// Build compositions
await this.compositionsCompilation(params.component, params.componentDir, params.outputDir, true);

Expand All @@ -140,15 +117,6 @@ Built Angular Compositions
const capsules = context.capsuleNetwork.seedersCapsules;
const componentsResults: ComponentResult[] = [];

// Process all node_modules folders (only works if the modules are hoisted)
if (this.ngEnvOptions.useNgcc) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < this.nodeModulesPaths.length; i++) {
// eslint-disable-next-line no-await-in-loop
await this.ngccProcessor?.process(this.nodeModulesPaths[i]);
}
}

// eslint-disable-next-line no-plusplus
for (let i = 0; i < context.components.length; i++) {
const component = context.components[i];
Expand Down
21 changes: 0 additions & 21 deletions angular/devkit/compiler/ng-packagr/ng-packagr.compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getNodeModulesPaths,
getWorkspace
} from '@bitdev/angular.dev-services.common';
import { NgccProcessor } from '@bitdev/angular.dev-services.ngcc';
import { ApplicationAspect, ApplicationMain } from '@teambit/application';
import {
ArtifactDefinition,
Expand Down Expand Up @@ -79,8 +78,6 @@ export class NgPackagrCompiler implements Compiler {

ngPackagr: NgPackagr;

ngccProcessor?: NgccProcessor;

private constructor(
ngPackagrPath: string,
private logger: Logger,
Expand All @@ -95,9 +92,6 @@ export class NgPackagrCompiler implements Compiler {
private nodeModulesPaths: string[] = [],
private ngEnvOptions: AngularEnvOptions
) {
if (this.ngEnvOptions.useNgcc) {
this.ngccProcessor = new NgccProcessor();
}
// eslint-disable-next-line global-require,import/no-dynamic-require
this.ngPackagr = require(ngPackagrPath).ngPackagr();

Expand Down Expand Up @@ -249,12 +243,6 @@ export class NgPackagrCompiler implements Compiler {
return;
}
if (params.initiator === CompilationInitiator.PreStart || params.initiator === CompilationInitiator.Start) {
// Process all node_modules folders (only works if the modules are hoisted)
if (this.ngEnvOptions.useNgcc) {
for (let i = 0; i < this.nodeModulesPaths.length; i++) {
await this.ngccProcessor?.process(this.nodeModulesPaths[i]);
}
}
return;
}
// recreate packageJson from component to make sure that its dependencies are updated with recent code changes
Expand All @@ -280,15 +268,6 @@ export class NgPackagrCompiler implements Compiler {
* used by `bit build`
*/
async build(context: BuildContext): Promise<BuiltTaskResult> {
// Process all node_modules folders (only works if the modules are hoisted)
if (this.ngEnvOptions.useNgcc) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < this.nodeModulesPaths.length; i++) {
// eslint-disable-next-line no-await-in-loop
await this.ngccProcessor?.process(this.nodeModulesPaths[i]);
}
}

let capsules = context.capsuleNetwork.seedersCapsules;
if (typeof capsules.toposort !== 'undefined') {
try {
Expand Down
19 changes: 0 additions & 19 deletions angular/devkit/ngcc/component.json

This file was deleted.

1 change: 0 additions & 1 deletion angular/devkit/ngcc/index.ts

This file was deleted.

125 changes: 0 additions & 125 deletions angular/devkit/ngcc/ngcc-processor.ts

This file was deleted.

4 changes: 0 additions & 4 deletions angular/devkit/ngcc/ngcc.docs.md

This file was deleted.

2 changes: 0 additions & 2 deletions angular/devkit/vite/plugins/index-file/strip-bom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

// TODO: cleanup this file, it's copied as is from Angular CLI.

// Strip BOM from file data.
// https://stackoverflow.com/questions/24356713
export function stripBom(data: string) {
Expand Down
1 change: 0 additions & 1 deletion angular/devkit/webpack/ng-webpack-bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export class NgWebpackBundler {
context: bundlerContext,
entryFiles: target.entries as string[],
logger,
useNgcc: !!options.ngEnvOptions.useNgcc,
// keep first argument to be false, to avoid issues when building apps
nodeModulesPaths: getNodeModulesPaths(false, isolator, workspace),
plugins,
Expand Down
1 change: 0 additions & 1 deletion angular/devkit/webpack/ng-webpack-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export class NgWebpackDevServer {
entryFiles: devServerContext.entry,
isApp,
logger,
useNgcc: !!options.ngEnvOptions.useNgcc,
nodeModulesPaths: getNodeModulesPaths(false, isolator, workspace),
plugins: [],
publicPath: devServerContext.publicPath,
Expand Down
Loading

0 comments on commit 2878e4c

Please sign in to comment.