112 Commits

Author SHA1 Message Date
Charles Lyding
23fc8e1e17 fix(@schematics/angular): generate components without a .component extension/type
To align with the updated style guide, Angular v20 will generate components
without a `.component` file extension type for all component related
files by default. Projects will automatically use this naming convention.
Projects can however opt-out by setting the `type` option to `Component`
for the component schematic. This can be done as a default in the `angular.json`
or directly on the commandline via `--type=Component` when executing `ng generate`.
As an example, `app.component.css` will now be named `app.css`. Additionally,
the TypeScript class name will be `App` instead of the previous `AppComponent`.
2025-03-14 11:27:43 -07:00
Charles Lyding
dc2f65999a fix(@schematics/angular): generate component templates with a .ng.html file extension
To align with the updated style guide, Angular v20 will generate
component templates with a `.ng.html` file extension instead of
the previous `.html` by default. Projects will automatically
use this new template extension. Projects can however opt-out of
component generation using `.ng.html` by setting the `ngHtml`
option to false for the component schematic. This can be done as
a default in the `angular.json` or directly on the commandline
via `--no-ng-html` when executing `ng generate`.
2025-03-10 09:43:21 +01:00
Alan Agius
8567267603 refactor(@schematics/angular): remove redundant standalone: true from templates
This is no longer needed.
2024-10-24 16:23:02 +02:00
cexbrayat
8ce57fea5f refactor(@schematics/angular): spacing fixes after experimental zoneless introduction 2024-10-17 14:16:15 +00:00
Jan Martin
fcf7443d62 fix(@schematics/angular): explicitly set standalone:false 2024-10-16 07:56:23 -07:00
Alan Agius
3db1d81397 refactor(@schematics/angular): minor formatting fixes
Some minor formatting fixes.
2024-10-15 19:42:39 +02:00
aparziale
755f3a07f5 feat(@schematics/angular): add option to setup new workspace or application as zoneless mode 2024-10-15 09:28:18 -07:00
Atchyut Pulavarthi
e3b8b780be fix(@schematics/angular): update schematics to use RouterModule when --routing flag is present
update schematics to use RouterModule instead of RouterTestingModule when generating a new project with the --routing flag

Fixes #27691
2024-06-17 12:39:18 +02:00
David LJ
0fa7e91231 docs: update tsconfig template link aio->adev 2024-06-05 09:31:34 -07:00
cexbrayat
1573293848 fix(@schematics/angular): add spaces around eventCoalescing option
The usual coding style in the generated application is to have spaces in objects (see `server.ts.template` for example).
2024-03-29 19:27:41 -07:00
Pawel Kozlowski
508d97da76 feat(@schematics/angular): use ngZoneEventCoalescing option by default (module bootstrap)
This commit enables ngZoneEventCoalescing by default for NgModule-based applications.
2024-03-29 07:13:56 -07:00
Pawel Kozlowski
7258837138 feat(@schematics/angular): use eventCoalescing option by default (standalone bootstrap)
This commit enables eventCoalescing by default for standalone applications.
2024-03-29 07:13:56 -07:00
Alan Agius
6530aa11be feat(@schematics/angular): replace assets with public directory
The `assets` directory is confusing for the users and commonly users place "assets" which are not meant to be copied but instead processed by the build system. This causes some files both bundled and copied.

With this change we rename the `assets` directory to `public` and also move the `favicon.ico` inside this newly created directory.
2024-03-25 17:10:29 +01:00
Val-Git
ea8102ac7f refactor(@angular/cli): change Twitter icon in the application schematic 2024-01-10 10:48:34 -08:00
Matthieu Riegler
3c66ba78b4 refactor(@angular-devkit/schematics): use self-closing tag for router-outlet
Let's make the component as simple a possible.
2023-11-20 08:06:08 -05:00
Matthieu Riegler
18231e0804 refactor(@angular-devkit/schematics): remove CommonModule
The template now uses the new control flow syntax
2023-11-20 08:06:08 -05:00
cexbrayat
0b987b5eeb fix(@schematics/angular): html indentation
The div was badly aligned in `app.component.html`
2023-11-08 18:57:57 +01:00
cexbrayat
47700e3c50 fix(@schematics/angular): use styleUrl
The `ng g c` schematic is already using `styleUrl`, but `app.component.ts` was still using `styleUrls`.
2023-11-08 18:57:40 +01:00
cexbrayat
da7dea654f fix(@schematics/angular): use href property binding for links 2023-11-08 15:04:33 +01:00
Alan Agius
a2fa0c995e refactor(@schematics/angular): add fallback fonts
Just in case Inter Tight is not available.
2023-11-07 19:14:34 +01:00
Alan Agius
7e72fd86fa refactor(@schematics/angular): remove unused CSS
Only h1 is used in the initial template.
2023-11-07 19:14:34 +01:00
Alan Agius
be6ef55369 refactor(@schematics/angular): use control flow to reduce code
This commit uses control flow to reduces code in the template
2023-11-07 19:14:34 +01:00
Alan Agius
f9a798be05 fix(@angular/pwa): replace Angular logos
This commit replaces the Angular old logo with the new one.
2023-11-07 19:14:34 +01:00
Alan Agius
1f02aa9f61 fix(@schematics/angular): add missing icons in ng-new template
This commit adds a number of missing icons.

