Primeiro commit do projeto Angular
This commit is contained in:
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
<% if(displayBlock){ if(style != 'sass') { %>:host {
|
||||
display: block;
|
||||
}
|
||||
<% } else { %>\:host
|
||||
display: block;
|
||||
<% }} %>
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import <% if(!exportDefault) { %>{ <% }%><%= classifiedName %> <% if(!exportDefault) {%>} <% }%>from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';
|
||||
|
||||
describe('<%= classifiedName %>', () => {
|
||||
let component: <%= classifiedName %>;
|
||||
let fixture: ComponentFixture<<%= classifiedName %>>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
<%= standalone ? 'imports' : 'declarations' %>: [<%= classifiedName %>]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(<%= classifiedName %>);
|
||||
component = fixture.componentInstance;
|
||||
<%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %>
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%>Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%> } from '@angular/core';
|
||||
|
||||
@Component({<% if(!skipSelector) {%>
|
||||
selector: '<%= selector %>',<%}%><% if(standalone) {%>
|
||||
imports: [],<%} else { %>
|
||||
standalone: false,<% }%><% if(inlineTemplate) { %>
|
||||
template: `
|
||||
<p>
|
||||
<%= dasherize(name) %> works!
|
||||
</p>
|
||||
`,<% } else { %>
|
||||
templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %><%= ngext %>.html',<% } if(inlineStyle) { %>
|
||||
styles: `<% if(displayBlock){ %>
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
<% } %>`,<% } else if (style !== 'none') { %>
|
||||
styleUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>',<% } %><% if(!!viewEncapsulation) { %>
|
||||
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } if (changeDetection !== 'Default') { %>
|
||||
changeDetection: ChangeDetectionStrategy.<%= changeDetection %>,<% } %>
|
||||
})
|
||||
export <% if(exportDefault) {%>default <%}%>class <%= classifiedName %> {
|
||||
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
<p><%= dasherize(name) %> works!</p>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { RuleFactory } from '@angular-devkit/schematics';
|
||||
import { Schema as ComponentOptions } from './schema';
|
||||
declare const componentSchematic: RuleFactory<ComponentOptions>;
|
||||
export default componentSchematic;
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
|
||||
const find_module_1 = require("../utility/find-module");
|
||||
const parse_name_1 = require("../utility/parse-name");
|
||||
const project_1 = require("../utility/project");
|
||||
const project_targets_1 = require("../utility/project-targets");
|
||||
const validation_1 = require("../utility/validation");
|
||||
const workspace_1 = require("../utility/workspace");
|
||||
const schema_1 = require("./schema");
|
||||
function buildSelector(options, projectPrefix) {
|
||||
let selector = schematics_1.strings.dasherize(options.name);
|
||||
if (options.prefix) {
|
||||
selector = `${options.prefix}-${selector}`;
|
||||
}
|
||||
else if (options.prefix === undefined && projectPrefix) {
|
||||
selector = `${projectPrefix}-${selector}`;
|
||||
}
|
||||
return selector;
|
||||
}
|
||||
const componentSchematic = (0, project_1.createProjectSchematic)((options, { project, tree }) => {
|
||||
if (options.path === undefined) {
|
||||
options.path = (0, workspace_1.buildDefaultPath)(project);
|
||||
}
|
||||
options.module = (0, find_module_1.findModuleFromOptions)(tree, options);
|
||||
// Schematic templates require a defined type value
|
||||
options.type ??= '';
|
||||
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
||||
options.name = parsedPath.name;
|
||||
options.path = parsedPath.path;
|
||||
options.selector =
|
||||
options.selector || buildSelector(options, (project && project.prefix) || '');
|
||||
(0, validation_1.validateHtmlSelector)(options.selector);
|
||||
const classifiedName = schematics_1.strings.classify(options.name) +
|
||||
(options.addTypeToClassName && options.type ? schematics_1.strings.classify(options.type) : '');
|
||||
(0, validation_1.validateClassName)(classifiedName);
|
||||
const zoneless = (0, project_targets_1.isZonelessApp)(project);
|
||||
const skipStyleFile = options.inlineStyle || options.style === schema_1.Style.None;
|
||||
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
||||
options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
|
||||
skipStyleFile ? (0, schematics_1.filter)((path) => !path.endsWith('.__style__.template')) : (0, schematics_1.noop)(),
|
||||
options.inlineTemplate ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) : (0, schematics_1.noop)(),
|
||||
(0, schematics_1.applyTemplates)({
|
||||
...schematics_1.strings,
|
||||
'if-flat': (s) => (options.flat ? '' : s),
|
||||
'ngext': options.ngHtml ? '.ng' : '',
|
||||
...options,
|
||||
// Add a new variable for the classified name, conditionally including the type
|
||||
classifiedName,
|
||||
zoneless,
|
||||
}),
|
||||
!options.type
|
||||
? (0, schematics_1.forEach)(((file) => {
|
||||
return file.path.includes('..')
|
||||
? {
|
||||
content: file.content,
|
||||
path: file.path.replace('..', '.'),
|
||||
}
|
||||
: file;
|
||||
}))
|
||||
: (0, schematics_1.noop)(),
|
||||
(0, schematics_1.move)(parsedPath.path),
|
||||
]);
|
||||
return (0, schematics_1.chain)([
|
||||
(0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
|
||||
type: 'component',
|
||||
...options,
|
||||
}),
|
||||
(0, schematics_1.mergeWith)(templateSource),
|
||||
]);
|
||||
});
|
||||
exports.default = componentSchematic;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,2DAaoC;AACpC,0FAAmF;AACnF,wDAA+D;AAC/D,sDAAkD;AAClD,gDAA4D;AAC5D,gEAA2D;AAC3D,sDAAgF;AAChF,oDAAwD;AACxD,qCAA6D;AAE7D,SAAS,aAAa,CAAC,OAAyB,EAAE,aAAqB;IACrE,IAAI,QAAQ,GAAG,oBAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,QAAQ,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;IAC7C,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;QACzD,QAAQ,GAAG,GAAG,aAAa,IAAI,QAAQ,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,kBAAkB,GAAkC,IAAA,gCAAsB,EAC9E,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,G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EAAC;QACX,IAAA,uDAAwB,EAAC;YACvB,IAAI,EAAE,WAAW;YACjB,GAAG,OAAO;SACX,CAAC;QACF,IAAA,sBAAS,EAAC,cAAc,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* Creates a new Angular component. Components are the basic building blocks of Angular
|
||||
* applications. Each component consists of a TypeScript class, an HTML template, and an
|
||||
* optional CSS stylesheet. Use this schematic to generate a new component in your project.
|
||||
*/
|
||||
export type Schema = {
|
||||
/**
|
||||
* When true, the 'type' option will be appended to the generated class name. When false,
|
||||
* only the file name will include the type.
|
||||
*/
|
||||
addTypeToClassName?: boolean;
|
||||
/**
|
||||
* Configures the change detection strategy for the component.
|
||||
*/
|
||||
changeDetection?: ChangeDetection;
|
||||
/**
|
||||
* Adds `:host { display: block; }` to the component's stylesheet, ensuring the component
|
||||
* renders as a block-level element. This is useful for layout purposes.
|
||||
*/
|
||||
displayBlock?: boolean;
|
||||
/**
|
||||
* Automatically export the component from the specified NgModule, making it accessible to
|
||||
* other modules in the application.
|
||||
*/
|
||||
export?: boolean;
|
||||
/**
|
||||
* Use a default export for the component in its TypeScript file instead of a named export.
|
||||
*/
|
||||
exportDefault?: boolean;
|
||||
/**
|
||||
* Create the component files directly in the project's `src/app` directory instead of
|
||||
* creating a new folder for them.
|
||||
*/
|
||||
flat?: boolean;
|
||||
/**
|
||||
* Include the component's styles directly in the `component.ts` file. By default, a
|
||||
* separate stylesheet file (e.g., `my-component.css`) is created.
|
||||
*/
|
||||
inlineStyle?: boolean;
|
||||
/**
|
||||
* Include the component's HTML template directly in the `component.ts` file. By default, a
|
||||
* separate template file (e.g., `my-component.html`) is created.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Specify the NgModule where the component should be declared. If not provided, the CLI
|
||||
* will attempt to find the closest NgModule in the component's path.
|
||||
*/
|
||||
module?: string;
|
||||
/**
|
||||
* The name for the new component. This will be used to create the component's class,
|
||||
* template, and stylesheet files. For example, if you provide `my-component`, the files
|
||||
* will be named `my-component.ts`, `my-component.html`, and `my-component.css`.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Generate component template files with an '.ng.html' file extension instead of '.html'.
|
||||
*/
|
||||
ngHtml?: boolean;
|
||||
/**
|
||||
* The path where the component files should be created, relative to the current workspace.
|
||||
* If not provided, a folder with the same name as the component will be created in the
|
||||
* project's `src/app` directory.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* A prefix to be added to the component's selector. For example, if the prefix is `app` and
|
||||
* the component name is `my-component`, the selector will be `app-my-component`.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* The name of the project where the component should be added. If not specified, the CLI
|
||||
* will determine the project from the current directory.
|
||||
*/
|
||||
project: string;
|
||||
/**
|
||||
* The HTML selector to use for this component. If not provided, a selector will be
|
||||
* generated based on the component name (e.g., `app-my-component`).
|
||||
*/
|
||||
selector?: string;
|
||||
/**
|
||||
* Do not automatically import the new component into its closest NgModule.
|
||||
*/
|
||||
skipImport?: boolean;
|
||||
/**
|
||||
* Skip the generation of an HTML selector for the component.
|
||||
*/
|
||||
skipSelector?: boolean;
|
||||
/**
|
||||
* Skip the generation of unit test files `spec.ts`.
|
||||
*/
|
||||
skipTests?: boolean;
|
||||
/**
|
||||
* Generate a standalone component. Standalone components are self-contained and don't need
|
||||
* to be declared in an NgModule. They can be used independently or imported directly into
|
||||
* other standalone components.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* Specify the type of stylesheet to be created for the component, or `none` to skip
|
||||
* creating a stylesheet.
|
||||
*/
|
||||
style?: Style;
|
||||
/**
|
||||
* Append a custom type to the component's filename. For example, if you set the type to
|
||||
* `container`, the file will be named `my-component.container.ts`.
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* Sets the view encapsulation mode for the component. This determines how the component's
|
||||
* styles are scoped and applied.
|
||||
*/
|
||||
viewEncapsulation?: ViewEncapsulation;
|
||||
};
|
||||
/**
|
||||
* Configures the change detection strategy for the component.
|
||||
*/
|
||||
export declare enum ChangeDetection {
|
||||
Default = "Default",
|
||||
OnPush = "OnPush"
|
||||
}
|
||||
/**
|
||||
* Specify the type of stylesheet to be created for the component, or `none` to skip
|
||||
* creating a stylesheet.
|
||||
*/
|
||||
export declare enum Style {
|
||||
Css = "css",
|
||||
Less = "less",
|
||||
None = "none",
|
||||
Sass = "sass",
|
||||
Scss = "scss"
|
||||
}
|
||||
/**
|
||||
* Sets the view encapsulation mode for the component. This determines how the component's
|
||||
* styles are scoped and applied.
|
||||
*/
|
||||
export declare enum ViewEncapsulation {
|
||||
Emulated = "Emulated",
|
||||
None = "None",
|
||||
ShadowDom = "ShadowDom"
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
||||
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ViewEncapsulation = exports.Style = exports.ChangeDetection = void 0;
|
||||
/**
|
||||
* Configures the change detection strategy for the component.
|
||||
*/
|
||||
var ChangeDetection;
|
||||
(function (ChangeDetection) {
|
||||
ChangeDetection["Default"] = "Default";
|
||||
ChangeDetection["OnPush"] = "OnPush";
|
||||
})(ChangeDetection || (exports.ChangeDetection = ChangeDetection = {}));
|
||||
/**
|
||||
* Specify the type of stylesheet to be created for the component, or `none` to skip
|
||||
* creating a stylesheet.
|
||||
*/
|
||||
var Style;
|
||||
(function (Style) {
|
||||
Style["Css"] = "css";
|
||||
Style["Less"] = "less";
|
||||
Style["None"] = "none";
|
||||
Style["Sass"] = "sass";
|
||||
Style["Scss"] = "scss";
|
||||
})(Style || (exports.Style = Style = {}));
|
||||
/**
|
||||
* Sets the view encapsulation mode for the component. This determines how the component's
|
||||
* styles are scoped and applied.
|
||||
*/
|
||||
var ViewEncapsulation;
|
||||
(function (ViewEncapsulation) {
|
||||
ViewEncapsulation["Emulated"] = "Emulated";
|
||||
ViewEncapsulation["None"] = "None";
|
||||
ViewEncapsulation["ShadowDom"] = "ShadowDom";
|
||||
})(ViewEncapsulation || (exports.ViewEncapsulation = ViewEncapsulation = {}));
|
||||
//# sourceMappingURL=schema.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";AACA,mFAAmF;AACnF,oFAAoF;;;AAqHpF;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACrB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAED;;;GAGG;AACH,IAAY,KAMX;AAND,WAAY,KAAK;IACb,oBAAW,CAAA;IACX,sBAAa,CAAA;IACb,sBAAa,CAAA;IACb,sBAAa,CAAA;IACb,sBAAa,CAAA;AACjB,CAAC,EANW,KAAK,qBAAL,KAAK,QAMhB;AAED;;;GAGG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,0CAAqB,CAAA;IACrB,kCAAa,CAAA;IACb,4CAAuB,CAAA;AAC3B,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "SchematicsAngularComponent",
|
||||
"title": "Angular Component Options Schema",
|
||||
"type": "object",
|
||||
"description": "Creates a new Angular component. Components are the basic building blocks of Angular applications. Each component consists of a TypeScript class, an HTML template, and an optional CSS stylesheet. Use this schematic to generate a new component in your project.",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"format": "path",
|
||||
"$default": {
|
||||
"$source": "workingDirectory"
|
||||
},
|
||||
"description": "The path where the component files should be created, relative to the current workspace. If not provided, a folder with the same name as the component will be created in the project's `src/app` directory.",
|
||||
"visible": false
|
||||
},
|
||||
"project": {
|
||||
"type": "string",
|
||||
"description": "The name of the project where the component should be added. If not specified, the CLI will determine the project from the current directory.",
|
||||
"$default": {
|
||||
"$source": "projectName"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name for the new component. This will be used to create the component's class, template, and stylesheet files. For example, if you provide `my-component`, the files will be named `my-component.ts`, `my-component.html`, and `my-component.css`.",
|
||||
"$default": {
|
||||
"$source": "argv",
|
||||
"index": 0
|
||||
},
|
||||
"x-prompt": "What name would you like to use for the component?"
|
||||
},
|
||||
"displayBlock": {
|
||||
"description": "Adds `:host { display: block; }` to the component's stylesheet, ensuring the component renders as a block-level element. This is useful for layout purposes.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "b"
|
||||
},
|
||||
"inlineStyle": {
|
||||
"description": "Include the component's styles directly in the `component.ts` file. By default, a separate stylesheet file (e.g., `my-component.css`) is created.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "s",
|
||||
"x-user-analytics": "ep.ng_inline_style"
|
||||
},
|
||||
"inlineTemplate": {
|
||||
"description": "Include the component's HTML template directly in the `component.ts` file. By default, a separate template file (e.g., `my-component.html`) is created.",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"alias": "t",
|
||||
"x-user-analytics": "ep.ng_inline_template"
|
||||
},
|
||||
"standalone": {
|
||||
"description": "Generate a standalone component. Standalone components are self-contained and don't need to be declared in an NgModule. They can be used independently or imported directly into other standalone components.",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-user-analytics": "ep.ng_standalone"
|
||||
},
|
||||
"viewEncapsulation": {
|
||||
"description": "Sets the view encapsulation mode for the component. This determines how the component's styles are scoped and applied.",
|
||||
"enum": ["Emulated", "None", "ShadowDom"],
|
||||
"type": "string",
|
||||
"alias": "v"
|
||||
},
|
||||
"changeDetection": {
|
||||
"description": "Configures the change detection strategy for the component.",
|
||||
"enum": ["Default", "OnPush"],
|
||||
"type": "string",
|
||||
"default": "Default",
|
||||
"alias": "c"
|
||||
},
|
||||
"prefix": {
|
||||
"type": "string",
|
||||
"description": "A prefix to be added to the component's selector. For example, if the prefix is `app` and the component name is `my-component`, the selector will be `app-my-component`.",
|
||||
"alias": "p",
|
||||
"oneOf": [
|
||||
{
|
||||
"maxLength": 0
|
||||
},
|
||||
{
|
||||
"minLength": 1,
|
||||
"format": "html-selector"
|
||||
}
|
||||
]
|
||||
},
|
||||
"style": {
|
||||
"description": "Specify the type of stylesheet to be created for the component, or `none` to skip creating a stylesheet.",
|
||||
"type": "string",
|
||||
"default": "css",
|
||||
"enum": ["css", "scss", "sass", "less", "none"],
|
||||
"x-user-analytics": "ep.ng_style"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Append a custom type to the component's filename. For example, if you set the type to `container`, the file will be named `my-component.container.ts`."
|
||||
},
|
||||
"addTypeToClassName": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "When true, the 'type' option will be appended to the generated class name. When false, only the file name will include the type."
|
||||
},
|
||||
"skipTests": {
|
||||
"type": "boolean",
|
||||
"description": "Skip the generation of unit test files `spec.ts`.",
|
||||
"default": false
|
||||
},
|
||||
"flat": {
|
||||
"type": "boolean",
|
||||
"description": "Create the component files directly in the project's `src/app` directory instead of creating a new folder for them.",
|
||||
"default": false
|
||||
},
|
||||
"skipImport": {
|
||||
"type": "boolean",
|
||||
"description": "Do not automatically import the new component into its closest NgModule.",
|
||||
"default": false
|
||||
},
|
||||
"selector": {
|
||||
"type": "string",
|
||||
"format": "html-selector",
|
||||
"description": "The HTML selector to use for this component. If not provided, a selector will be generated based on the component name (e.g., `app-my-component`)."
|
||||
},
|
||||
"skipSelector": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Skip the generation of an HTML selector for the component."
|
||||
},
|
||||
"module": {
|
||||
"type": "string",
|
||||
"description": "Specify the NgModule where the component should be declared. If not provided, the CLI will attempt to find the closest NgModule in the component's path.",
|
||||
"alias": "m"
|
||||
},
|
||||
"export": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Automatically export the component from the specified NgModule, making it accessible to other modules in the application."
|
||||
},
|
||||
"exportDefault": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Use a default export for the component in its TypeScript file instead of a named export."
|
||||
},
|
||||
"ngHtml": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Generate component template files with an '.ng.html' file extension instead of '.html'."
|
||||
}
|
||||
},
|
||||
"required": ["name", "project"]
|
||||
}
|
||||
Reference in New Issue
Block a user