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, context: SchematicContext) => {
const xplatFolderName = XplatHelpers.getXplatFoldername('web', 'angular');
if (tree.exists(`/xplat/${xplatFolderName}/scss/_index.scss`)) {
// may have already generated vanilla web support
return noop()(tree, context);
} else {
return branchAndMerge(
mergeWith(
apply(url(`./_scss_files`), [
template({
...(options as any),
...getDefaultTemplateOptions()
}),
move(`xplat/${xplatFolderName}/scss`)
])
)
)(tree, context);
}
},
(tree: Tree, context: SchematicContext) => {
// needs a function
`containers/${singular(parsedPath.name)}-copy`
);
options.name = parsedPath.name;
options.path = parsedPath.path;
options.selector = options.selector || buildSelector(options, project.prefix);
const templateSource = apply(url("./files"), [
template({
...stringUtils,
...(options as object)
} as any),
move(parsedPath.path)
]);
return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
host,
context
);
};
}
options.path = utils_1.getProjectPath(host, options);
const parsedPath = utils_1.parseName(options);
parsedPath.path = parsedPath.path.replace(`${options.dirName}`,
// TODO: the path to respond to the circumstances calling it
// - generating a feature with --withContentManagement
// - generating the list
// needs a function
`containers/${parsedPath.name}-list`);
options.name = parsedPath.name;
options.path = parsedPath.path;
options.selector = options.selector || buildSelector(options, project.prefix);
const templateSource = schematics_1.apply(schematics_1.url("./files"), [
schematics_1.template(Object.assign({}, utils_1.stringUtils, options)),
schematics_1.move(parsedPath.path)
]);
return schematics_1.chain([schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(templateSource)]))])(host, context);
};
}
`components/${singular(parsedPath.name)}-form/`
);
options.name = parsedPath.name;
options.path = parsedPath.path;
options.selector =
options.selector || buildSelector(options, project.prefix);
const templateSource = apply(url("./files"), [
template({
...stringUtils,
...(options as object)
} as any),
move(parsedPath.path)
]);
return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
host,
context
);
};
}
return wrapIntoFormat(() => {
const {options, templateSource, routingRules} = validateLibSchema(schema);
return chain([
branchAndMerge(chain([mergeWith(templateSource)])),
addLibToAngularCliJson(options), ...routingRules
]);
});
}
export default function(schema: Schema): Rule {
const { templateSource, routingRules } = validateLibSchema(schema);
return chain([
branchAndMerge(chain([mergeWith(templateSource)])),
...routingRules,
formatFiles(schema)
]);
}
function addAppFiles(options: ApplicationOptions, appPath: string, sample: string = ''): Rule {
sample = '';
const appname = getAppName(options, 'ionic');
return branchAndMerge(
mergeWith(apply(url(`./_${sample}files`), [
template({
...options as any,
appname,
utils: stringUtils,
npmScope: getNpmScope(),
prefix: getPrefix(),
dot: '.',
}),
move(`apps/${appPath}`)
]))
);
}
export function main(options: SubAppOptions): Rule {
const appName = getAppNameFromPackageJson();
options = transform(options);
return chain([
updateTsConfig(),
updatePackageJson(options, appName),
(tree, context) =>
isMonorepo(tree)
? noop()(tree, context)
: chain([
branchAndMerge(mergeWith(generateWorkspace(options, appName))),
moveDefaultAppToApps(options.path, appName, options.sourceRoot),
])(tree, context),
addAppsToCliOptions(options.path, options.name, appName),
branchAndMerge(mergeWith(generate(options))),
]);
}
return (host: Tree, context: SchematicContext) => {
options.path = getProjectPath(host, options);
const parsedPath = parseName(options);
options.name = parsedPath.name;
options.path = parsedPath.path;
const templateSource = apply(url('./files'), [
template({
...stringUtils,
...(options as object)
} as any),
move(parsedPath.path)
]);
return chain([branchAndMerge(chain([mergeWith(templateSource)]))])(
host,
context
);
};
}
function addFiles(options: ElementsOptions, extra: string = ''): Rule {
extra = extra ? `${extra}_` : '';
const xplatFolderName = XplatHelpers.getXplatFoldername('web', 'angular');
return branchAndMerge(
mergeWith(
apply(url(`./_${extra}files`), [
template({
...(options as any),
...getDefaultTemplateOptions(),
name: options.name.toLowerCase(),
xplatFolderName,
customElementList,
componentSymbolList,
componentSymbols,
htmlElements
}),
move(`xplat/${xplatFolderName}/elements`)
])
)
);