1323 Commits

Author SHA1 Message Date
Kristiyan Kostadinov
7f570c5685 build: update to TypeScript 5.6 RC
Updates the repo to the TypeScript 5.6 RC and narrows down the version to drop support for 5.4, in line with the compiler.
2024-08-29 10:40:28 +02:00
Alan Agius
d8b8364d35 refactor(@schematics/angular): move @angular/ssr dependency to server schematic
This change is necessary as the `@angular/ssr` package is now required for all types of server-side rendering, including SSG and app-shell.
2024-08-27 09:34:04 -07:00
Alan Agius
4b09887a9c feat(@angular/ssr): move CommonEngine API to /node entry-point
Refactored the `CommonEngine` API import path to remove Node.js dependencies from the `@angular/ssr` main entry-point.

BREAKING CHANGE:

The `CommonEngine` API now needs to be imported from `@angular/ssr/node`.

**Before**
```ts
import { CommonEngine } from '@angular/ssr';
```

**After**
```ts
import { CommonEngine } from '@angular/ssr/node';
```
2024-08-27 08:57:37 +02:00
aparzi
a381a3db18 feat(@schematics/angular): add option to export component as default
Introduces option `--export-default` to control whether the generated component uses a default export instead of a named export.

Closes: #25023
2024-08-23 23:56:34 +02:00
Alan Agius
5f7edd8e2d build: update dependency zone.js to ~0.15.0 and angular 2024-08-22 19:20:15 +02:00
Charles Lyding
d223d1eda3 refactor(@schematics/angular): increase new application anyComponentStyle budget thresholds
The 2kB/4kB warning/error thresholds for any component style within an application
has now been increased to 4kB/8kB for warnings/errors respectively. This allows for
more complex styles within a component while also reducing the likelihood of the budget
rule being disabled or removed. The new limits still provide diagnostics for extreme
size cases such as accidentally importing all Bootstrap or Material styles into an
individual component. Such instances are a primary use case for the budget.
2024-08-21 20:47:31 +02:00
Alan Agius
e40384e637 refactor(@angular-devkit/build-angular): remove deprecated browserTarget
The `browserTarget` option has been removed as part of the refactoring process. This option was part of a private API and is no longer used. Projects relying on this option should migrate to using the `buildTarget` option.

BREAKING CHANGE: The `browserTarget` option has been removed from the DevServer and ExtractI18n builders. `buildTarget` is to be used instead.
2024-08-21 19:53:04 +02:00
Alan Agius
d6a34034d7 refactor(@angular/build): remove automatic addition of @angular/localize/init polyfill and related warnings
The logic that automatically added the `@angular/localize/init` polyfill has been removed.

BREAKING CHANGE: The `@angular/localize/init` polyfill will no longer be added automatically to projects. To prevent runtime issues, ensure that this polyfill is manually included in the "polyfills" section of your "angular.json" file if your application relies on Angular localization features.
2024-08-21 15:42:21 +02:00
Charles Lyding
7992218a9c fix(@schematics/angular): remove declaration and sourceMap from default tsconfig
The `declaration` TypeScript option has been removed from the default generated
`tsconfig` for new projects. This option was explicitly set to `false`. However,
the default value for the option is already `false`.
Also, the `sourceMap` option has been removed. Source map generation is controlled
by the build options and not the TypeScript configuration.
2024-08-20 23:57:15 +02:00
Charles Lyding
618fdea00b build: update Angular versions to 19.0.0-next.0 2024-08-14 16:15:35 -04:00
Angular Robot
94b331e667 build: update all non-major dependencies 2024-07-22 12:53:59 -07:00
Alan Agius
01c1ec087e build: update Angular dependencies to version 18.2.0-next.0 2024-07-10 16:00:13 +02:00
cexbrayat
4da922e4f4 feat(@schematics/angular): use isolatedModules in generated project
As 3acb7768317bb05a9cd73fa64e081b5ca0326189 introduced an optimization for projects that use `isolatedModules`,
this commit makes projects generated with `ng new` use this option by default.
2024-07-08 15:52:04 +02:00
Kristiyan Kostadinov
eb52981885 build: use TypeScript 5.5 for new projects and tests
Now that https://github.com/angular/angular/pull/56358 is on track for 18.1, we can use TypeScript 5.5 for newly-created projects and in tests.
2024-06-26 08:29:01 -07:00
Charles Lyding
fa9bce0e9a test: enable @typescript-eslint/no-unnecessary-type-assertion lint rule
The `@typescript-eslint/no-unnecessary-type-assertion` rule is now enabled and all failures
have been addressed within the code.
2024-06-25 16:57:03 -04:00
Alan Agius
aebfde28c7 build: update all non-major dependencies
Closes #27881
2024-06-25 20:53:49 +02:00
Charles Lyding
39f946a848 build: enabled isolated modules TypeScript option
The TypeScript `isolatedModules` option is now enabled for all TypeScript
code within the repository. As a result, all packages will now be built
with the option enabled. This does not affect projects created with the CLI
and is only related to the building of the actual Angular CLI code.
The `isolatedModules` option ensures that code can be emitted without the
TypeScript typechecker and allows tools other than TypeScript to potentially
be used. Code was updated to correct all errors after the option was enabled.
Additionally, some early code fixes were done to add function and accessor
return types to prepare for future `isolatedDeclarations` usage. More changes
would be needed to consider turning on `isolatedDeclarations`, however.
2024-06-23 15:34:49 +02:00
Kristiyan Kostadinov
d1c65a2109 build: update to TypeScript 5.5 stable
Updates the repo to the stable version of TypeScript 5.5. I'm holding off on updating the new projects to it due to https://github.com/angular/angular/pull/56358.
2024-06-21 10:26:09 +02: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
Kristiyan Kostadinov
be2227e7b9 build: update to the TypeScript 5.5 RC
Updates the repo to the release candidate of TypeScript 5.5.
2024-06-11 12:47:21 -04:00
Alan Agius
60b7c13bdd refactor: format bazel build files
The formatter does not automatically fix these failures.
2024-06-06 11:12:06 +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
jason zheng
9db7abd6bf refactor(@schematics/angular): remove unnecessary whitespace in spec template 2024-06-05 09:32:03 -07:00
David LJ
0fa7e91231 docs: update tsconfig template link aio->adev 2024-06-05 09:31:34 -07:00
Charles Lyding
22e05dcb4a fix(@schematics/angular): generate new projects with ECMAScript standard class field behavior
Newly generated projects will now use ECMAScript standard class field behavior by default.
If the legacy TypeScript behavior is required for a new project the `useDefineForClassFields`
TypeScript option can be set to `false` within the application's `tsconfig`. This should
be uncommon, and if needed, it is recommended to adjust code to match standard behavior where
possible.
2024-05-31 15:24:59 -04:00
Kristiyan Kostadinov
144f2bfcb2 build: update to TypeScript 5.5
Updates the repo to TypeScript 5.5. Since it's still in beta, we're only using 5.5 for our own build, but not for user projects.
2024-05-30 11:53:15 +02:00
Alan Agius
bc735c948f build: update framework packages to 18.1.0-next.0 2024-05-29 19:44:02 +02:00
Alan Agius
8ea94eb73c fix(@schematics/angular): set builders assets option correctly for new applications
This commit ensures that the `assets` option value accurately reflects the source location.

Closes: #27709
2024-05-28 11:03:46 +02:00
David LJ
d24b087eff docs: update browser support links aio->adev 2024-05-27 08:31:53 +02:00
Charles Lyding
3107ad7b83 fix(@schematics/angular): check both application builder packages in SSR schematic
The SSR schematic was previously only checking for the application build found
within the `@angular-devkit/build-angular` package which is only an alias to the
actual builder found in the `@angular/build` package. Both aliased and direct
usages are now checked when executing the schematic.
2024-05-27 08:03:28 +02:00
cexbrayat
d6af99601b fix(@schematics/angular): use angular.dev in readme 2024-05-23 09:24:11 -04:00
Charles Lyding
ebfd7b12ee refactor(@angular/cli): show optional migration name and documentation URL if available during updates
The optional migration selection prompt shown during an interactive
`ng update` will now show the name of the migration which can be used
to manually run the update at a later time as well as a documentation link
if present for the migration.
2024-05-20 17:09:33 -04:00
Charles Lyding
c977a7b783 refactor(@schematics/angular): improve optional application migration description
The description for the optional application builder migration has been adjusted
to include an update adev link as well as a shorter first sentence which is used
as the content for the optional migration selection prompt.
2024-05-20 17:09:33 -04:00
Alan Agius
9e13a8b0c8 fix(@angular/build): format sizes using decimal byte units consistently
Ensure that file sizes are consistently formatted using decimal byte units, adhering to the International System of Units (SI) convention. This aligns with clarity and standardization across the project.

- Kilobyte (kB): 10^3 bytes (1000 bytes)
- Megabyte (MB): 10^6 bytes (1,000,000 bytes)
- Gigabyte (GB): 10^9 bytes (1,000,000,000 bytes)

Closes: #27580
2024-05-06 16:03:25 +02:00
Naji
f9dc761817 refactor(@schematics/angular): link for ignoring files
updates the broken link for `.gitignore` file
2024-05-06 10:29:35 +02:00
Charles Lyding
682b02e4a3 refactor(@schematics/angular): shorten application migration description
The description for the optional application builder migration is shown
within the optional migration selection prompt. The description is currently
fairly lengthy and can effect readability within a terminal. To improve
readability within the selection prompt, the description has been slightly
reworded and shortened.
2024-05-03 10:59:01 -04:00
Charles Lyding
511d876fb7 fix(@schematics/angular): add postcss dependency in application migration if needed
The application migration schematic will now attempt to detect the usage
of custom postcss plugins within a workspace and install the `postcss` dependency
if required. This will only occur if the migration analysis allows for
the conversion to use the `@angular/build` package instead of the
`@angular-devkit/build-angular` package. Custom postcss configurations will
be detected within the same locations as the build system itself which includes
the workspace root and any project root for the `postcss.config.json` and
`.postcssrc.json` files.
2024-05-02 09:59:06 -04:00
Charles Lyding
3dae3c03d1 fix(@schematics/angular): add less dependency in application migration if needed
The application migration schematic will now attempt to detect the usage
of Less stylesheets within a workspace and install the `less` dependency
if required. This will only occur if the migration analysis allows for
the conversion to use the `@angular/build` package instead of the
`@angular-devkit/build-angular` package. The Less usage detection may
not detect Less stylesheets within Node.js packages and currently does
not handle the case where a project only has inline Less stylesheets.
More complex analysis may be added in the future. However, a build time
error message will be presented with instructions to install `less` in
these cases if the stylesheet preprocessor is required and not present.
2024-04-29 14:05:36 -04:00
Charles Lyding
b0ec254c62 refactor(@schematics/angular): remove unneeded extract-i18n buildTarget option for new applications
The `buildTarget` option for the `extract-18n` builder will automatically
default to use the `build` target of the containing project. This removes
the need for projects to manually configure the target. New projects will
now be generated without this option in the `angular.json` file.
2024-04-29 12:10:39 -04:00
Charles Lyding
b2ac5fac7d feat(@schematics/angular): allow application migration to use new build package in projects where possible
When using the optional application build system migration, the newly
introduced `@angular/build` package which contains only the new build
system and no Webpack-related dependencies will be directly used when
possible. The migration will check for usage of any other builders from
the `@angular-devkit/build-angular` package. if none are present in the
`angular.json` file (excluding `dev-server` and `extract-i18n`), the
`@angular/build` package will be added as a dependency and used in the
`angular.json` file. The `@angular-devkit/build-angular` package will
then be removed as a dependency. Project usage of karma and/or protractor
will be the most common reasons this part of the migration will not be
performed.
2024-04-24 07:09:11 -04:00
Charles Lyding
23cc337aa3 fix(@schematics/angular): keep deployUrl option when migrating to application builder
The `deployUrl` option is now supported with the new build system
when using the `application` builder. The migration schematic
no longer needs to remove the option if present.
2024-04-24 07:09:11 -04:00
Alan Agius
e3f9f2b141 refactor: remove v17 migrations
This commit removes of migrations introduced in version 17

Closes ##26568, closes #27463
2024-04-18 15:09:24 +02:00
Alan Agius
2acf95a949 fix(@angular-devkit/build-angular): do not generate an index.html file in the browser directory when using SSR.
BREAKING CHANGE: By default, the index.html file is no longer emitted in the browser directory when using the application builder with SSR. Instead, an index.csr.html file is emitted. This change is implemented because in many cases server and cloud providers incorrectly treat the index.html file as a statically generated page. If you still require the old behavior, you can use the `index` option to specify the `output` file name.

```json
"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
      "outputPath": "dist/my-app",
      "index": {
        "input": "src/index.html",
        "output": "index.html"
      }
    }
  }
}
```
2024-04-10 17:00:50 +02:00
Alan Agius
a673baf5ce Revert "fix(@schematics/angular): rename SSR port env variable"
This reverts commit 950a44521fdfb82000f6564ccc4c87d4a2b94680.
2024-04-02 11:51:45 -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
7682a7145f build: address pre-release validation failure
Previously, the release process encountered an error due to ts-node's inability to transform `packages/schematics/angular/utility/latest-versions.ts`, resulting in the following error:

```
export const latestVersions: Record<string, string> & {
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1274:20)
    at Module._compile (node:internal/modules/cjs/loader:1320:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
    at async checkSchematicsAngularLatestVersion (file:///usr/..../git/angular-cli/scripts/release-checks/dependency-ranges/latest-versions-check.mts:9:46)
```

To resolve this issue, we now utilize the `package.json` directly to retrieve dependency versions.
2024-03-26 16:38:42 +01: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
Paweł Kubiak
950a44521f fix(@schematics/angular): rename SSR port env variable
Rename the SSR port env variable to SSR_PORT.
It could help to resolve this firebase issue: https://github.com/firebase/firebase-tools/issues/6651#issuecomment-1881647322, cause PORT is reserved environment variable: https://firebase.google.com/docs/functions/config-env?gen=2nd#reserved-names.
2024-03-22 13:23:31 -04:00