30 Commits

Author SHA1 Message Date
Charles Lyding
bb43e0a7c4 test(@schematics/angular): update several tests to use async expectations
Using Jasmine's `expectAsync` allows for reduced test code when testing that
a function returning a promise rejects with a specific error.
2022-06-14 11:28:21 +02:00
Pawel Kozlowski
df9fc8f5ab refactor(@schematics/angular): include CommonModule for standalone components
This commit adds the CommonModule imports to the standalone components
generated by the Angular's ng add component schematic.
2022-05-03 12:18:54 -07:00
Kristiyan Kostadinov
7b78b7840e feat(@schematics/angular): add --standalone to ng generate
Adds the `--standalone` flag when generating components, directives or pipes through `ng generate`.
2022-04-27 15:33:48 -04:00
gauravsoni119
a5e99762ef fix(@schematics/angular): fix extra comma added when use --change-detection=onPush and --style=none to generate a component 2022-03-30 16:59:17 +02:00
Alan Agius
21809e14cd feat(@schematics/angular): loosen project name validation
With this change we update the validation of the libraries and application projects names to fully allow characters that make a valid NPM package name. http://json.schemastore.org/package has been used as reference.

We also remove validators that are no longer needed.

Closes #11051
2021-11-16 10:51:10 +00:00
David Scourfield
8ad1539c5e feat(@schematics/angular): add 'none' value for the 'style' option of the component schematic
Allow setting `--style=none` for the component schematic to prevent generation of any style file.  Previously this was possible only with `--inlineStyle=true`, which had the side-effect of adding an inline style block to the component decorator.  Useful for components or projects which have entirely externalised stylesheets and never want to use component-specific styles.
2021-06-21 11:10:23 +01:00
hien-pham
9cd8be69d6 test(@schematics/angular): add missing unit test for skipTests flag of component, class, directive, and pipe 2021-06-18 11:18:46 +01:00
Charles Lyding
c1512e4274 build: update files to be eslint compliant
All TypeScript files have been updated to pass the new eslint-based linting checks. eslint compatible disabling comments have also been added in place of the previous tslint comments.
2021-05-03 07:31:02 -04:00
Joey Perrott
003854257c build: migrate all file header to use Google LLC rather than Google Inc 2021-04-27 08:35:22 +02:00
Alan Agius
8582ddc35e feat(@schematics/angular): remove entryComponent from component schematic
BREAKING CHANGE:

`entryComponent` option has been removed from the `component` schematic as this was intended to be used with the the now no longer supported ViewEngine rendering engine.
2021-03-31 10:04:05 -06:00
George Kalpakas
fb14945c02 fix(@schematics/angular): correctly handle adding multi-line strings to @NgModule metadata
Previously, `addSymbolToNgModuleMetadata()` assumed that the added
symbol would not span multiple lines. In most cases, the added symbol is
a single word, so this assumption was correct. In some cases, however,
we might want to add a mutli-line string, such as a static method of an
`@NgModule`:

```ts
  imports: [
    SomeModule.staticMethod({
      prop1: 'val1',
      prop2: 'val2'
    })
  ]
```

This commit allows `addSymbolToNgModuleMetadata()` to correctly handle
multi-line strings by ensuring that added metadata symbols are always
put on a new line (even if the array is empty) and each line in the
string is indented as necessary.
2021-03-30 14:33:19 -06:00
Sachin Grover
1c1f1cde65 fix(@schematics/angular): Allow empty string in the type option
Currently, Component and Class have the options to add custom type. In the case of class, It's already working fine with  an empty string in type but in the case  of component When setting the type to an empty string the file names generated will contain an extra period (.) which breaks the flow.

With this PR, It will generate the files without an extra period (.)

Reference #16811 and #16891
2020-02-26 12:02:20 -08:00
Alan Agius
8465538f9d test(@schematics/angular): fix component schematic tests on Windows 2020-02-18 10:52:11 -08:00
Reto Ryter
d6fa2bde93 feat(@schematics/angular): add opt in option 'displayBlock' 2020-02-05 10:30:15 -08:00
Alan Agius
e92c46a3cf refactor(@schematics/angular): remove deprecated spec and styleext options
BREAKING CHANGE:

Deprecated `styleext` and `spec` options have been removed.  Use `style` and `skipTests` options instead.
2019-10-22 13:27:08 -07:00
Leon Radley
c0d42e0c0e feat(@schematics/angular): add type option to component generator (#15754)
the type option allows you to change the default .component.ts suffix to new types.
such as

Route
Dialog
UI
Container
2019-10-09 11:09:12 -07:00
Charles Lyding
5a7b823b28 test: remove use of deprecated synchronous test helper runSchematic 2019-08-08 08:27:31 -07:00
Alan Agius
15ef15e94a style: remove redundant max-line-length disables and fix other lint issues 2019-07-24 19:06:21 -07:00
Alan
2c1b78f35d style: remove redundant console.log 2019-06-25 13:30:28 -07:00
mgechev
302cace038 feat(@schematics/angular): add skipSelector property to the component generator
Fix #14749
2019-06-20 10:57:33 -07:00
Charles Lyding
e52f62f840 refactor(@schematics/angular): update component to use new workspace rules 2019-04-16 11:23:48 -07:00
Alan
1fcb9a09f9 test: remove now duplicate test 2019-03-04 10:26:09 -08:00
Alan
08c4cb748f fix(@schematics/angular): reintroduce .sass as a supported file extention
Sass Indented (.sass) is fully supported by the Sass team and we should still offer and support it.

Fixes #13739
2019-03-04 10:26:09 -08:00
Alan
4718de4dae feat(@schematics/angular): only support known style extentions
Fixes #13149
2019-01-18 11:56:19 -08:00
Alan Agius
a12a4e02a4 feat(@schematics/angular): consistent naming of options and arguments that do the same thing
This aligns options that do the same thing:
1) `skipSpecs` and `spec` has been deprecated in favor of `skipTests`.
2) `styleext` has been deprecated in favor of `style` since the latest is two words.

Fixes #12784
2018-12-11 11:55:54 -08:00
Alan Agius
e18b912aa7 test: use toContain instead of indexOf 2018-11-14 12:34:49 -08:00
Hans
f15d5589c3 refactor(@schematics/angular): automated JSON schema generation 2018-09-13 16:44:17 -07:00
Filipe Silva
9720077a4b build: make resolution logic compatible with Bazel 2018-08-22 16:36:10 -07:00
Hans Larsen
483cbe2665 refactor: add tslint-sonarts and a lot of tslint rules
This should clean up the code a bit.

Note: at first I added the no-useless-cast rule, but after getting frustrated
with it (as it has many false positive), I decided to remove the rule but some
useless casts were removed so I let those in the PR.
2018-07-10 15:07:36 -07:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00