本文整理匯總了TypeScript中@schematics/angular/utility/ng-ast-utils.getAppModulePath函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getAppModulePath函數的具體用法?TypeScript getAppModulePath怎麽用?TypeScript getAppModulePath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了getAppModulePath函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: return
return (host: Tree) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const appModulePath = getAppModulePath(host, getProjectMainFile(project));
const moduleSource = getSourceFile(host, appModulePath);
const locale = getCompatibleLocal(options);
const localePrefix = locale.split('_')[ 0 ];
const recorder = host.beginUpdate(appModulePath);
const changes = [
insertImport(moduleSource, appModulePath, 'NZ_I18N',
'ng-zorro-antd'),
insertImport(moduleSource, appModulePath, locale,
'ng-zorro-antd'),
insertImport(moduleSource, appModulePath, 'registerLocaleData',
'@angular/common'),
insertImport(moduleSource, appModulePath, localePrefix,
`@angular/common/locales/${localePrefix}`, true),
registerLocaleData(moduleSource, appModulePath, localePrefix),
...insertI18nTokenProvide(moduleSource, appModulePath, locale)
];
changes.forEach((change) => {
if (change instanceof InsertChange) {
recorder.insertLeft(change.pos, change.toAdd);
}
});
host.commitUpdate(recorder);
return host;
};
示例2: return
return (host: Tree) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const appModulePath = getAppModulePath(host, getProjectMainFile(project));
if (options.animations) {
// In case the project explicitly uses the NoopAnimationsModule, we should print a warning
// message that makes the user aware of the fact that we won't automatically set up
// animations. If we would add the BrowserAnimationsModule while the NoopAnimationsModule
// is already configured, we would cause unexpected behavior and runtime exceptions.
if (hasNgModuleImport(host, appModulePath, noopAnimationsModuleName)) {
return console.warn(red(`Could not set up "${bold(browserAnimationsModuleName)}" ` +
`because "${bold(noopAnimationsModuleName)}" is already imported. Please manually ` +
`set up browser animations.`));
}
addModuleImportToRootModule(host, browserAnimationsModuleName,
'@angular/platform-browser/animations', project);
} else if (!hasNgModuleImport(host, appModulePath, browserAnimationsModuleName)) {
// Do not add the NoopAnimationsModule module if the project already explicitly uses
// the BrowserAnimationsModule.
addModuleImportToRootModule(host, noopAnimationsModuleName,
'@angular/platform-browser/animations', project);
}
return host;
};
示例3: return
return (host: Tree) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const appModulePath = getAppModulePath(host, getProjectMainFile(project));
for (const module in modulesMap) {
addModuleImportToApptModule(host, module, modulesMap[ module ],
project, appModulePath, options);
}
return host;
};
示例4: return
return (host: Tree) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const appModulePath = getAppModulePath(host, getProjectMainFile(project));
if (options.animations) {
if (hasNgModuleImport(host, appModulePath, noopAnimationsModuleName)) {
console.log();
return console.log(chalk.yellow(`Could not set up "${chalk.blue(browserAnimationsModuleName)}" ` +
`because "${chalk.blue(noopAnimationsModuleName)}" is already imported. Please manually ` +
`set up browser animations.`));
}
addModuleImportToRootModule(host, browserAnimationsModuleName,
animationsModulePath, project);
} else if (!hasNgModuleImport(host, appModulePath, browserAnimationsModuleName)) {
addModuleImportToRootModule(host, noopAnimationsModuleName,
animationsModulePath, project);
}
return host;
};
示例5: addModuleImportToRootModule
export function addModuleImportToRootModule(host: Tree, moduleName: string, src: string, project: WorkspaceProject) {
const modulePath = getAppModulePath(host, project.architect.build.options.main);
addModuleImportToModule(host, modulePath, moduleName, src);
}
示例6: addModuleImportToRootModule
export function addModuleImportToRootModule(host: Tree, moduleName: string, src: string,
project: WorkspaceProject) {
const modulePath = getAppModulePath(host, getProjectMainFile(project));
addModuleImportToModule(host, modulePath, moduleName, src);
}