1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-17 19:13:34 +08:00

54 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
093c5a3152 feat(@schematics/angular): directly use @angular/build in new projects
The `@angular/build` package is now used directly within all newly created
projects and replaces the previous usage of the `@angular-devkit/build-angular`
package. This has the advantage of removing the need to install all of the
Webpack related transitive dependencies contained within `@angular-devkit/build-angular`
that are used to support the `browser` builder. This results in a significant
reduction in both total dependency count and disk install size for new projects.
New projects that would prefer to use the Webpack-based `browser` builder can still
install the `@angular-devkit/build-angular` package within the workspace.

The `@angular/build@19.2.0-next.2` package currently has a total unpacked size of ~115 MB.
The `@angular-devkit/build-angular@19.2.0-next.2` package currently has a total unpacked size of ~291 MB.
2025-03-05 10:28:07 +01:00
Alan Agius
cae068be37 fix(@schematics/angular): update library schematic to use @angular-devkit/build-angular:ng-packagr
The library schematic currently relies on Karma, which requires `@angular-devkit/build-angular` to be installed. To address this, we now use the `ng-packagr` builder provided in this package.

Closes 
2025-01-29 08:15:46 +01:00
Alan Agius
31cbf5f9ad build: replace hardcoded Angular and ng-packagr peer dependencies with Bazel stamping
Refactor the build configuration to use Bazel stamping for Angular and ng-packagr dependencies, eliminating the need for hardcoded peer dependencies.
2025-01-16 19:06:30 +01:00
Charles Lyding
02825eec53 feat(@schematics/angular): use @angular/build package in library generation schematic
The newly introduced `ng-packagr` builder within the `@angular/build` package
is now used when generating a new library with `ng generate library`. This
builder provides the same functionality as the `ng-packagr` builder found
within the `@angular-devkit/build-angular` package but removes the need for
projects to install `@angular-devkit/build-angular` if using the `application`
builder from `@angular/build`.
2025-01-08 12:21:48 -05: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
Ash Ramirez
434a3740f0 refactor(@angular/cli): update aio links -> adev links
Updates for all angular.io links to the new angular.dev domain. Additionally, adjustment to new resources where the equivalent does not exist on the new site (e.g. Tour of Heroes tutorial)
2024-06-06 11:12:06 +02:00
Alan Agius
419b5c1917 fix(@schematics/angular): remove baseUrl from tsconfig.json
The `baseUrl` is no longer needed since NGCC has been removed. This also enables better auto-import suggestions.

Closes 
2023-10-02 15:30:29 +02:00
Alan Agius
ac0db66975 feat(@schematics/angular): enable standalone by default in new applications
This commit update the schematics to generate a standalone application by default.
2023-09-22 16:42:35 +02:00
Alan Agius
0c9d137ff0 fix(@schematics/angular): add standalone option to library library
This commit fixes an issue were libraries could not be created with standalone APIs.

Standalone libraries do not have an an NgModule. When consumed users need to import the needed components, pipes, and directives.

It is also recommended not to avoid grouping exports as this typically indicates bad architecture and may also hinder tree-shaking.

**Don't**
```ts
export const COMPONENTS = [
  FooComponent,
  BarComponent,
]
```

**Do**
```ts
export { FooComponent } from './foo/foo.component';
export { BarComponent } from './bar/bar.component';
```
2023-04-25 15:38:57 +00:00
Alan Agius
207358afb8 feat(@angular-devkit/schematics): add runSchematic and runExternalSchematic methods
These async methods are a replacement for the Observable based `runSchematicAsync` and `runExternalSchematicAsync` methods.

DEPRECATED:
The Observable based `SchematicTestRunner.runSchematicAsync` and `SchematicTestRunner.runExternalSchematicAsync` method have been deprecated in favor of the Promise based `SchematicTestRunner.runSchematic` and `SchematicTestRunner.runExternalSchematic`.
2022-12-08 14:49:43 -08:00
Felix Hamann
62121f89ab feat(@schematics/angular): add sideEffects:false to library package.json 2022-10-25 10:50:17 -07:00
Dariusz Ostolski
d8bff4f1e6 feat(@schematics/angular): Added --project-root option to the library schematics
With this change user is able to specify different project root for libraries than default one.

