Skip to content

Commit

Permalink
fix: warn instead of throw when cannot find component
Browse files Browse the repository at this point in the history
  • Loading branch information
ocombe committed Nov 14, 2024
1 parent c4f4ad9 commit ee8657f
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 102 deletions.
70 changes: 42 additions & 28 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.11",
"version": "6.0.13",
"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.9",
"version": "6.0.11",
"mainFile": "index.ts",
"rootDir": "angular/app-types/angular-app-type"
},
"dev-services/common": {
"name": "dev-services/common",
"scope": "bitdev.angular",
"version": "6.0.6",
"version": "6.0.8",
"mainFile": "index.ts",
"rootDir": "angular/devkit/common"
},
"dev-services/compiler/elements": {
"name": "dev-services/compiler/elements",
"scope": "bitdev.angular",
"version": "6.0.6",
"version": "6.0.8",
"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.7",
"version": "6.0.9",
"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.7",
"version": "6.0.9",
"mainFile": "index.ts",
"rootDir": "angular/devkit/compiler/ng-packagr"
},
Expand Down Expand Up @@ -75,7 +75,7 @@
"dev-services/preview/preview": {
"name": "dev-services/preview/preview",
"scope": "bitdev.angular",
"version": "6.0.6",
"version": "6.0.8",
"mainFile": "index.ts",
"rootDir": "angular/devkit/preview/preview"
},
Expand All @@ -96,149 +96,163 @@
"dev-services/webpack": {
"name": "dev-services/webpack",
"scope": "bitdev.angular",
"version": "6.0.6",
"version": "6.0.8",
"mainFile": "index.ts",
"rootDir": "angular/devkit/webpack"
},
"envs/angular-v13-env": {
"name": "envs/angular-v13-env",
"scope": "bitdev.angular",
"version": "6.0.11",
"version": "6.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v13-env"
},
"envs/angular-v14-env": {
"name": "envs/angular-v14-env",
"scope": "bitdev.angular",
"version": "6.0.11",
"version": "6.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v14-env"
},
"envs/angular-v15-env": {
"name": "envs/angular-v15-env",
"scope": "bitdev.angular",
"version": "6.0.11",
"version": "6.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v15-env"
},
"envs/angular-v16-env": {
"name": "envs/angular-v16-env",
"scope": "bitdev.angular",
"version": "6.0.11",
"version": "6.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v16-env"
},
"envs/angular-v17-env": {
"name": "envs/angular-v17-env",
"scope": "bitdev.angular",
"version": "5.0.11",
"version": "5.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v17-env"
},
"envs/angular-v18-env": {
"name": "envs/angular-v18-env",
"scope": "bitdev.angular",
"version": "1.0.11",
"version": "1.0.13",
"mainFile": "index.ts",
"rootDir": "angular/envs/angular-v18-env"
},
"envs/base-env": {
"name": "envs/base-env",
"scope": "bitdev.angular",
"version": "6.0.9",
"version": "6.0.11",
"mainFile": "index.ts",
"rootDir": "angular/envs/base-env"
},
"examples/my-angular-env": {
"name": "examples/my-angular-env",
"scope": "bitdev.angular",
"version": "6.0.11",
"version": "6.0.13",
"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.11",
"version": "5.0.13",
"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.11",
"version": "6.0.13",
"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.11",
"version": "6.0.13",
"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.11",
"version": "5.0.13",
"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.11",
"version": "5.0.13",
"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.11",
"version": "1.0.13",
"mainFile": "index.ts",
"rootDir": "angular/examples/my-angular-v18-env"
},
"integration/demo-app": {
"name": "integration/demo-app",
"scope": "bitdev.angular",
"version": "0.0.3",
"version": "0.0.5",
"mainFile": "index.ts",
"rootDir": "angular/integration/demo-app"
},
"integration/demo-lib": {
"name": "integration/demo-lib",
"scope": "bitdev.angular",
"version": "0.0.8",
"version": "0.0.10",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib"
},
"integration/demo-lib-v15": {
"name": "integration/demo-lib-v15",
"scope": "bitdev.angular",
"version": "0.0.8",
"version": "0.0.10",
"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.8",
"version": "0.0.10",
"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.8",
"version": "0.0.10",
"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.8",
"version": "0.0.10",
"mainFile": "public-api.ts",
"rootDir": "angular/integration/demo-lib-v18"
},
"templates/generators": {
"name": "templates/generators",
"scope": "bitdev.angular",
"version": "6.0.2",
"mainFile": "index.ts",
"rootDir": "angular/templates/generators"
},
"templates/starters": {
"name": "templates/starters",
"scope": "bitdev.angular",
"version": "6.0.2",
"mainFile": "index.ts",
"rootDir": "angular/templates/starters"
},
"$schema-version": "17.0.0"
}
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.9"
"version": "6.0.11"
},
"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.6"
"version": "6.0.8"
},
"propagate": false,
"extensions": {
Expand Down
58 changes: 30 additions & 28 deletions angular/devkit/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,41 +231,43 @@ export async function writeTsconfig(
}

// get the list of files for existing component compositions to include in the compilation
components.forEach((component: Component) => {
// eslint-disable-next-line no-restricted-syntax
for (const component of components) {
// we only want angular components
if (component.config.main === 'public-api.ts') {
let outputPath: string;

const isApp = componentIsApp(component, application);
if (isApp) {
return;
}
if (isBuildContext(context)) {
const capsules = context.capsuleNetwork.graphCapsules;
const capsule = capsules.getCapsule(component.id);
if (!capsule) {
throw new Error(`No capsule found for ${component.id} in network graph`);
if (!isApp) {
if (isBuildContext(context)) {
// eslint-disable-next-line no-await-in-loop
const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);
if (!capsule) {
// eslint-disable-next-line no-console
console.warn(`No capsule found for ${component.id} in the network graph`);
// eslint-disable-next-line no-continue
continue;
}
outputPath = normalizePath(capsule.path);
} else {
outputPath = normalizePath(workspace?.componentDir(component.id, {
ignoreVersion: true
}) || '');
}
outputPath = normalizePath(capsule.path);
} else {
outputPath = normalizePath(workspace?.componentDir(component.id, {
ignoreVersion: true
}) || '');
// map the package names to the workspace component paths for typescript in case a package references another local package
const pkgName = pkg.getPackageName(component);
tsPaths[pkgName] = [`${outputPath}/public-api.ts`];
tsPaths[`${pkgName}/*`] = [`${outputPath}/*`];

includePaths.add(outputPath);

// get the list of spec patterns
const devPatterns: string[] = devFilesMain.getDevPatterns(component, TesterAspect.id);
devPatterns.forEach(specPattern => {
excludePaths.add(posix.join(outputPath, specPattern));
});
}
// map the package names to the workspace component paths for typescript in case a package references another local package
const pkgName = pkg.getPackageName(component);
tsPaths[pkgName] = [`${outputPath}/public-api.ts`];
tsPaths[`${pkgName}/*`] = [`${outputPath}/*`];

includePaths.add(outputPath);

// get the list of spec patterns
const devPatterns: string[] = devFilesMain.getDevPatterns(component, TesterAspect.id);
devPatterns.forEach(specPattern => {
excludePaths.add(posix.join(outputPath, specPattern));
});
}
});
}

const pAppPath = normalizePath(rootPath);
const tsConfigAppPath = tsConfigPath ?? join(rootPath, 'tsconfig.app.json');
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.6"
"version": "6.0.8"
},
"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.7"
"version": "6.0.9"
},
"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.7"
"version": "6.0.9"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/preview/preview/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/preview/preview",
"version": "6.0.6"
"version": "6.0.8"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/devkit/webpack/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/webpack",
"version": "6.0.6"
"version": "6.0.8"
},
"propagate": false,
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion angular/envs/angular-env/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "angular-env",
"version": "6.0.11"
"version": "6.0.13"
},
"propagate": false,
"extensions": {
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 @@ -2,7 +2,7 @@
"componentId": {
"scope": "bitdev.angular",
"name": "envs/angular-v13-env",
"version": "6.0.11"
"version": "6.0.13"
},
"propagate": false,
"extensions": {
Expand Down
Loading

0 comments on commit ee8657f

Please sign in to comment.