Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Conversation

@macklinu
Copy link
Contributor

@macklinu macklinu commented Feb 28, 2019

Please squash and merge this PR when ready to avoid merging so many intermediate commits. ❤️

Why?

Resolves #54, and because it's fun to improve developer experience. 😄

How?

bin/cli.js is now the CLI entrypoint. It requires bin/create-action.js, which is a Promise that parses CLI arguments, reads files, writes files, and prompts the user for information to fill out the required metadata for their GitHub Action.

bin/create-actions.js has been split out into its own file so that the Promise function is unit testable on its own.

This PR also includes the scripts/update-feather-icons.js, which pulls a list of feather icon names that can be selected during the CLI prompt.

I suggest pulling down this branch and playing around with the new CLI experience - feedback is definitely welcome on UI/messaging in the CLI.

Test scenarios:

Locally, I have been running node path/to/actions-toolkit-repo/bin/cli.js, which is essentially what npx actions-toolkit will run for users of this CLI.

  • npx actions-toolkit without args should display help message
  • npx actions-toolkit --help should display help message
  • npx actions-toolkit <directory-name> should start the CLI prompt to ask for name, description, etc.
    • finish the prompt flow and ensure a new actions-toolkit directory is bootstrapped, and that you can npm install it successfully
    • also, try canceling during that prompt to see a cancellation message (not sure if necessary)

  • Tests have been added/updated (if necessary)
  • Documentation has been updated (if necessary)

@JasonEtco
Copy link
Owner

This is lookin' great so far @macklinu 😍 also the first time I've seen a draft PR from a fork, I dig it. Thanks for doing this and for the super helpful hints above ❤️

Copy link
Contributor Author

@macklinu macklinu left a comment

Choose a reason for hiding this comment

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

Alright @JasonEtco, getting much closer to a final review. I think one more review of the architecture and tests here would be helpful to make sure I'm still going in the right direction. If anything is confusing, please comment and I can explain further (both with PR comments and perhaps some code comments to help explain some of the mocking stuff, if that'd help).

Based on this PR's feedback, I should be able to finish this up likely early next week. Thanks! 🎨

@macklinu
Copy link
Contributor Author

macklinu commented Mar 6, 2019

I'm about one pass away from requesting a full review. Should be able to take another look today or tomorrow. 👍

@macklinu macklinu marked this pull request as ready for review March 8, 2019 00:52
@macklinu macklinu changed the title WIP: Create CLI questionnaire Create CLI questionnaire Mar 8, 2019
Copy link
Contributor Author

@macklinu macklinu left a comment

Choose a reason for hiding this comment

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

@JasonEtco this is ready for review! 😸 Left some inline comments, and I also updated the PR description to further explain my decisions and some manual test cases I've run to test this feature locally.


const createAction = require('./create-action')

createAction(process.argv.slice(2))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now the main CLI entrypoint - also defined in package.json.

@JasonEtco
Copy link
Owner

This is amazing @macklinu. Thanks for the time and effort you've put into this work ❤️ I did some light reviewing, but I'll dedicate some time soon for a full review - hopefully we'll be able to wrap this up and get it merged next week 🤞

@macklinu macklinu mentioned this pull request Mar 10, 2019
2 tasks
@macklinu macklinu force-pushed the cli-questionnaire branch from 97e1417 to fc3dd0b Compare March 14, 2019 18:46
@macklinu
Copy link
Contributor Author

@JasonEtco rebased against master and pushed up a commit to address the most recent PR comments. 👍

@JasonEtco
Copy link
Owner

Ok so I've given this a real review @macklinu - its really solid, the experience is 👌. The one thing I want to improve is the logging - we're using console.log and it looks kinda funny next to Enquirer's fancier, bold/green logs. Fortunately, we have Signale already available to us. Here's what it looks like in 9bbf52d:

image

Unfortunately, this totally borks in tests - I've tracked it down to be caused by the mock fs, since Signale tries to use it internally. I'm actually happy this came up, because I'm not sure that mocking fs is a good thing anyway - it means we're relying on our mocked logic instead of how fs really works. So, I think we should update the tests to instead read/write to/from real files in a fixtures folder. It'll make for more realistic tests, despite being a little more effort to delete/create the files as needed.

@JasonEtco
Copy link
Owner

@macklinu I'd love to get this into v2.0.0 in #62 - I can take over the changes if you'd like, or you can carry it over the finish line. I'm really hoping to publish v2 this upcoming weekend 🤞

@macklinu
Copy link
Contributor Author

macklinu commented Mar 22, 2019 via email


exports[`creates project with labels passed to Dockerfile from questionnaire: package.json 1`] = `
{
"name": "__tmp/my-project-name",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure this is desired and might be an implementation bug? Check out this test - essentially it runs:

npx actions-toolkit __tmp/my-project-name

Which would create a folder a couple of levels deep. Might be a bug or perhaps a side-effect of my test implementation and would love another set of eyes on this. 👀 ❤️

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting... so when I try running that, it gives me a "__tmp doesn't exist" when it tries to make the my-project-name dir (which makes sense).

That said, I think its fine? Thanks for calling it out 🙏

Copy link
Owner

@JasonEtco JasonEtco left a comment

Choose a reason for hiding this comment

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

From my perspective, this is good to 🚢 thanks a million for your hard work @macklinu - seriously, this is a great enhancement and took a lot of effort ❤️ Because of the complexity of the PR, I'll hold off until you give me a 👍 to merge, just to make sure there's nothing else you're looking to do. 🎉

@macklinu
Copy link
Contributor Author

Nothing else I’m looking to do here - thanks for your help in collaborating on this feature with me! 😀👏

@JasonEtco JasonEtco merged commit 9919555 into JasonEtco:master Mar 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants