231103.1 · 7f4a9ed91bbecb84e39f4bc8030247ce5116ddf8
Reorganize examples into categorized folders (#341)
* refactor: create directory structure to organize exmaples
* test: update test_all to work with new directory structure
* fix: bug in test_all if no package.json scripts
* test: cleanup output of test_all
* fix: remove default test script that throws from thread_safe_function_with_object_wrap
* fix: remove build_with_cmake from .gitignore
* fix: swith to ' from " and remove subdir from getAllTests call
* test: add extra test cases for npm start and just running the pkgJson.main with node
* refactor: move all examples to src directory
* refactor: add numbers to categories so they are ordered in the src folder
* refactor: simplify getAllExamples in test_all.js
* docs: add directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure to README.md
* docs: update directory structure example in readme
* add back build_with_cmake
---------
Co-authored-by: legendecas <legendecas@gmail.com>
reading declarations
Changes to src/8-tooling/build_with_cmake/node-addon-api/hello.cc. All files
src/8-tooling/build_with_cmake/node-addon-api/hello.cc
@@ -0,0 +1,23 @@+#include <napi.h>++static Napi::String Method(const Napi::CallbackInfo& info) {+ // Napi::Env is the opaque data structure containing the environment in which+ // the request is being run. We will need this env when we want to create any+ // new objects inside of the node.js environment+ Napi::Env env = info.Env();++ // Create a C++ level variable+ std::string helloWorld = "Hello, world!";++ // Return a new javascript string that we copy-construct inside of the node.js+ // environment+ return Napi::String::New(env, helloWorld);+}++static Napi::Object Init(Napi::Env env, Napi::Object exports) {+ exports.Set(Napi::String::New(env, "hello"),+ Napi::Function::New(env, Method));+ return exports;+}++NODE_API_MODULE(hello, Init)