New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(@schematics/angular): Implement a standalone flag for new applications #24848
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Brocco great work, thanks! 👍 Just left a few minor comments.
...s/schematics/angular/application/files/other-standalone-files/app.component.spec.ts.template
Outdated
Show resolved
Hide resolved
...s/schematics/angular/application/files/other-standalone-files/app.component.spec.ts.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/files/standalone-files/src/index.html.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/files/standalone-files/src/main.ts.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/files/standalone-files/src/main.ts.template
Outdated
Show resolved
Hide resolved
...s/schematics/angular/application/files/other-standalone-files/app.component.spec.ts.template
Outdated
Show resolved
Hide resolved
tests/legacy-cli/e2e/tests/generate/application/application-standalone.ts
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,14 @@ | |||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the files in module-file
and standalone-files
are the same 6 out of the 8 files. Can we have these into a separate directory and re-use it instead of have them multiple times?
My concern here is that certain files should always be the same irrespective if users select standalone and not. But we already started diverging example the index.html file is not identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined most of the files to a set of common directories, but kept a few separate in order to not overly complicate the internal logic.
packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template
Outdated
Show resolved
Hide resolved
tests/legacy-cli/e2e/tests/generate/application/application-standalone.ts
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/files/standalone-files/src/main.ts.template
Outdated
Show resolved
Hide resolved
Hello, this is great 🔥 I have a question, isn't it better to have the config directly in the bootstrapApplication(AppComponent, {
providers: [
provideRouter()
]
}) This way we don't need another file like I understand that Things like router or http client or animations, are setup only once, and changed very little during development, that's why I think it's better to have them in one file in EDIT: Also, that's the default behavior of the migration schematic, put providers in the |
145214d
to
693857a
Compare
@eneajaho the decision to put these dependencies in app.config (or app.routes) is to keep them closer to the application in the app directory. This location parallels the location of app.module. Also by keeping it outside of main.ts for the browser will allow the same configuration to be used for apps taking advantage of universal which creates a main.server.ts file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we can still simply the schematic greatly. But let's do that in a followup to unblock the other schematics.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The ability to create an application without the use of NgModules does not exist.
Issue Number: #23976
What is the new behavior?
The flag
--standalone
is added to both theng new
command as well asng generate application
schematic.Does this PR introduce a breaking change?
Other information