Skip to content

Commit

Permalink
fix dependencies & webpack config, add integration app
Browse files Browse the repository at this point in the history
  • Loading branch information
ocombe committed Sep 24, 2024
1 parent 4fe7ffc commit 23240b6
Show file tree
Hide file tree
Showing 76 changed files with 996 additions and 93 deletions.
65 changes: 36 additions & 29 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,42 @@
"angular-env": {
"name": "angular-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-env"
},
"app-types/angular-app-type": {
"name": "app-types/angular-app-type",
"scope": "bitdev.angular",
"version": "6.0.4",
"version": "6.0.8",
"mainFile": "index.ts",
"rootDir": "angular/app-types/angular-app-type"
},
"dev-services/common": {
"name": "dev-services/common",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.5",
"mainFile": "index.ts",
"rootDir": "angular/devkit/common"
},
"dev-services/compiler/elements": {
"name": "dev-services/compiler/elements",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.5",
"mainFile": "index.ts",
"rootDir": "angular/devkit/compiler/elements"
},
"dev-services/compiler/multi-compiler": {
"name": "dev-services/compiler/multi-compiler",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.6",
"mainFile": "index.ts",
"rootDir": "angular/devkit/compiler/multi-compiler"
},
"dev-services/compiler/ng-packagr": {
"name": "dev-services/compiler/ng-packagr",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.6",
"mainFile": "index.ts",
"rootDir": "angular/devkit/compiler/ng-packagr"
},
Expand All @@ -61,7 +61,7 @@
"dev-services/ng-compat": {
"name": "dev-services/ng-compat",
"scope": "bitdev.angular",
"version": "3.0.2",
"version": "3.0.3",
"mainFile": "index.ts",
"rootDir": "angular/devkit/ng-compat"
},
Expand All @@ -75,7 +75,7 @@
"dev-services/preview/preview": {
"name": "dev-services/preview/preview",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.5",
"mainFile": "index.ts",
"rootDir": "angular/devkit/preview/preview"
},
Expand All @@ -96,7 +96,7 @@
"dev-services/webpack": {
"name": "dev-services/webpack",
"scope": "bitdev.angular",
"version": "6.0.2",
"version": "6.0.5",
"mainFile": "index.ts",
"rootDir": "angular/devkit/webpack"
},
Expand Down Expand Up @@ -250,135 +250,142 @@
"envs/angular-v13-env": {
"name": "envs/angular-v13-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v13-env"
},
"envs/angular-v14-env": {
"name": "envs/angular-v14-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v14-env"
},
"envs/angular-v15-env": {
"name": "envs/angular-v15-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v15-env"
},
"envs/angular-v16-env": {
"name": "envs/angular-v16-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v16-env"
},
"envs/angular-v17-env": {
"name": "envs/angular-v17-env",
"scope": "bitdev.angular",
"version": "5.0.5",
"version": "5.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v17-env"
},
"envs/angular-v18-env": {
"name": "envs/angular-v18-env",
"scope": "bitdev.angular",
"version": "1.0.5",
"version": "1.0.10",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v18-env"
},
"envs/base-env": {
"name": "envs/base-env",
"scope": "bitdev.angular",
"version": "6.0.4",
"version": "6.0.8",
"mainFile": "index.ts",
"rootDir": "angular/envs/base-env"
},
"examples/my-angular-env": {
"name": "examples/my-angular-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-env"
},
"examples/my-angular-v13-env": {
"name": "examples/my-angular-v13-env",
"scope": "bitdev.angular",
"version": "5.0.5",
"version": "5.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v13-env"
},
"examples/my-angular-v14-env": {
"name": "examples/my-angular-v14-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v14-env"
},
"examples/my-angular-v15-env": {
"name": "examples/my-angular-v15-env",
"scope": "bitdev.angular",
"version": "6.0.5",
"version": "6.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v15-env"
},
"examples/my-angular-v16-env": {
"name": "examples/my-angular-v16-env",
"scope": "bitdev.angular",
"version": "5.0.5",
"version": "5.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v16-env"
},
"examples/my-angular-v17-env": {
"name": "examples/my-angular-v17-env",
"scope": "bitdev.angular",
"version": "5.0.5",
"version": "5.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v17-env"
},
"examples/my-angular-v18-env": {
"name": "examples/my-angular-v18-env",
"scope": "bitdev.angular",
"version": "1.0.5",
"version": "1.0.10",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v18-env"
},
"integration/demo-app": {
"name": "integration/demo-app",
"scope": "bitdev.angular",
"version": "0.0.2",
"mainFile": "index.ts",
"rootDir": "angular/integration/demo-app"
},
"integration/demo-lib": {
"name": "integration/demo-lib",
"scope": "bitdev.angular",
"version": "0.0.2",
"version": "0.0.7",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib"
},
"integration/demo-lib-v15": {
"name": "integration/demo-lib-v15",
"scope": "bitdev.angular",
"version": "0.0.2",
"version": "0.0.7",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib-v15"
},
"integration/demo-lib-v16": {
"name": "integration/demo-lib-v16",
"scope": "bitdev.angular",
"version": "0.0.2",
"version": "0.0.7",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib-v16"
},
"integration/demo-lib-v17": {
"name": "integration/demo-lib-v17",
"scope": "bitdev.angular",
"version": "0.0.2",
"version": "0.0.7",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib-v17"
},
"integration/demo-lib-v18": {
"name": "integration/demo-lib-v18",
"scope": "bitdev.angular",
"version": "0.0.2",
"version": "0.0.7",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib-v18"
},
"$schema-version": "17.0.0"
}
}
4 changes: 2 additions & 2 deletions angular/app-types/angular-app-type/angular.application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export class AngularApp implements Application {
return join(artifactsDir, this.name);
}

private getDevServerContext(context: AppContext, appRootPath: string): DevServerContext {
private getDevServerContext(context: AppContext, _appRootPath: string): DevServerContext {
// const ngEnvOptions = this.angularEnv.getNgEnvOptions();
return Object.assign(cloneDeep(context), {
entry: [],
rootPath: /*ngEnvOptions.devServer === 'vite' ? appRootPath : */'',
rootPath: /*ngEnvOptions.devServer === 'vite' ? _appRootPath : */'',
publicPath: `${ this.publicDir }/${ this.options.name }`,
title: this.options.name
});
Expand Down
2 changes: 1 addition & 1 deletion angular/app-types/angular-app-type/application.bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async function getNitroConfig(options: BuildApplicationOptions): Promise<NitroCo
const nitroDir = normalizePath(resolve(outputDir, 'ssr'));
const indexPath = getIndexInputFile(index!);

const prerenderedRoutes = prerender ? (await import(`${ outputDir }/prerendered-routes.json`)).default : undefined;
const prerenderedRoutes = prerender ? (await import(`${ outputDir }/prerendered-routes.json`, { assert: { type: 'json' }})).default : undefined;

return {
rootDir: workspaceRoot,
Expand Down
2 changes: 1 addition & 1 deletion angular/app-types/angular-app-type/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "app-types/angular-app-type",
"version": "6.0.4"
"version": "6.0.8"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/common/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "dev-services/common",
"version": "6.0.2"
"version": "6.0.5"
},
"propagate": false,
"extensions": {
Expand Down
36 changes: 30 additions & 6 deletions angular/devkit/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,34 +296,58 @@ export function getLoggerApi(logger: Logger) {
} as any;
}

export function addSafeResolve(path: string): string | undefined {
export function addSafeResolve(path: string, nodeModulesPaths?: string[]): string | undefined {
try {
return require.resolve(path);
} catch(_e) {
return require.resolve(path, { paths: nodeModulesPaths });
} catch (_e) {
if (nodeModulesPaths) {
try {
return addSafeResolve(path);
} catch (_e2) {
return undefined;
}
}
return undefined;
}
}

export function getWebpackAngularAliases() {
export function getWebpackAngularAliases(nodeModulesPaths?: string[]): { [key: string]: string } {
const aliases: { [key: string]: string } = {};

[
'@angular/build',
'@angular/core/schematics',
'@angular/core/rxjs-interop',
'@angular/core/primitives/signals',
'@angular/core/primitives/event-dispatch',
'@angular/core/testing',
'@angular/core',
'@angular/common/http',
'@angular/common/locales',
'@angular/common/testing',
'@angular/common',
'@angular/animations/browser',
'@angular/animations',
'@angular/cli',
'@angular/compiler',
'@angular/compiler-cli',
'@angular/forms',
'@angular/platform-browser/animations/async',
'@angular/platform-browser/animations',
'@angular/platform-browser/testing',
'@angular/platform-browser',
'@angular/platform-browser-dynamic/testing',
'@angular/platform-browser-dynamic',
'@angular/router'
'@angular/platform-server/init',
'@angular/platform-server/testing',
'@angular/platform-server',
'@angular/router/upgrade',
'@angular/router/testing',
'@angular/router',
'@angular/ssr/schematics',
'@angular/ssr'
].forEach((pkg) => {
const resolved = addSafeResolve(pkg);
const resolved = addSafeResolve(pkg, nodeModulesPaths);
if (resolved) {
aliases[pkg] = resolved;
}
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/compiler/elements/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "dev-services/compiler/elements",
"version": "6.0.2"
"version": "6.0.5"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/compiler/multi-compiler/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "dev-services/compiler/multi-compiler",
"version": "6.0.2"
"version": "6.0.6"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/compiler/ng-packagr/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "dev-services/compiler/ng-packagr",
"version": "6.0.2"
"version": "6.0.6"
},
"propagate": false,
"extensions": {
Expand Down
4 changes: 2 additions & 2 deletions angular/devkit/compiler/ng-packagr/ng-packagr.compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class NgPackagrCompiler implements Compiler {
const updatePackageJson: any = {
sideEffects: packageJson.sideEffects === 'true'
};
const props = ['main', 'metadata', 'module', 'es2015', 'es2020', 'es2022', 'esm2015', 'esm2020', 'esm2022', 'fesm2015', 'fesm2020', 'fesm2022', 'typings', 'types', 'node', 'default'];
const props = ['main', 'metadata', 'module', 'es2015', 'es2020', 'es2022', 'esm', 'esm2015', 'esm2020', 'esm2022', 'fesm2015', 'fesm2020', 'fesm2022', 'typings', 'types', 'node', 'default'];
props.forEach(prop => {
// Angular v13+ doesn't generate umd bundles anymore, so we don't want to update the main entry point
// as it will cause the component to fail to load with jest
Expand Down Expand Up @@ -219,7 +219,7 @@ export class NgPackagrCompiler implements Compiler {

if (allowedNonPeerDependencies.length) {
// eslint-disable-next-line no-console
console.warn(chalk.yellow(`\nWARNING: You have dependencies declared as "runtime dependencies" ("${ allowedNonPeerDependencies.join('", "') }"). In most cases Angular recommends using peer dependencies instead (see: https://github.com/ng-packagr/ng-packagr/blob/main/docs/dependencies.md).\n`));
console.warn(chalk.yellow(`\nWARNING: You have dependencies declared as "runtime dependencies" ("${ allowedNonPeerDependencies.join('", "') }"). In most cases Angular recommends using peer dependencies instead (see: https://github.com/ng-packagr/ng-packagr/blob/main/docs/dependencies.md).\nYou can change those to peer dependencies with "bit deps set <comp-id> --peer" (see: https://bit.dev/reference/dependencies/configuring-dependencies#peer-dependencies).\n`));
}

outputFileSync(ngPackageJsonPath, JSON.stringify(ngPackageJson, null, 2));
Expand Down
Loading

0 comments on commit 23240b6

Please sign in to comment.