Closes #26257
2023-11-07 19:14:34 +01:00
Doug Parker
42934bcffe feat(@schematics/angular): update ng new generated application 2023-11-06 15:53:53 -08:00
Sarthak Deshmukh
4b390abbe4 fix(@schematics/angular): change Twitter logo to X
Update twitter logo to x

Closes #26012
2023-10-18 16:35:26 +02:00
Charles Lyding
0c20cc4dc5 fix(@angular-devkit/build-angular): re-add TestBed compileComponents in schematics to support defer block testing
The defer block support introduces a new asynchronous form of the set class metadata Angular function. This form
is needed to allow for providing metadata for dynamically imported deferred components. The asynchronous compileComponents
call within TestBed is now used to initialize this metadata during unit tests. Unit tests that contain defer blocks
must use this call prior to executing a test to allow templates containing defer to properly render. Existing tests that
do not use the new defer block do not require modification unless the defer block is introduced into components used in
the unit test.
2023-10-04 09:50:20 -04:00
Kristiyan Kostadinov
03a1eaf01c fix(@schematics/angular): account for new block syntax in starter template
Fixes that the starter template would've generated a compilation error in v17 after https://github.com/angular/angular/pull/51994 is released.
2023-10-04 09:49:36 -04:00
Enea Jahollari
e6dc2465b9 refactor(@schematics/angular): remove empty space in app.config.ts.template 2023-09-15 16:37:34 +02:00
cexbrayat
202e9a50f6 fix(@schematics/angular): remove compileComponents from component test schematic
`compileComponents` is not necessary when using the CLI (as the templates are inlined) and just adds boilerplate code. So we can remove it from the test schematic and make it independent from `async/await` (only place we would have it in the CLI generated code, and in most Angular apps).
2023-03-24 18:30:26 +00:00
cexbrayat
ba4414b2cf fix(@schematics/angular): reformat app.config.ts
The CLI usually generates files with a new line at the end.
This line was lacking in the new `app.config.ts` file generated for standalone applications.

It was also using a trailing comma, which is not the usual convention in generated files.
2023-03-24 18:28:46 +00:00
cexbrayat
85fe820b08 fix(@schematics/angular): use same property order in standalone AppComponent
The `imports` are below the `standalone` property when generating a new component with `ng g c`.
This commit moves the `imports` of the standalone `app.component.ts` file to be in a similar place.
2023-03-24 18:21:43 +00:00
Alan Agius
8917d6d249 refactor(@schematics/angular): simplify application schematic
This commit simplifies the application schematic
2023-03-22 18:24:16 +00:00
Mike Brocchi
a832c20282 feat(@schematics/angular): Implement a standalone flag for new applications 2023-03-21 17:21:40 +00:00
Cédric Exbrayat
84e3f7727d fix(@schematics/angular): remove empty lines
The recet removal of enableProdMode in 283b564d1de985f0af8c2fcb6192801a90baacda introduced unnecessary empty lines in main.ts
2022-09-29 18:58:01 +02:00
Alan Agius
b6897dbb0a feat(@schematics/angular): remove karma.conf.js from newly generated projects
`@angular-devkit/build-angular` now has a built in Karma config. Users can still create their own Karma configuration if they want to override the default configuration.
2022-09-28 17:37:53 +02:00
Alan Agius
283b564d1d feat(@schematics/angular): remove environment files in new applications
This commit removes the usage of environment files and `fileReplacements` in new application projects. Previously, the environment files was used to distinguish between a prod build to invoke `enableProdMode`. The `enableProdMode` however needed only for the case of JIT mode in production mode, which is a rare case as JIT mode is recommanded to be used in production.

