Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function generateNgrxFilesFromTemplates(options: Schema) {
const name = options.name;
const moduleDir = path.dirname(options.module);
const excludeFacade = path => path.match(/^((?!facade).)*$/);
const templateSource = apply(url('./files'), [
!options.facade ? filter(excludeFacade) : noop(),
excludeUnnecessaryFiles(),
template({ ...options, tmpl: '', ...names(name) }),
move(moduleDir)
]);
return mergeWith(templateSource);
}
function mergeFiles(options: ApplicationOptions, from: string, to: string) {
return mergeWith(
apply(url(from), [
options.i18n ? noop() : filter(p => p.indexOf('i18n') === -1),
options.form ? noop() : filter(p => p.indexOf('json-schema') === -1),
template({
utils: strings,
...options,
dot: '.',
VERSION,
ZORROVERSION,
}),
move(to),
]),
);
}
function generateNgrxFilesFromTemplates(options: Schema) {
const name = options.name;
const moduleDir = path.dirname(options.module);
const excludeFacade = path => path.match(/^((?!facade).)*$/);
const templateSource = apply(
url(options.syntax === 'creators' ? './creator-files' : './files'),
[
!options.facade ? filter(excludeFacade) : noop(),
template({ ...options, tmpl: '', ...names(name) }),
move(moduleDir)
]
);
return mergeWith(templateSource);
}
export function renderTemplates(path: string, target: string, options: Options = {}): Rule {
return chain([
mergeWith(
apply(url(path), [
options.filter ? filter(options.filter) : noop(),
template({
...strings,
...(options.params ? options.params : {}),
}),
move(target),
]),
),
]);
}
function generate(options: ClassOptions): Source {
return apply(url(join('./files' as Path, options.language)), [
options.spec === 'true'
? noop()
: filter(path => !path.endsWith('.spec.ts')),
template({
...strings,
...options,
}),
move(options.path),
]);
}
export default function(options: DtLintingRuleOptions): Rule {
options.name = _createRuleName(options.name, options.alttext);
if (options.category) {
options.category = strings.dasherize(options.category);
}
const templateRules = options.alttext
? [
filter(_altTextFilterPredicate),
template({
...strings,
...options,
...{ squigglyLine: _squigglyLine(options.alttext) },
}),
move('src'),
]
: [template({ ...strings, ...options }), move('src')];
const templateSource = apply(url('./files'), templateRules);
const rules = [
mergeWith(templateSource),
_addLintingRuleToTslintJson(
options.name,
options.severity === 'warning',
BARISTA_EXAMPLES_TSLINT_CONFIG,
function generate(options: ControllerOptions) {
return apply(url(join('./files' as Path, options.language)), [
options.spec === 'true'
? noop()
: filter(path => !path.endsWith('.spec.ts')),
template({
...strings,
...options,
}),
move(options.path),
]);
}
function createApplicationFiles(options: NormalizedSchema): Rule {
return mergeWith(
apply(url(`./files/app`), [
template({
...names(options.name),
...options,
tmpl: '',
offsetFromRoot: offsetFromRoot(options.appProjectRoot)
}),
options.styledModule
? filter(file => !file.endsWith(`.${options.style}`))
: noop(),
options.unitTestRunner === 'none'
? filter(file => file !== `/src/app/${options.fileName}.spec.tsx`)
: noop(),
move(options.appProjectRoot)
])
);
}
])),
schematics_1.schematic('module', {
name: 'app',
commonModule: false,
flat: true,
routing: options.routing,
routingScope: 'Root',
sourceDir: options.directory + '/' + sourceDir,
spec: false,
}),
schematics_1.schematic('component', Object.assign({ name: 'app', selector: appRootSelector, sourceDir: options.directory + '/' + sourceDir, flat: true }, componentOptions)),
addBootstrapToNgModule(options.directory, sourceDir),
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./other-files'), [
componentOptions.inlineTemplate ? schematics_1.filter(path => !path.endsWith('.html')) : schematics_1.noop(),
!componentOptions.spec ? schematics_1.filter(path => !path.endsWith('.spec.ts')) : schematics_1.noop(),
!options.material ? schematics_1.filter(materialPathFilter) : schematics_1.noop(),
!options.ssr ? schematics_1.filter(ssrPathOtherFilter) : schematics_1.noop(),
schematics_1.template(Object.assign({ utils: stringUtils }, options, { selector: appRootSelector }, componentOptions)),
schematics_1.move(options.directory + '/' + sourceDir + '/app'),
]), schematics_1.MergeStrategy.Overwrite),
])(host, context);
};
}
function createFiles(options: NormalizedSchema): Rule {
return mergeWith(
apply(url(`./files/lib`), [
template({
...options,
...names(options.name),
tmpl: '',
offsetFromRoot: offsetFromRoot(options.projectRoot)
}),
move(options.projectRoot),
options.publishable
? noop()
: filter(file => !file.endsWith('package.json'))
])
);
}