Skip to content

Add command to create empty file #3373

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

Closed
johnpapa opened this issue Dec 3, 2016 · 9 comments
Closed

Add command to create empty file #3373

johnpapa opened this issue Dec 3, 2016 · 9 comments
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@johnpapa
Copy link
Contributor

johnpapa commented Dec 3, 2016

OS?

Mac OSX Sierra

Versions.

angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

Suggestion

Add "ng g e bar" command that creates an empty file with .ts as default extension

Useful for creating files that there are no templates for.

e.g.

typings.d.ts
rxjs-extensions.ts

This might useful for creating scripts that generate projects, like this

# ng new event-view -p ev -sn
#####################
cd event-view
echo *** turn off spec generation ***
ng set defaults.spec.class false
ng set defaults.spec.component false
ng set defaults.spec.directive false
ng set defaults.spec.module false
ng set defaults.spec.pipe false
ng set defaults.spec.service false
echo *** work on the shared folder ***
ng g m core
rm src/app/core/core.component.*
ng g s core/auth-guard
ng g cl core/can-deactivate-guard
ng g cl core/config
rm src/app/core/config.spec.ts
ng g s core/entity
ng g s core/exception
ng g s core/message
ng g s core/module-import-guard
ng g cl core/preload-strategy
ng g cl core/rxjs-extensions
ng g s core/user-profile
ng g m core/modal
ng g s core/modal
ng g m core/nav
ng g m core/spinner
ng g s core/spinner
ng g m core/toast
ng g s core/toast
ng g cl core/rxjs-operators
...
@johnpapa
Copy link
Contributor Author

johnpapa commented Dec 3, 2016

I feel the CLI should work the same (as close as we can) on either OSX or Windows. This way we can create scripts that work in either environment and generate projects. This feature would help that parity.

@naomiblack
Copy link
Contributor

I've deleted comments on this issue that were in violation of Angular's Code of Conduct and banned the user in question.

@filipesilva
Copy link
Contributor

I see how it can be useful as a simple command for scripts, and as something of a conceptual proto generator. In the future it would be nice to extend the AST codegen to create all generators from a base one and this could be it.

What do you think @Brocco?

@filipesilva filipesilva added command: generate P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Dec 4, 2016
@deebloo
Copy link
Contributor

deebloo commented Dec 5, 2016

@naomiblack thank you :)

@Brocco
Copy link
Contributor

Brocco commented Dec 5, 2016

I struggle to see the usefulness of this feature. The power of blueprints IMO are to create boilerplate code to get you coding faster. All IDEs/editors provide this functionality, so I struggle to see the added benefit of adding it into the CLI. I'm not against it, just not convinced based upon the script example from @johnpapa above.

Using a script to create an application is something that very few people will actually use, especially when that script could do the same thing via touch bar.ts.

@JanStureNielsen
Copy link

@johnpapa -- could you use echo $null >> somefile.ts to create your empty file? This should work on OSX and Windows as well as Linux, but I can only vouch for Linux... To me, folding this type of work into Angular CLI moves away from the tool's core mission, but I have the luxury of only needing Linux. :-D

@johnpapa
Copy link
Contributor Author

johnpapa commented Dec 5, 2016

The only use case I have for this is scripting for file creation. If that is not something in scope, I agree that this can be closed @Brocco .

I'm fine using OS commands to do it, if there are no other requests for it.

Feel free to close if you wish

@Brocco
Copy link
Contributor

Brocco commented Dec 5, 2016

Closing for now, but if there's more feedback about adding this feature we can re-evaluate.

@Brocco Brocco closed this as completed Dec 5, 2016
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

No branches or pull requests

6 participants