Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): fix component export logic to handle internal modules and secondary entry points #10517

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/generated/packages/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
},
"export": {
"type": "boolean",
"description": "Specifies if the component should be exported in the declaring `NgModule`. Additionally, if the project is a library, the component will be exported from the project's entry point (normally `index.ts`).",
"description": "Specifies if the component should be exported in the declaring `NgModule`. Additionally, if the project is a library, the component will be exported from the project's entry point (normally `index.ts`) if the module it belongs to is also exported.",
"default": false
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`component Generator --flat should create the component correctly and export it 1`] = `
exports[`component Generator --flat should create the component correctly and export it in the entry point 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand All @@ -19,7 +19,7 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator --flat should create the component correctly and not export it 1`] = `
exports[`component Generator --flat should create the component correctly and not export it when "export=false" 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand All @@ -38,7 +38,7 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator --path should create the component correctly and export it 1`] = `
exports[`component Generator --path should create the component correctly and export it in the entry point 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand All @@ -57,7 +57,7 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator should create the component correctly and export it 1`] = `
exports[`component Generator secondary entry points should create the component correctly and export it in the entry point 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand All @@ -76,12 +76,12 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator should create the component correctly and export it 2`] = `
"
export * from \\"./lib/example/example.component\\";"
exports[`component Generator secondary entry points should create the component correctly and export it in the entry point 2`] = `
"export * from \\"./lib/secondary.module\\";
export * from \\"./lib/example/example.component\\";"
`;

exports[`component Generator should create the component correctly and not export it 1`] = `
exports[`component Generator should create the component correctly and export it in the entry point 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand All @@ -100,6 +100,11 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator should create the component correctly and export it in the entry point 2`] = `
"export * from \\"./lib/lib.module\\";
export * from \\"./lib/example/example.component\\";"
`;

exports[`component Generator should create the component correctly and not export it when "--skip-import=true" 1`] = `
"import { Component, OnInit } from '@angular/core';

Expand All @@ -119,7 +124,26 @@ export class ExampleComponent implements OnInit {
"
`;

exports[`component Generator should create the component correctly but not export it when no entry point exists 1`] = `
exports[`component Generator should create the component correctly and not export it when "export=false" 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
selector: 'example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
"
`;

exports[`component Generator should create the component correctly but not export it in the entry point when it does not exist 1`] = `
"import { Component, OnInit } from '@angular/core';

@Component({
Expand Down