@acoustic-content-sdk/schematics-feature-module 中文文档教程

发布于 4年前 浏览 13 更新于 3年前

npm

向应用程序添加功能模块的示意图。

Usage

该包解决了以下用例

Implement the ng-add schematics for feature modules

该模块公开了 addFeatureModuleToApplication 原理图,可用作 ng- 的通用实现添加原理图。 该实现会将功能模块的 ngModule 添加到主应用程序。

使用以下 ng-generate 示意图添加 ng - 添加 对您的功能模块的支持。

Add support for the ng-add schematics to a feature module

对于功能模块,添加以下命令以添加对 ng-add 原理图的支持:

ng generate @acoustic-content-sdk/schematics-feature-module.schematics --module MODULE_NAME

其中 MODULE_NAME 是您要添加的模块的名称。

此命令的结果是为模块注册 ng-add,因此可以通过以下方式将模块添加到另一个应用程序:

ng add YOUR_NPM_PACKAGE_NAME

Advanced Usecase

如果您的模块需要包含来自外部库的顶级模块,您可以使用语法 importPath#moduleName 添加这些模块,其中导入路径指向外部模块。 确保还将导入的模块添加到模块的 peerDependencies 中。

示例:

如果您的模块包含动画,您可能希望将 BrowserAnimationsModule 模块添加到应用程序,使用此说明符:@angular/platform-b​​rowser/animations#BrowserAnimationsModule

Documentation

API Documentation

Home > @acoustic-content-sdk/schematics-feature-module

schematics-feature-module package

向应用程序添加功能模块的示意图。

Functions

FunctionDescription
addFeatureModuleToApplication(options)Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved.
generateFeatureModuleSchematic(options)Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved.

Interfaces

InterfaceDescription
AddFeatureModuleToApplicationSchemaDefinition of the input parameters for the schematic
GenerateFeatureModuleSchema

Variables

VariableDescription
VERSIONVersion and build number of the package

Home > @acoustic-content-sdk/schematics-feature-module > addFeatureModuleToApplication

addFeatureModuleToApplication() function

向应用程序添加功能模块。 功能模块被定义为输入选项的一部分。 原理图填充找到正确的应用程序模块,然后将功能模块导入到应用程序模块中。

该命令被建模,因此可以从功能模块中引用它,而无需涉及任何额外的编码。

签名:

export declare function addFeatureModuleToApplication(options: AddFeatureModuleToApplicationSchema): Rule;

Parameters

ParameterTypeDescription
optionsAddFeatureModuleToApplicationSchemathe schematics object used to describe the feature module

返回:

规则

执行转换的原理图规则

主页 > @acoustic-content-sdk/schematics-feature-module > generateFeatureModuleSchematic

generateFeatureModuleSchematic() function

向应用程序添加功能模块。 功能模块被定义为输入选项的一部分。 原理图填充找到正确的应用程序模块,然后将功能模块导入到应用程序模块中。

该命令被建模,因此可以从功能模块中引用它,而无需涉及任何额外的编码。

签名:

export declare function generateFeatureModuleSchematic(options: GenerateFeatureModuleSchema): Rule;

Parameters

ParameterTypeDescription
optionsGenerateFeatureModuleSchemathe schematics object used to describe the feature module

返回:

规则

执行转换的原理图规则

主页 > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema

AddFeatureModuleToApplicationSchema interface

Definition of the input parameters for the schematic

Signature:

export interface AddFeatureModuleToApplicationSchema 

Properties

