Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(tree: Tree) => {
if (!options.builderModule) {
const workspacePrefix = options.prefix || getPrefix() || '';
const htmlElementList = [];
componentSymbols = [];
// parse component names to standard convention
const componentNames = options.components.split(',');
for (let component of componentNames) {
// using short name ("menu" for a component named "MenuComponent")
// convert to fully best practice name
const isShortName =
component.toLowerCase().indexOf('component') === -1;
let selector = `${workspacePrefix ? `${workspacePrefix}-` : ''}`;
if (isShortName) {
selector += component.toLowerCase();
} else {
const parts = component.toLowerCase().split('component');
selector += parts[0];
}
return (tree: Tree, context: SchematicContext) => {
const prefix = getPrefix();
return updateJsonInTree('tslint.json', json => {
json.rules = json.rules || {};
// remove forin rule as collides with LogService
delete json.rules['forin'];
// adjust console rules to work with LogService
json.rules['no-console'] = [true, 'debug', 'time', 'timeEnd', 'trace'];
json.rules['directive-selector'] = [
true,
'attribute',
prefix,
'camelCase'
];
json.rules['component-selector'] = [
true,
'element',
function indexContent(name: string) {
return `
<title>${getNpmScope()} ${name}</title>
<${getPrefix()}-root>
`;
}
(tree: Tree, context: SchematicContext) => {
const platformApp = options.name.replace('-', '.');
const directory = options.directory ? `${options.directory}/` : '';
const projects = {};
projects[`${options.name}`] = {
root: `apps/${directory}${options.name}/`,
sourceRoot: `apps/${directory}${options.name}/src`,
projectType: 'application',
prefix: getPrefix(),
architect: {
serve: {
builder: '@nrwl/workspace:run-commands',
options: {
commands: [
{
command: `yarn start.${platformApp}.preview`
}
]
},
configurations: {
ios: {
commands: [
{
command: `yarn start.${platformApp}.ios`
}
function appCmpHtml(name: string) {
return `<div class="p-x-20">
<${getPrefix()}-header title="${name}">
<h2>Nx</h2>
An open source toolkit for enterprise Angular applications. Nx is designed to help you create and build enterprise grade
Angular applications. It provides an opinionated approach to application project structure and patterns.
<h3>Quick Start & Documentation</h3>
<a href="https://nrwl.io/nx">Watch a 5-minute video on how to get started with Nx.</a>
<h1>{{'welcome' | translate}}!</h1>
<h3>Try things out</h3>
<a href="https://nstudio.io/xplat">Learn more about xplat.</a>
</div>`;
}
(tree: Tree, context: SchematicContext) => {
const directory = options.directory ? `${options.directory}/` : '';
const projects = {};
projects[`${options.name}`] = {
root: `apps/${directory}${options.name}/`,
sourceRoot: `apps/${directory}${options.name}/src`,
projectType: 'application',
prefix: getPrefix()
};
return updateWorkspace({ projects })(tree, context);
},
(tree: Tree) => {
function electronModule() {
return `import { NgModule } from '@angular/core';
import { ${stringUtils.classify(
getPrefix()
)}ElectronCoreModule } from '@${getNpmScope()}/${XplatHelpers.getXplatFoldername(
'electron',
'angular'
)}';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [AppModule, ${stringUtils.classify(getPrefix())}ElectronCoreModule],
bootstrap: [AppComponent]
})
export class AppElectronModule {}`;
}
function electronModule() {
return `import { NgModule } from '@angular/core';
import { ${stringUtils.classify(
getPrefix()
)}ElectronCoreModule } from '@${getNpmScope()}/${XplatHelpers.getXplatFoldername(
'electron',
'angular'
)}';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [AppModule, ${stringUtils.classify(getPrefix())}ElectronCoreModule],
bootstrap: [AppComponent]
})
export class AppElectronModule {}`;
}