Closes: 
2022-10-07 10:51:31 -04: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
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
e1ee636d78 fix(@schematics/angular): don't add path mapping to old entrypoint definition file
With the APF changes in version 14, the dts entrypoint file has been changed to `index.d.ts`, this results in TypeScript being able to resolve the type definition file without the need of the additional path to the flat module file dts.
2022-05-10 10:26:31 -07:00
Alan Agius
4cbfb87766 refactor(@schematics/angular): remove usage of deprecated defaultProject
This option is deprecated in Angular CLI and will be removed in a future major version.
2022-03-21 12:28:15 -07:00
Alan Agius
14df2aaef9 refactor(@schematics/angular): sync schematics dependencies using Renovate
With this change we sync workspace and library schematic dependencies using Renovate. We do this to avoid having to keep these in sync by hand.

We could have used TypeScripts' `resolveJsonModule` to make the `latestVersion` object typesafe. But `ts_library` doesn't support JSON inputs.
2021-07-20 18:58:29 +02: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
Charles Lyding
37a06a7c37 build: format all files
All files are now formatted using the ng-dev tools via prettier.
2021-04-28 16:05:49 -07: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
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
Alan Agius
226a8d274d feat(@schematics/angular): remove tslint and codelyzer from new projects
Both of these projects and the tslint builder are deprecated.

Closes  and closes 
2021-03-16 15:49:46 +01:00
Alan Agius
1de6d71edd feat(@schematics/angular): production builds by default
With this change we do several changes to the `angular.json` configuration for `build` , `server` and `app-shell` targets so that these are `production` by default.

- build, server and app-shell targets are configured to run production by default.
- We add a new configuration named `development` to run the mentioned builder targets in development. Ex: `ng build --configuration development`.
- When adding `universal` or `app-shell`, we generate the full set of configurations as per the `buiid` target. Previously, we only generated the `production` configuration.
- We added a helper script in `package.json` to run build in watch mode. `npm run watch` which is a shortcut for `ng build --watch --configuration development`
2021-03-10 08:16:38 -06:00
Alan Agius
0bc15970ad refactor(@schematics/angular): use jsonc-parser instead of devkit parser 2020-11-05 08:31:02 +01:00
Alan Agius
da9825ceb2 refactor(@schematics/angular): use ng-packagr builder from build-angular 2020-08-14 15:38:12 +02:00
Alan Agius
8b96e52d83 fix(@schematics/angular): remove solution style tsconfig from new projects
Following the issues highlighted in https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit?usp=sharing and discussions held with the TypeScript team. The best course of action is to rollback this feature.

In future, it is not excluded that solution style tsconfigs are re-introduced..

Closes  and closes 
2020-08-12 19:26:12 +01:00
Alan Agius
76f525cec2 fix(@schematics/angular): add links to generated tsconfig files
We now add a link to generated tsconfig.json to make is easier for users to find relevant information.
2020-06-15 08:48:14 +02:00
Alan Agius
bede23226a feat(@schematics/angular): add solutions style tsconfig structure
In version 3.9, TypeScript introduced the concept of "Solutions Style" tsconfig to improve developer experience.

More info: https://devblogs.microsoft.com/typescript/announcing-typescript-3-9-rc/#solution-style-tsconfig

Closes  and closes 
2020-05-20 12:12:33 -07:00
Daniele Morosinotto
3aacf41057 fix(@schematics/angular): regression tsconfig.json ()
* fix(@schematics/angular): regression tsconfig.json

fix(@schematics/angular): regression tsconfig.json  …
Unverified
0e318ae
Regression in tsconfig.json set `"outDir": "./dist/out-tsc"` for problems in VSCode TS(2307) when building library referred in tsconfig "paths" 
 
Closes: 

* fix(@schematics/angular): regression tsconfig.json

Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.

Closes 

* fix(@schematics/angular): regression tsconfig.json

Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.
Fix code lint.

Closes 

* fix(@schematics/angular): regression tsconfig.json

Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.
Fix test code to conform new behaviour.