PropertyTypeDescription
importPathstringOptionally the import path of the module. If missing defaults to the project running the initial schematic.
modulestringName of the module, may be a comma separated list. Module identifiers have the following syntax: [path#]name[.forRoot()]. If path is missing it falls back to the import path given by this schema (or its default).
projectstringThe project name, falls back to the default project

首页 > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema

GenerateFeatureModuleSchema interface

Signature:

export interface GenerateFeatureModuleSchema 

Properties

PropertyTypeDescription
modulestringName of the module, may be a comma separated list
projectstringThe project name, falls back to the default project

Home > ; @acoustic-content-sdk/schematics-feature-module > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

首页 > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > importPath

AddFeatureModuleToApplicationSchema.importPath property

可选模块的导入路径。 如果缺少默认为运行初始原理图的项目。

Signature:

importPath?: string;

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > module 模块

AddFeatureModuleToApplicationSchema.module property

名称,可以是逗号分隔列表。 模块标识符具有以下语法:[path#]name[.forRoot()]。 如果 path 丢失,它会回退到此模式(或其默认值)给出的导入路径。

Signature:

module: string;

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > project

AddFeatureModuleToApplicationSchema.project property

The project name, falls back to the default project

Signature:

project?: string;

主页 > @acoustic-content-sdk/schematics-feature-module > 生成特征模块架构 > module

GenerateFeatureModuleSchema.module property

Name of the module, may be a comma separated list

Signature:

module: string;

主页 > @acoustic-content-sdk/schematics-feature-module > 生成特征模块架构 > project

GenerateFeatureModuleSchema.project property

项目名,回退为默认项目

Signature:

project?: string;

npm

Schematic to add a feature module to an application.

Usage

The package addresses the following usecaes

Implement the ng-add schematics for feature modules

The modules exposes the addFeatureModuleToApplication schematic that can be used as a general purpose implementation of the ng-add schematic. The implementation will add the ngModule of a feature module to the main application.

Use the following ng-generate schematic to add ng-add support to your feature module.

Add support for the ng-add schematics to a feature module

For a feature module add the following command to add support for the ng-add schematic:

ng generate @acoustic-content-sdk/schematics-feature-module.schematics --module MODULE_NAME

Where MODULE_NAME is the name of the module you'd like to have added.

The result of this command is the registration of an ng-add for the module, so the module can be added to another application via:

ng add YOUR_NPM_PACKAGE_NAME

Advanced Usecase

In case your module requires the inclusion of top level modules from external libraries you can add these modules using the syntax importPath#moduleName where the import path points to the external module. Make sure to also add the imported module to the peerDependencies of your module.

Example:

If your module contains animations you might want to add the BrowserAnimationsModule module to the app, using this specifier: @angular/platform-browser/animations#BrowserAnimationsModule.

Documentation

API Documentation

Home > @acoustic-content-sdk/schematics-feature-module

schematics-feature-module package

Schematic to add a feature module to an application.

Functions

FunctionDescription
addFeatureModuleToApplication(options)Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved.
generateFeatureModuleSchematic(options)Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved.

Interfaces

InterfaceDescription
AddFeatureModuleToApplicationSchemaDefinition of the input parameters for the schematic
GenerateFeatureModuleSchema

Variables

VariableDescription
VERSIONVersion and build number of the package

Home > @acoustic-content-sdk/schematics-feature-module > addFeatureModuleToApplication

addFeatureModuleToApplication() function

Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.

The command is modeled such that it can be referenced from a feature module without any additional coding involved.

Signature:

export declare function addFeatureModuleToApplication(options: AddFeatureModuleToApplicationSchema): Rule;

Parameters

ParameterTypeDescription
optionsAddFeatureModuleToApplicationSchemathe schematics object used to describe the feature module

Returns:

Rule

the schematics rule that executes the transform

Home > @acoustic-content-sdk/schematics-feature-module > generateFeatureModuleSchematic

generateFeatureModuleSchematic() function

Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.

The command is modeled such that it can be referenced from a feature module without any additional coding involved.

Signature:

export declare function generateFeatureModuleSchematic(options: GenerateFeatureModuleSchema): Rule;

Parameters

ParameterTypeDescription
optionsGenerateFeatureModuleSchemathe schematics object used to describe the feature module

Returns:

Rule

the schematics rule that executes the transform

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema

AddFeatureModuleToApplicationSchema interface

Definition of the input parameters for the schematic

Signature:

export interface AddFeatureModuleToApplicationSchema 

Properties

PropertyTypeDescription
importPathstringOptionally the import path of the module. If missing defaults to the project running the initial schematic.
modulestringName of the module, may be a comma separated list. Module identifiers have the following syntax: [path#]name[.forRoot()]. If path is missing it falls back to the import path given by this schema (or its default).
projectstringThe project name, falls back to the default project

Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema

GenerateFeatureModuleSchema interface

Signature:

export interface GenerateFeatureModuleSchema 

Properties

PropertyTypeDescription
modulestringName of the module, may be a comma separated list
projectstringThe project name, falls back to the default project

Home > @acoustic-content-sdk/schematics-feature-module > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > importPath

AddFeatureModuleToApplicationSchema.importPath property

Optionally the import path of the module. If missing defaults to the project running the initial schematic.

Signature:

importPath?: string;

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > module

AddFeatureModuleToApplicationSchema.module property

Name of the module, may be a comma separated list. Module identifiers have the following syntax: [path#]name[.forRoot()]. If path is missing it falls back to the import path given by this schema (or its default).

Signature:

module: string;

Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > project

AddFeatureModuleToApplicationSchema.project property

The project name, falls back to the default project

Signature:

project?: string;

Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema > module

GenerateFeatureModuleSchema.module property

Name of the module, may be a comma separated list

Signature:

module: string;

Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema > project

GenerateFeatureModuleSchema.project property

The project name, falls back to the default project

Signature:

project?: string;
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文