Reorganize examples into categorized folders#341
Merged
legendecas merged 18 commits intonodejs:mainfrom Nov 3, 2023
Merged
Conversation
…_with_object_wrap
e913f7f to
142407e
Compare
Contributor
Author
|
@mhdawson @legendecas @gabrielschulhof @vmoroz got this updated per the discussion on the meeting last week. Here is the example of what landing on the repo will look like after this merges: |
Member
|
@matthewkeil I think its starting to look good, but I think |
mhdawson
approved these changes
Oct 27, 2023
Member
mhdawson
left a comment
There was a problem hiding this comment.
LGTM with one suggestion/comment
legendecas
approved these changes
Nov 3, 2023
Contributor
Author
|
Just getting back from vacation. Thanks for pushing that commit @legendecas . If that was the only thing left feel free to merge when you guys are ready @mhdawson |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reorganized the examples into categorized folders and updated the
test_allscript for the new directory format.Here is the layout that was used. Each "category" has several examples and each example can have multiple versions of native integration (nan, node-addon-api, napi):
REPO_ROOT ├── test_all.js ├── package.json ├── README.md └── src ├── 1-getting-started │ ├── example1 │ │ ├── nan │ │ ├── node-addon-api │ │ └── napi │ ├── example2 │ └── example3 ├── 2-js-to-native-conversion ├── 3-context-awareness ├── 4-references-and-handle-scope ├── 5-async-work ├── 6-threadsafe-function ├── 7-events └── 8-toolingThe
test_all.jsfile was updated to reflect the new structure and I also massaged the output a bit at the end for a bit more feedback. The file was not originally running thetestscript in each package, it was just runninginstall. I added a bit of logic to run thetestscript found in the package.json and then output whether the install works/doesnt, if a test was found/wasnt and if the test ran successfully. I found one that did not run successfully because the script was not setup in the package.json. There is a file in there that looks like a "test" case but its an infinite loop. Will fix that in a subsequent PR.Updated
test_all.jsoutput (after the output that was shown before):passed: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/thread_safe_function_round_trip/napi passed: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/threadsafe-async-iterator/node-addon-api passed: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/typed_threadsafe_function/node-addon-api no test found: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/promise-callback-demo/node-addon-api /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/thread_safe_function_counting/node-addon-api failed install: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/general/6_object_wrap/napi failed tests: /Users/matthewkeil/Documents/dev/chainsafe/node-addon-examples/threadsafe-function/thread_safe_function_with_object_wrap/node-addon-apiQuestions for how to make this better:
srcfolder?