Closes 
2020-01-23 17:58:38 -08:00
Alan Agius
be1bcbaead fix(@schematics/angular): improve paths and exclude options
Currently the library schematic doesn't support adding a secondary entry-point and having deep imports is not recommanded.

It's best if paths are more stricter when having a secondary entry-point instead of a wildcard.

Instead of :
```
"lib/*": [
  "dist/lib/*"
]
```

Users should configure:
```
"lib/secondary": [
  "dist/lib/secondary"
]
```

This would allow a better DX experience when using auto imports in IDE's.

Closes: 
2019-12-03 12:37:07 -08:00
Alan
beb7070ac8 feat(@schematics/angular): introduce Ivy libraries for development
Since `NGCC` is non incremental and in library projects we have the original TS sources
we don't need to build a library using the `VE` and transform it using `NGCC`. Instead we can build the library using `NGTSC` (Ivy) directly
 as this enables faster incremental compilations and a better development experience.

 Libraries now have a `production` configuration, which enabled `VE` compilations. As it is not recommended to publish NGTSC (Ivy)
 built libraries to NPM repositories, since Ivy libraries are not backwards compatible with the legacy View Engine.
2019-08-16 09:31:02 -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
89a122cd5c fix(@schematics/angular): update ng-packagr and tsickle when migrating to version 8 2019-06-06 14:16:51 -07:00
Alan Agius
a464c001c3 fix(@schematics/angular): fix paths when newProjectRoot is an empty string
When `newProjectRoot` the paths are prefixed with an `/` example `/project-name/tsconfig.lib.json` which results in these being marked as absolute paths, which causes build failures.

Fixes 
2019-04-22 16:17:39 -07:00
Charles Lyding
ca1ecb027d test(@schematics/angular): ensure application schematic is run async 2019-04-16 11:23:48 -07:00
Alan Agius
58fb593787 feat(@schematics/angular): update several workspace dependencies
With this change we update ng-packagr, jasmine-core and tslint.
2019-04-15 11:09:13 -07:00
Charles Lyding
cbce3d3793 refactor(@schematics/angular): update library to use new workspace rules 2019-04-15 11:02:46 -07:00
Alan Agius
e516a817ac feat(@schematics/angular): update to ng-packagr version 5
This changes remove the need for tsickle.
2019-03-27 12:11:38 -07:00
WilliamKoza
d841b3771e fix(@schematics/angular): change entry file name of the library schematic according to the kebab-case convention 2019-03-11 13:40:02 -07:00
Alan Agius
9e18cf240e fix(@schematics/angular): kebab case prefix causes lint errors in new directives
`Component` selectors are always kekabed while `Directive` selectors are always camelized. This updates the lint rules to convert the prefix to the appropiate case

Fixes 
2019-03-04 09:35:22 -08:00
Amadou Sall
3e14158283 fix(@schematics/angular): generate coverage for libs in their own folder 2019-01-14 10:57:51 -08:00
Klaus Kazlauskas
100cf47cb9 feat(@schematics/angular): generate a library with a README.md file
Fixes 
2019-01-08 13:45:18 -08:00
Alan Agius
e18b912aa7 test: use toContain instead of indexOf 2018-11-14 12:34:49 -08:00
Alan Agius
8bbba9d0ac fix(@schematics/angular): update @angular peerDependencies for new libraries 2018-10-19 15:58:12 -07:00
Alan Agius
5308fa07d9 feat(@schematics/angular): update ng-packagr to 4.2.0 2018-09-18 11:30:54 -07:00
Filipe Silva
9720077a4b build: make resolution logic compatible with Bazel 2018-08-22 16:36:10 -07:00
Alan Agius
718ee15b9a refactor: remove flatModuleId and flatModuleOutFile from library tsconfig
The autogenerated fiellds are no longer required following this PR https://github.com/dherges/ng-packagr/pull/1024

This has been released in `ng-packagr` `v4.1.0`
2018-08-21 10:16:38 -07:00
Alan Agius
c35b44ca4d feat(@schematics/angular): add skipInstall option to library schematic
Closes: 
2018-08-04 12:46:55 +01:00