Skip to content
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): Add the option to create an empty workspace #12223

Merged
merged 1 commit into from
Sep 26, 2018

Conversation

Brocco
Copy link
Contributor

@Brocco Brocco commented Sep 10, 2018

Fixes #12216

packages/schematics/angular/ng-new/index_spec.ts Outdated Show resolved Hide resolved
packages/schematics/angular/ng-new/schema.d.ts Outdated Show resolved Hide resolved
@@ -131,6 +131,12 @@
"type": "boolean",
"default": false,
"alias": "S"
},
"empty": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, what do you think about reversing the logic, so that the options all represent positives? Otherwise it feels like it's added retroactively

  • new option would be createProject or similar
  • it defaults to true
  • if you want an empty project you do ng new --createProject=false (or do we support ng new --noCreateProject?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually disagree with this. I think the default should be negative and the options "turn them on"
As a user the cognitive load of turning on "empty" via --empty is easier that the idea of "create project false" via `--noCreateProject".

This is the same approach for most CLI tools I've used.

deleting a directory: rm -rf where you're setting recursive and force to true
pushing a branch git push origin some-branch -f sets force to true

Taking this to the next level, I think a standardization of the provided boolean options for schematics and architect should be done at some point. It will provide consistency to users about how to use any of the available boolean options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is, imagine you didn't know what is the current behavior of Angular CLI.

There is a command that creates a new workspace, it can optionally also create a project.

Empty is the natural default state of the new workspace. The option --createProject also does a second step of populating the new workspace.

When I say negative, I mean that --empty is saying that there's something that should not be created.

Now, it so happens that for backwards compat, our users expect that --createProject should be the default since that matches what we do today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I certainly concede to that idea, but one of the principles on which the CLI was started (at least in my eyes) was to get started quickly by reducing the barrier to entry. With that being said, I think the idea of changing the default behavior of ng new to not create a project would be a mistake.

Also, I think this conversation could/should be moved over to the actual issue for historical purposes.

@ngbot
Copy link

ngbot bot commented Sep 18, 2018

Hi @Brocco! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@alexeagle alexeagle added the needs: discussion On the agenda for team meeting to determine next steps label Sep 19, 2018
@alexeagle
Copy link
Contributor

I added a comment on the attached issue, good point about keeping discussion there

@alexeagle
Copy link
Contributor

Discussed in team meeting, we'd like the new option to be --createApplication and it defaults to true.

We decided having positive flags outweighs the desire to have defaults be false.

@alexeagle alexeagle removed the needs: discussion On the agenda for team meeting to determine next steps label Sep 20, 2018
@Brocco
Copy link
Contributor Author

Brocco commented Sep 20, 2018

Thanks @alexeagle I will update the PR to reflect that decision.

@Brocco
Copy link
Contributor Author

Brocco commented Sep 20, 2018

Possible 3rd option...

instead of having a boolean create an enumeration option named project that can have 3 potential values...
application (default)
library (would create just a library)
none (which would create an empty workspace)

@alexeagle
Copy link
Contributor

fine with me to have --createProject=[application,library,none]
so long as there isn't much extra code to handle the --createProject=library case

@hansl
Copy link
Contributor

hansl commented Sep 26, 2018

Leaving this opened, but it seems it will miss the 7.0 RC deadline. I'll keep it on our backlog so we can look at it again around 7.1. Cheers!

@alexeagle alexeagle added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Sep 26, 2018
@alexeagle alexeagle added target: major This PR is targeted for the next major release and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Sep 26, 2018
@alexeagle alexeagle merged commit b16cb27 into angular:master Sep 26, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
@Brocco Brocco deleted the empty-workspace branch November 28, 2022 02:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow creating a workspace without any projects
4 participants