-
Notifications
You must be signed in to change notification settings - Fork 422
Add vercel/pkg to create standalone CLI #152
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
Conversation
|
Since this commit adds megabytes of code and data to the repository, I wonder if there is a better way. My assumption is that either users will check out this repository and build the cli manually, or there will be a workflow that will rebuild the cli for each release and publish the artifact somewhere. Either way, since the I can think of two possibilities:
I think 2 would be better since maintaining the gitignore would be complex. Though, I may be missing some context here and my comment isn't relevant. So, please take that into consideration. |
|
Worth noting the I've not used sub-packages before. Do you have a link to any documentation? Or otherwise feel free to open a PR to do this if that's easier. |
|
All I mean by subpackage is just creating a sub-directory maybe called |
fe0fc1e to
3c5b7fb
Compare
|
That worked out really nicely. I've created a One commit in this PR updates the |
|
@aeisenberg are you ok if I assign you to review formally? |
|
Glad it worked out. 😄 Taking a look now. |
|
Congratulations on winning the prize for having the single most productive PR I have ever seen. 🤣 |
Thanks! I only just spotted the CI is failing. I think I've just misconfigured it as I've had it working on this branch today. I don't think it's a major problem. |
| "private": true, | ||
| "description": "CodeQL action - CLI packaging", | ||
| "scripts": { | ||
| "build-cli": "webpack --mode production && pkg dist/code-scanning-cli.js --out-path dist" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this script here, I think you also need to change the cli.yml workflow to point here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I hadn't updated cli.yml. I think there was also a problem because I left the build-cli script definition in the top-level package.json. Anyway I've fixed both these points now.
|
|
||
| module.exports = { | ||
| entry: './src/cli.ts', | ||
| entry: '../src/cli.ts', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this cli.ts file isn't related to the actual action code, perhaps it should be moved to the packaging directory. Not necessary, but I think it would help enforce a distinction between the action code and the cli code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. Having all the source together is also useful. I'd like to at least defer it. If we did this I'd like to also split the actions code out from the shared code as I think that would get us more benefit, but that will be much more difficult.
|
Also, it looks like this commit only adds the upload command to the cli. Are you planning on adding the remaining commands as well? |
Yes, the CLI is only partially implemented. The other parts will be coming this week. |
aeisenberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Seems to be working for me.
Adds https://github.com/vercel/pkg which can be used to create a standalone CLI binary. This seems to work and I was able to run the linux version it produces on a system without nodejs installed. It also produces binaries for other operating systems which I haven't yet tested but I have no reason to believe they won't work.
The only downside is the size of the executables, but I'm not sure there's anything we can do about this:
Merge / deployment checklist