-
Notifications
You must be signed in to change notification settings - Fork 285
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
npm init neon --lib
#1014
npm init neon --lib
#1014
Conversation
@@ -11,7 +11,7 @@ function readChunks(input: Readable): Readable { | |||
}); | |||
input.on("close", () => { | |||
output.write(decoder.end()); | |||
output.destroy(); | |||
output.end(); |
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.
The .destroy()
call happened to work in the past but wasn't the right method to use, and it broke in more recent versions of Node.
…mport the JSON data with static types
- generates necessary boilerplate to be a portable Node library implemented in Rust - uses TS by default (can be disabled) - generates GitHub Actions boilerplate by default (can be disabled) to make publishing push-button
- README improveements * copy edits * coalesce directory layout docs into a table - build.yml takes ref instead of branch - setup action shares common setup routines - scripts contain a `"release"` script instead of `"tag"`, which simply dispatches release.yml
97bf5c1
to
00394f8
Compare
…emplate references packageSpec not package
An example repo generated by this PR: https://github.com/dherman/create-neon-manual-test-project |
Thanks so much for the example repo! That's really helpful for the review. ❤️ |
fix typo in build.yml description Co-authored-by: K.J. Valencik <[email protected]>
- no need for `fetch-depth: 0` when checking out git - fix GH_TOKEN for `gh` cli to use the built-in ${{ github.token }} - add `--silent` to `npm pack` to work around npm/cli#7354
- use a wrapper type instead of a string subtype as the example wrapper logic, for clarity - use `declare module` for a better suggested style of interacting with the addon (to avoid the any type)
|
||
### Creating a Portable Library | ||
|
||
To create a portable npm library with pre-built binaries: |
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.
Nit, it might not be obvious to a potential user what "portable" means.
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.
Great point--I added some explanatory text.
pkgs/create-neon/data/versions.json
Outdated
"neonPublish": "v0.4.1", | ||
"dotenv": "v1", | ||
"ghRelease": "v1", | ||
"releaseDownloader": "v1.7" |
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.
Does GitHub offer any protections on these tags changing? They didn't used to, but I'm not sure if they added it.
If not, can we use explicit SHA on unofficial actions?
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 divided the versions.json
metadata into two categories, one for verified and one for unverified actions:
"actions": {
"verified": {
"checkout": "v3",
"githubScript": "v7",
"setupNode": "v3",
"setupRust": "v1",
"cargoInstall": "v2",
"neonBuild": "v0.9",
"neonPublish": "v0.4.1"
},
"unverified": {
"dotenv": {
"tag": "v1.1.2",
"sha": "d1cd55661714e830a6e26f608f81d36e23424fed"
},
"ghRelease": {
"tag": "v2.0.4",
"sha": "9d7c94cfd0a1f3ed45544c887983e9fa900f0564"
},
"releaseDownloader": {
"tag": "v1.10",
"sha": "c39a3b234af58f0cf85888573d361fb6fa281534"
}
}
}
And I changed the template to generate an explicit SHA reference with a comment noting the version tag, e.g.:
- name: Set Environment Variables
uses: falti/dotenv-action@d1cd55661714e830a6e26f608f81d36e23424fed # v1.1.2
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.
This is fantastic! I'm super excited. 🎉
Add to
create-neon
the ability to create Neon libraries with sensible zero-config defaults set up for pre-builds, including fully functional CI/CD.Follow-up issues:
--no-ts
Example: