32 Commits

Author SHA1 Message Date
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
George Kalpakas
1199205bc2 feat(@schematics/angular): augment universal schematics to import platform-server shims
In angular/angular#40559, a new `@angular/platform-server/init`
entry-point was introduced, which can be used to initialize the server
environment by providing shims for APIs normally provided by the browser
(such as DOM globals).

If the project is using a version of Angular (and thus
`@angular/platform-server`) that is known to include this new
entry-point, the newly generated `main.server.ts` file should import it
at the top in order to ensure that the shims will be available as soon
as possible (before other direct or transitive imports that may rely on
them). See also angular/angular#40559 for more details.

NOTE:
This `universal` schematic is the base for `app-shell`,
`@nguniversal/express-engine` and `@nguniversal/hapi-engine`.

Fixes angular/angular#40559
2021-02-18 19:31:40 +01:00
Alan Agius
0bc15970ad refactor(@schematics/angular): use jsonc-parser instead of devkit parser 2020-11-05 08:31:02 +01: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 #18040 and closes #18170
2020-08-12 19:26:12 +01:00
Alan Agius
cc87202710 fix(@schematics/angular): don't add e2e tsconfig reference in solution tsconfig
Since the tsconfig for e2e’s is named tsconfig.json there is no reason why it should be included in the solutions typescript configuration file.

Closes #18190
2020-07-13 12:17:24 -04: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
d50a2fef2f fix(@schematics/angular): use ES2016 as syntax target for server bundles
The supported versions of Node.js support up to ES2018, the only reason why we don't use ES2017+ is because native `async` and `await` don't work with zone.js

See: https://github.com/angular/angular/issues/31730

With this change, we also ensure that we don't downlevel the server bundle to ES5 which is unnecessary.

Closes: #17794
2020-06-01 14:53:37 -04: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 #17493 and closes #8138
2020-05-20 12:12:33 -07:00
Alan Agius
a2b158be88 feat(@schematics/angular): enable lazy loading on the server for new projects
With this change, lazy-loading on the server becomes enabled out of the box for new projects. This is because webpack will only split ES6 imports into separate chunks. However when using commonjs all lazy loaded paths will be concatenated into the main.js file.
2020-04-02 10:25:04 -07:00
Alan Agius
aa6aee1ac1 fix(@schematics/angular): universal add outputHashing to media
In case the browser builder hashes the assets we need to add this setting to the server builder as otherwise when assets it will be requested twice. One for the server which will be unhashed, and other on the client which will be hashed.

Closes #15953
2019-10-29 20:21:24 -07:00
Alan Agius
fca9cbe6fd feat(@schematics/angular): update browser output path when adding universal
Currently, in the CLI universal schematic we are setting the server output path to `dist/project-server` and not amending the build outputPath

Ex:
```
dist/project
dist/project-server
```

However, the above paths are being update when adding `nguniversal` to the below:

```
dist/project/browser
dist/project/server
```

With this change it is proposed to move that logic to upstream.

Related PR to clean up nguniversal schematics https://github.com/angular/universal/pull/1265
2019-09-30 13:56:46 -07:00
Alan
640ae2fdf8 feat(@schematics/angular): augment universal/app-shell addition for @angular/localize
If i18n support is already present within an application, the newly generated `main.server.ts` file should also contain the `@angular/localize` polyfill to allow the universal application to function.

This universal schematic here, is the base for app-shell, @nguniversal/express-engine, and @nguniversal/hapi-engine
2019-09-25 09:46:41 -07:00
Alan Agius
63248e32ef feat(@schematics/angular): add node types to universal tsconfig (#15594)
By default we disable types inclusion in tsconfig.app.json which this tsconfig extends from
2019-09-13 16:35:22 -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 Agius
0551360035 fix(@schematics/angular): exclusively list the files in tsconfigs (#15030)
* test: update tests to work with new stricter tsconfig file inclusions

* fix(@schematics/angular): exclusively list the files in tsconfigs

With the omission of `includes` or `files` in tsconfig files tsc will pick up all the files under the rootDir and make them as part of the compilation. In certain cases, redundant files will be picked up which will cause a slower compilations.

Related to: TOOL-949
2019-07-16 11:04:29 -07:00
Alan Agius
d0f2cc3b68 fix(@schematics/angular): add commonjs module to universal tsconfig (#15090)
The universal tsconfig extends the application tsconfig which by default it's module format is ES2015. While NodeJS 12 does support this, older versions of Node don't
2019-07-16 09:58:44 -07:00
Filipe Silva
97970026f1 ci: add circleci windows preview 2019-06-06 16:02:17 -07:00
Alan Agius
ac23dc0913 fix(@schematics/angular): tsconfig with comments breaks universal schematic
Fixes #14371
2019-05-09 10:09:21 -07:00
Charles Lyding
ca1ecb027d test(@schematics/angular): ensure application schematic is run async 2019-04-16 11:23:48 -07:00
Charles Lyding
e075edf8b4 refactor(@schematics/angular): update universal to use new workspace rules 2019-04-15 11:02:46 -07:00
Alan Agius
10fb461829 fix(@schematics/angular): remove baseUrl from universal tsconfig
The baseUrl is used for non relative module imports, and we should always use the baseUrl set in the workspace tsconfig. When having path mappings set at workspace level and setting a `baseUrl` in the server tsconfig, this paths will no longer work as paths mapping as relative to the baseUrl.

Fixes #13935
2019-03-19 09:27:55 -07:00
Alan
a7d095d916 feat(@schematics/angular): change layout for root applications
This change aligns the file layout of applications generated with `ng new` and `ng generate`

Ref: TOOL-686
2019-03-06 11:28:26 -08:00
Alan
4718de4dae feat(@schematics/angular): only support known style extentions
Fixes #13149
2019-01-18 11:56:19 -08:00
Moritz Benzenhöfer
506401264b fix(@schematics/angular): fix syntax error in main.ts after generating universal
Add missing curly brace for application boostrap wrapper and test
Fixes #13392
2019-01-11 14:07:25 -08:00
Alan
a875b61b71 fix(@schematics/angular): wrapping bootstrap code in a DOMContentLoaded in variable declaration
Fixes #13042
2018-12-26 12:29:41 -08:00
Charles Lyding
57c049e507 test: update to support targets & architect fields 2018-09-13 16:43:31 -07:00
Bram Borggreve
a94c826661 feat(@schematics/angular): let Universal schematic use configurations from build architect 2018-09-06 08:45:22 -07:00
Filipe Silva
9720077a4b build: make resolution logic compatible with Bazel 2018-08-22 16:36:10 -07:00
Filipe Silva
38fda3ea60 fix(@schematics/angular): support updating projects that use the targets property 2018-07-25 20:17:33 +01:00
Filipe Silva
b8cecbbb3c feat(@schematics/angular): use es2015 modules overall
This change helps to keep the behaviour of build/serve/test consistent by using the same import semantics in all of them.
2018-06-13 22:33:32 +01:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00