-
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
Merged
Merged
npm init neon --lib
#1014
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
2b6476b
Use tsconfig/node18 as base TS config
6633fb5
generate more modern ES, which unfortunately means we can't as easy i…
f3be15e
consolidate Versions type handling
d79a4a6
get the tests passing again with modern TS and modern node versions
aa6ce0f
single quotes for imports
bdf24a9
simplify unnecessary type test that I added during debugging
827016b
add top-level comment explaining the versions.ts wrapper module
7804e07
WIP
dherman 23585f1
rename "release" to "remote-publish" to avoid ambiguity with GitHub R…
dherman 3555443
Initial version of `npm init neon --lib`
dherman a2ce7a5
First working draft of build automation for libraries!
dherman 7460c7c
move hbs delegate into GitHub CI plugin
dherman 00394f8
update versions
dherman 88e8bb7
npm run prettier
dherman 74fe46a
bugfix: PackageSpec needs version (default is "0.1.0") and manifest t…
dherman 2a68374
add a newline to the manifest
dherman e54a1de
diagnostics
dherman 4b301e3
build fix
dherman d995950
export * from './index.cts'
dherman b2e0535
better ways to extract node and rust versions
dherman 86cfc2f
bugfix: steps.build.outputs.filename => steps.pack.outputs.filename
dherman 4741f2a
Update pkgs/create-neon/data/templates/ci/github/build.yml.hbs
dherman cda4804
bugfix: packageSpec.library not package.library
dherman 86c7daa
node 20.x
dherman e965176
remove .npmignore since it's only for libraries, which already use `"…
dherman 24e8898
complete the node v20 changes
dherman a36e170
generate the right README details for the more nested repo layout of …
dherman 66148cf
fix the conditional logic for the directory layout in README
dherman d27655d
create-neon now generates the nested directory structure for TS libra…
dherman c8b804e
command-line option documentation in the main README
dherman 4bbafb2
tee all the GITHUB_OUTPUT for simple diagnostics
dherman 4ec45b3
no default since it's required
dherman eb6ac15
a few more GHA details:
dherman d3aa32c
replace the magic comments with a magic label
dherman 8de9b14
remove comments.yml.hbs from templates
dherman 1150668
comment copy-edits
dherman 36a002f
eliminate two more magic feathers
dherman e6eef73
slight improvements to the generated index.cts boilerplate:
dherman 970aff8
different hello world for libraries vs simple projects
dherman 8830100
add some explanatory comments to the generated code
dherman a7168c0
oops, copy-pasta bug
dherman e2b3792
missed one {{#$}}
dherman 8c59954
id: tag
dherman 8d68793
bugfixes:
dherman a24ab89
more detailed instructions for setting up npm tokens
dherman b2c69e0
bump @neon-rs/manifest so saving manifests includes a final newline
dherman 4091edf
use the new more ergonomic CLI syntax
dherman 895361e
harden the use of third-party GH actions by using explicit SHAs for a…
dherman 4ecd9b1
explain what "portable library" means in the README
dherman fd212c1
fix failing test for --yes
dherman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[workspace] | ||
members = ["crates/{{package.name}}"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
NODE_VERSION={{versions.node}}.x | ||
NPM_REGISTRY=https://registry.npmjs.org | ||
RUST_VERSION=stable | ||
ACTIONS_USER=github-actions | ||
[email protected] |
137 changes: 137 additions & 0 deletions
137
pkgs/create-neon/data/templates/ci/github/build.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: 'The branch, tag, or SHA to check out' | ||
required: true | ||
type: string | ||
update-version: | ||
description: 'Update version before building?' | ||
required: false | ||
type: boolean | ||
default: false | ||
version: | ||
description: 'Version update (ignored if update-version is false)' | ||
required: false | ||
type: string | ||
default: 'patch' | ||
github-release: | ||
description: 'Publish GitHub release?' | ||
required: false | ||
type: boolean | ||
default: false | ||
tag: | ||
description: 'The release tag (ignored if github-release is false)' | ||
required: false | ||
type: string | ||
default: '' | ||
|
||
jobs: | ||
matrix: | ||
name: Matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: {{#$}} steps.matrix.outputs.result {{/$}} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
use-rust: false | ||
- name: Look Up Matrix Data | ||
id: matrixData | ||
shell: bash | ||
run: echo "json=$(npx neon ci github | jq -rc)" | tee -a $GITHUB_OUTPUT | ||
- name: Compute Matrix | ||
id: matrix | ||
uses: actions/github-script@{{versions.actions.githubScript}} | ||
with: | ||
script: | | ||
const platforms = {{#$}} steps.matrixData.outputs.json {{/$}}; | ||
const macOS = platforms.macOS.map(platform => { | ||
return { os: "macos-latest", platform, script: "build" }; | ||
}); | ||
const windows = platforms.Windows.map(platform => { | ||
return { os: "windows-latest", platform, script: "build" }; | ||
}); | ||
const linux = platforms.Linux.map(platform => { | ||
return { os: "ubuntu-latest", platform, script: "cross" }; | ||
}); | ||
return [...macOS, ...windows, ...linux]; | ||
|
||
binaries: | ||
name: Binaries | ||
needs: [matrix] | ||
strategy: | ||
matrix: | ||
cfg: {{#$}} fromJSON(needs.matrix.outputs.matrix) {{/$}} | ||
runs-on: {{#$}} matrix.cfg.os {{/$}} | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
id: neon | ||
uses: ./.github/actions/setup | ||
with: | ||
use-cross: {{#$}} matrix.cfg.script == 'cross' {{/$}} | ||
platform: {{#$}} matrix.cfg.platform {{/$}} | ||
- name: Update Version | ||
if: {{#$}} inputs.update-version {{/$}} | ||
shell: bash | ||
run: | | ||
git config --global user.name $ACTIONS_USER | ||
git config --global user.email $ACTIONS_EMAIL | ||
npm version {{#$}} inputs.version {{/$}} -m "v%s" | ||
- name: Build | ||
shell: bash | ||
env: | ||
CARGO_BUILD_TARGET: {{#$}} steps.neon.outputs.target {{/$}} | ||
NEON_BUILD_PLATFORM: {{#$}} matrix.cfg.platform {{/$}} | ||
run: npm run {{#$}} matrix.cfg.script {{/$}} | ||
- name: Pack | ||
id: pack | ||
shell: bash | ||
run: | | ||
mkdir -p dist | ||
echo filename=$(basename $(npm pack ./platforms/{{#$}} matrix.cfg.platform {{/$}} --silent --pack-destination=./dist --json | jq -r '.[0].filename')) | tee -a $GITHUB_OUTPUT | ||
- name: Release | ||
if: {{#$}} inputs.github-release {{/$}} | ||
uses: softprops/action-gh-release@{{versions.actions.ghRelease}} | ||
with: | ||
files: ./dist/{{#$}} steps.pack.outputs.filename {{/$}} | ||
tag_name: {{#$}} inputs.tag {{/$}} | ||
|
||
main: | ||
name: Main | ||
needs: [matrix] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
use-rust: false | ||
- name: Pack | ||
id: pack | ||
shell: bash | ||
run: | | ||
mkdir -p dist | ||
echo "filename=$(npm pack --silent --pack-destination=./dist)" | tee -a $GITHUB_OUTPUT | ||
- name: Release | ||
if: {{#$}} inputs.github-release {{/$}} | ||
uses: softprops/action-gh-release@{{versions.actions.ghRelease}} | ||
with: | ||
files: ./dist/{{#$}} steps.pack.outputs.filename {{/$}} | ||
tag_name: {{#$}} inputs.tag {{/$}} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.