Skip to content

feat(@angular/create): add support for yarn create and npm init #23492

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

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 4, 2022

With this change we add support to scaffold an Angular workspace using yarn create @angular and npm init @angular. These shortcuts support all of the ng-new options.

Closes #10339 and closes #14292

@alan-agius4 alan-agius4 added the needs: discussion On the agenda for team meeting to determine next steps label Jul 4, 2022
@alan-agius4
Copy link
Collaborator Author

alan-agius4 commented Jul 4, 2022

Points to discuss:

  1. should we have a snapshot build for the new package?
  2. should it be yarn create angular or yarn create @angular? We do own create-angular.

@alan-agius4 alan-agius4 force-pushed the angular-create branch 3 times, most recently from 85d6c91 to fc506e0 Compare July 4, 2022 11:29
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Jul 4, 2022
@alan-agius4 alan-agius4 marked this pull request as ready for review July 4, 2022 13:42
@alan-agius4 alan-agius4 requested a review from dgp1130 July 4, 2022 13:42
@eneajaho
Copy link
Contributor

eneajaho commented Jul 6, 2022

yarn create angular looks cleaner and is easier to remember than using @angular.

@brandonroberts
Copy link
Contributor

Seconded for yarn create angular

@chihab
Copy link

chihab commented Jul 6, 2022

Would the result be the same as doing npx @angular/cli new ...?

@alan-agius4
Copy link
Collaborator Author

Would the result be the same as doing npx @angular/cli new ...?

Yes

Copy link
Collaborator

@dgp1130 dgp1130 left a comment

Choose a reason for hiding this comment

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

I was going to chat about this in one of the triage meetings, but since we've skipped a couple times I'll just respond here.

  1. should we have a snapshot build for the new package?

I don't feel too strongly about this. Any particular reasons we do / don't want a snapshot build? I get that it probably wouldn't be very useful in an unpublished context, not sure if npm init or yarn create have a means of pulling an unpublished package for testing.

  1. should it be yarn create angular or yarn create @angular? We do own create-angular.

My feeling is that @angular is more "obviously secure". Most of our packages are under @angular/* so users should feel more confident that npm init @angular is a safe operation than npm init angular would. I don't think there's any guarantee that angular and create-angular are owned by the same group, so I would be much more hesitant to type npm init angular (fortunately we do own that and it is safe, but there's no way for a user to know that without looking).

We should definitely update npm init angular to at least fail with a clear message and suggest using npm init @angular since that is a very easy mistake to make.

NPM

```
npm init @angular@latest [project-name] -- [...options]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Is @latest necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, for NPM this is needed as otherwise if this command was previously used, the cached binary will be used.

@alan-agius4
Copy link
Collaborator Author

alan-agius4 commented Jul 12, 2022

I don't feel too strongly about this. Any particular reasons we do / don't want a snapshot build? I get that it probably wouldn't be very useful in an unpublished context, not sure if npm init or yarn create have a means of pulling an unpublished package for testing.

That's a good point, let's not do the snapshot build for now, if needed we can do that at a later stage.

My feeling is that @angular is more "obviously secure". Most of our packages are under @angular/* so users should feel more confident that npm init @angular is a safe operation than npm init angular would. I don't think there's any guarantee that angular and create-angular are owned by the same group, so I would be much more hesitant to type npm init angular (fortunately we do own that and it is safe, but there's no way for a user to know that without looking).

We are on the same page here.

We should definitely update npm init angular to at least fail with a clear message and suggest using npm init @angular since that is a very easy mistake to make.

I can do a quick script and just publish to NPM repo manually.

@alan-agius4 alan-agius4 removed the needs: discussion On the agenda for team meeting to determine next steps label Jul 12, 2022
With this change we add support to scaffold  an Angular workspace using `yarn create @angular` and `npm init @angular`. These shortcuts support all of the `ng-new` options.

Closes angular#10339 and closes angular#14292
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Jul 12, 2022
@dgp1130 dgp1130 merged commit cfe93fb into angular:main Jul 12, 2022
@alan-agius4 alan-agius4 deleted the angular-create branch July 12, 2022 18:00
@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 Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support npm init @angular shortcut Add more support to yarn create
5 participants