angular-schematics

nrwl/nx Workspace-Specific Schematics

ε祈祈猫儿з 提交于 2021-02-07 13:11:00
问题 I've been investigating the nrwl extensions and they look great. However, when I'm following their tutorial for Workspace Specific Schematics, the last step doesn't show me the command to run. Can you tell me how I run the schematic I created? I'm sure it's simple, but I can't find the command anywhere. 回答1: (edit: see Stefan's answer for the correct Nx way to do it. If you want to publish your schematics, you still need to follow this answer) The Nx generator for schematics doesn't do

Modules not found in shared code with Nativescript and Angular Schematics

社会主义新天地 提交于 2020-01-23 10:46:05
问题 I'm using Angular with Nativescript Schematics. I have installed the nativescript-ui-sidedrawer. When i run tns run ios --bundle The native version is compiled and deployed to the device but when I run ng serve The web version fails with several errors, all very similar. The first one being ERROR in ./node_modules/tns-core-modules/ui/builder/component-builder/component-builder.js Module not found: Error: Can't resolve '../../../platform' in '/Users/markdev/Documents/Code/mydrawer/node_modules

Empty style (.css/.scss) files

此生再无相见时 提交于 2019-12-22 10:49:24
问题 When I create Angular application, I am using CLI for generating components. After certain time of developing app I have style file for every component but major part of them are empty. When I check sonar I have Code smells in empty style files: Remove this empty stylesheet. Add an empty new line at the end of this file. Should I remove sonar rules or I must delete all empty style files in project and recreating them in next versions of project when I need them for component styling? What are

Custom project-level templates for angular components generated via angular-cli

做~自己de王妃 提交于 2019-12-10 17:35:54
问题 How do I add custom angular component schematics to existing project? I would like to have e.g. my-page component templates that will replicate existing \node_modules\@schematics\angular\component\ files but with edited templates. I expect it to be achievable through angular-cli e.g. ng g my-page pagename command with schematics attribute. Currently I modified code for existing agular's schematics under \node_modules\ so this works fine for me (until next package installation) but I would

How to create a mono-repo project structure with angular-cli (6.x)

…衆ロ難τιáo~ 提交于 2019-12-09 20:19:56
问题 I'd like to use the angular-cli to generate a new workspace The only way to do this at the moment is to run: ng new asdf cd asdf ng g application whatever but then all of the src/ files remain (and the original angular.json info for a project that is now inconsistently stored). There's no way to create a new repo without the src folder... and when I do this using a custom schematic by essentially duplicating angular-cli's ng-new and removing https://github.com/angular/angular-cli/blob

How to create a mono-repo project structure with angular-cli (6.x)

跟風遠走 提交于 2019-12-04 16:39:38
I'd like to use the angular-cli to generate a new workspace The only way to do this at the moment is to run: ng new asdf cd asdf ng g application whatever but then all of the src/ files remain (and the original angular.json info for a project that is now inconsistently stored). There's no way to create a new repo without the src folder... and when I do this using a custom schematic by essentially duplicating angular-cli's ng-new and removing https://github.com/angular/angular-cli/blob/6449a753641340d8fc19a752e1a1ced75f974efa/packages/schematics/angular/ng-new/index.ts#L61 schematic(

How to overwrite file with angular schematics?

不问归期 提交于 2019-12-04 16:39:34
问题 I want to write a Rule that overwrites a file every time. In the following and have MergeStrategy set to Overwrite : collection.json { "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", "schematics": { "function": { "aliases": [ "fn" ], "factory": "./function", "description": "Create a function.", "schema": "./function/schema.json" } } } function/index.ts export default function(options: FunctionOptions): Rule { options.path = options.path ? normalize(options.path

How to overwrite file with angular schematics?

走远了吗. 提交于 2019-12-03 10:42:41
I want to write a Rule that overwrites a file every time. In the following and have MergeStrategy set to Overwrite : collection.json { "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", "schematics": { "function": { "aliases": [ "fn" ], "factory": "./function", "description": "Create a function.", "schema": "./function/schema.json" } } } function/index.ts export default function(options: FunctionOptions): Rule { options.path = options.path ? normalize(options.path) : options.path; const sourceDir = options.sourceDir; if (!sourceDir) { throw new SchematicsException(