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: npm init alias #597

Merged
merged 3 commits into from
Sep 6, 2022
Merged

feat: npm init alias #597

merged 3 commits into from
Sep 6, 2022

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Sep 6, 2022

🧰 Changes

Per the npm init docs, we can utilize the @readme namespace to do fancy things like:

npm init @readme

which would run the following:

npx @readme/create

This PR creates that @readme/create repo and aliases it to rdme openapi --github, but we might wanna do something fancier at some point. Also should this be versioned the same as rdme? Lots of open questions, but figured I'd open this PR to get the conversation started.

@kanadgupta kanadgupta added enhancement New feature or request command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands labels Sep 6, 2022
@kanadgupta kanadgupta requested a review from erunion September 6, 2022 22:31
"name": "@readme/create",
"version": "0.0.1",
"description": "Sync your OpenAPI definition to ReadMe",
"bin": "../../bin/rdme openapi --github",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this will work if you pull @readme/create down as it'll try to run ../../bin/rdme on your machine.

Copy link
Member Author

Choose a reason for hiding this comment

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

how is it any different than what's being done in this line?

"rdme": "bin/rdme"

Copy link
Member Author

Choose a reason for hiding this comment

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

ohhh wait I think I know what you mean. I bet it's not even installing rdme to begin with. duh

Copy link
Member

Choose a reason for hiding this comment

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

If we publish @readme/create to npm we only publish what's in packages/create, which won't include the bin directory.

Copy link
Member

Choose a reason for hiding this comment

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

Can we use npx here at all?

"bin": "npx rdme openapi --github"

Copy link
Member Author

Choose a reason for hiding this comment

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

jinx lol a856904

Copy link
Member

Choose a reason for hiding this comment

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

Or @readme/create can just have rdme@latest as a dependency and then we can call that from an index.js file like they do in create-react-app:

Copy link
Member Author

Choose a reason for hiding this comment

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

the commit I just pushed feels a little lighter than the CRA approach—are there any upsides besides the ability to write internal comments?

Copy link
Member

Choose a reason for hiding this comment

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

Nah, if the commit you pushed worked I'm cool w/ that.

Copy link
Member Author

Choose a reason for hiding this comment

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

the thing is I have no idea how to test it lol

@kanadgupta kanadgupta merged commit c8d0b02 into main Sep 6, 2022
@kanadgupta kanadgupta deleted the feat/npm-init-alias branch September 6, 2022 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants