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

Create new Ink app in a new directory #11

Merged

Conversation

kevin940726
Copy link
Contributor

Close #1.

Added support to pass a new input <project-directory> indicating where the project should be scaffolded in. Currently the input is optional, the current directory will be the default if it's not present, so that we can make this feature backward-compatible. In the future, we should at least add a warning if the input is not passed.

I also added some basic helpful message upon successfully created an app. Wordings are TBD.

Example:

create-ink-app # Create an Ink app in the current working directory
create-ink-app . # Same as above
create-ink-app my-cli # Create an Ink app in the "my-cli" directory relative to the current working directory
create-ink-app --typescript my-cli # Typescript template also works

I intentionally move some logic to cli.js so that in the future we can support programmatic API by directly importing index.js as well.

Copy link

@brunos3d brunos3d left a comment

Choose a reason for hiding this comment

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

Nice job 🚀

# Or create with TypeScript React
$ npx create-ink-app --typescript
$ npx create-ink-app --typescript my-fancy-ts-cli
Copy link

Choose a reason for hiding this comment

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

Suggested change
$ npx create-ink-app --typescript my-fancy-ts-cli
$ npx create-ink-app my-fancy-ts-cli --typescript

@brunos3d
Copy link

brunos3d commented Apr 2, 2021

What do you think of a --template flag like in create-react-app?

It would be interesting if the value received in the template argument matches the name of the template folder in the templates directory of this project ->

Example:

npx create-ink-app my-fancy-ts-cli --template typescript-eslint

The templates folder

# ...
templates
 |- _common
 |- js
 |- ts # rename to "typescript"
 |- typescript-eslint
   |- # ...
   |- tsconfig.json
   |- .eslintrc
   |- # ...
# ...

Copy link

@mattferrin mattferrin left a comment

Choose a reason for hiding this comment

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

I didn't test anything. I left 1 suggestion. I didn't notice anything concerning that should prevent merging.

`,
{
flags: {
typescript: {

Choose a reason for hiding this comment

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

I would recommend making "project-directory" a flag too. It seems safer than accessing it as index 0.

cli.input[0] seems fragile if for some reason something is misaligned and at position cli.input[1] instead.

Choose a reason for hiding this comment

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

(I don't feel strongly about this.)

Copy link

@mattferrin mattferrin Dec 18, 2022

Choose a reason for hiding this comment

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

I retract my suggestion. Convenience is more important. (I like the way you have it.)

@vadimdemedes
Copy link
Owner

Thanks @kevin940726 👍

@vadimdemedes vadimdemedes merged commit d73c1ab into vadimdemedes:master Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should create in named folder, not current folder
4 participants