Skip to content

Instantly share code, notes, and snippets.

@bautistaaa
Last active October 24, 2018 12:36
Show Gist options
  • Select an option

  • Save bautistaaa/c4a737e123dee434d5be3ed16bb40ccb to your computer and use it in GitHub Desktop.

Select an option

Save bautistaaa/c4a737e123dee434d5be3ed16bb40ccb to your computer and use it in GitHub Desktop.
schematic to add vscode files to your project
function addVsCodeSettings(): Rule {
return (tree: Tree, _context: SchematicContext) => {
const templateSource = apply(url('./files/.vscode'), [
move('./.vscode'),
forEach((fileEntry: FileEntry) => {
if (tree.exists(fileEntry.path)) {
_context.logger.warn(`Warning: you've overriden ${
fileEntry.path
}. If you did not mean
to do this, restore these files via source control immediately after this operation.`);
tree.overwrite(fileEntry.path, fileEntry.content);
}
return fileEntry;
}),
]);
return branchAndMerge(chain([mergeWith(templateSource)]));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment