-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): make appRoot customizable #7775
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
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.
Only a few minor things.
@hansl has done some work on appRoot changes recently, so I'd like him to review as well.
const appRoot = path.join(sourceDir, 'app'); | ||
|
||
const p = options.appConfig.appRoot === undefined ? 'app' : options.appConfig.appRoot; | ||
const appRoot = path.join(sourceDir, options.appConfig.appRoot); |
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.
Creating local variable p
with the determined root, but tot using it within the join
on line 18
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.
Fixed it. Bad rebase.
@@ -1,5 +1,5 @@ | |||
// tslint:disable:max-line-length | |||
import { mkdirsSync, pathExistsSync, readFile, readFileSync } from 'fs-extra'; | |||
import { mkdirsSync, pathExistsSync, readFile, readFileSync, writeFileSync } from 'fs-extra'; |
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.
New import is not being used.
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.
Fixed it
tests/helpers/index.ts
Outdated
@@ -16,6 +20,17 @@ export function setupProject() { | |||
}); | |||
} | |||
|
|||
function addAppToProject(): Promise<any> { |
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.
Not required, but would be nice to have:
Add parameter(s) here to specify values for the app being created.
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.
My thinking is: since this function is called by a single caller, it would make it unnecessary complex.
But I can make a change, if you think it is better this way.
1dea1bf
to
10b0478
Compare
10b0478
to
e6b1eb6
Compare
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.
LGTM
i want create three different application, and first secenrio merge three and other one first and second merge, how its possible? |
i created three app folder (app, newapp1,newapp2), seperate module, and developed three team seperaetly. |
i need ng generate module in newapp folder? how it is possble? |
@Brocco I think the wiki for config schema should be updated accordingly。 https://github.com/angular/angular-cli/wiki/angular-cli For I just come to this issue from that wiki. Thx~ |
How would you target a new module or component to a specific app? I guess this works "ng g module app2/new-module" |
How do I use this? Is there any documentation on appRoot? |
Most ng subcommand have an option "--app" to specify the name of app. No document get updated as I mentioned above. But you can use it this way for an app "common" sibling to the default "app". },
{
"name": "common",
"appRoot": "common",
"root": "src",
"tsconfig": "tsconfig.app.json", |
Do you have any idea how we have to configure with Angular 6 "angular.json" config? Thank you very much! |
Using |
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. |
Currently, the CLI hardcodes appRoot to
app
, which is a reasonable default.In complex projects with many apps (some of which aren't actually bundles shipped to the client), the prefix gets in a way. It looks awkward.
Using schematics we can generate apps that do not follow the default. Currently if you do that,
ng generate
won't work for those apps.The PR changes the CLI to allow the provisioning of
appRoot