In the CLI, calling `enableProdMode` is not needed as `ngDevMode` it's set using the minifier.
2022-09-27 19:48:34 +02:00
Alan Agius
56a1e8f9f5 feat(@schematics/angular): remove test.ts file from new projects
The test.ts is now included in `@angular-devkit/build-angular` and unless this needs to be customized is no longer needed to be provided.

Default config:
```js
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import { getTestBed } from '@angular/core/testing';
import {
  BrowserDynamicTestingModule,
  platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
  errorOnUnknownElements: true,
  errorOnUnknownProperties: true
});
```
2022-09-27 18:59:08 +02:00
Alan Agius
597bfea1b2 feat(@schematics/angular): drop polyfills.ts file from new templates
With this change we drop the `polyfills.ts` from new application projects and add the polyfills directly in the `angular.json`. This is possible as now the `polyfills` option accept an array of module specifiers.

This change also fixes another open issue (#14432) which was caused by the missing polyfills file in the library test setup.

Closes #14432
2022-09-26 18:27:35 +02:00
Alan Agius
dbcea96274 refactor(@angular-devkit/build-angular): simplify how specs are found and loaded
Prior to this change specs where found and loaded using Webpack's `require.context` API. The `require.context` is found in the users project `test.ts`. This resulted in a complex and hacky setup especially to filter tests when the `include` builder option is provided, were we had to amend the `test.ts` in memory.

With this change we find all the specs files and add them as part of the main entrypoint.

Closes #23751 and closes #22531
2022-09-23 18:52:26 -04:00
Cédric Exbrayat
1c21e470c7 feat(@schematics/angular): enable error on unknown properties and elements in tests
These new options have been introduced in Angular v14.
The commit enables the option in a new project, as we did when we introduced the `destroyAfterOption`,
with the same long term goal to have these options enabled by default.
2022-09-16 11:37:56 -07:00
Alan Agius
9beb878e2e feat(@schematics/angular): remove Browserslist configuration files from projects
The Browserslist configuration file is redundant as we set the defaults directly in @angular-devkit/build-angular. 8da926966e/packages/angular_devkit/build_angular/src/utils/supported-browsers.ts (L12-L19)

With this commit, we remove the `.browserlistrc` configuration file from the schematics application template and through a migration in existing projects when the Browserslist query result matches the default.

Users needing a finer grain support should still create a `.browserlistrc` in the root directory of the project.
2022-09-14 10:43:41 -07:00
alkavats1
d52697047a refactor: refactored the code and removed the code smells
refactored the code and removed the code smells
2022-05-06 11:11:13 -07:00
Alan Agius
37a7239458 fix(@schematics/angular): address eslint linting failures in test.ts
Closes #22171
2021-11-18 20:26:39 +01: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
Alan Agius
585adacd06 fix(@schematics/angular): don't add destroyAfterEach in newly generated spec files
This is now enabled by default.

See https://github.com/angular/angular/pull/43353 for more context.
2021-10-06 14:33:42 -05:00
Doug Parker
ba9c60360f refactor(@schematics/angular): drop IE-only polyfills and drop versions from comment.
This removes polyfills only required on Internet Explorer since it is no longer supported (`web-animations-js`). Also updates the doc comment to leave specific versions unspecified, since they are already out of date and updating them now would just cause them to go out of date again in the future. Instead, users can visit the browser support guide to understand find the most up to date browser versions supported.
2021-10-01 14:07:58 -05:00
Alan Agius
5986befcdc feat(@schematics/angular): remove deprecated options
With this change we removed several deprecated `@schematics/angular` deprecated options.

BREAKING CHANGE:

We removed several deprecated `@schematics/angular` deprecated options.
- `lintFix` have been removed from all schematics. `ng lint --fix` should be used instead.
- `legacyBrowsers` have been removed from the `application` schematics since IE 11 is no longer supported.
- `configuration` has been removed from the `web-worker` as it was unused.
- `target` has been removed from the `service-worker` as it was unused.
2021-07-30 14:26:53 +01:00
Alan Agius
9fbd16655e feat(@schematics/angular): remove IE 11 specific polyfills 2021-07-30 12:56:30 +01:00
Alan Agius
20fd33f6d4 feat(@schematics/angular): destroy test module after every test
In version 12.1, the framework added the `destroyAfterEach` an opt-in feature that improves tests performance and also addresses two long-standing issues.

The idea, is to have this enabled by default in the future.  Related PR: https://github.com/angular/angular/pull/42566

Closes #21280
2021-07-07 10:31:20 -04:00