napi-rs / website

Website for napi.rs
https://napi.rs
MIT License
21 stars 38 forks source link

2 small suggestions to enhance “A simple package” documentation #180

Open xitanggg opened 8 months ago

xitanggg commented 8 months ago

👋 Hi, thanks so much for creating this awesome tool to streamline the process of creating and publishing Node.js addon. I am following the https://napi.rs/docs/introduction/simple-package page to use it for the first time and had a good experience. I did ran into 2 issues however so I thought to drop some suggestions here.

Suggestion 1 is pertaining to the following statement in the doc

I'm using yarn to install the dependencies here, you can replace it by your favorite package manager.

I don't think the second half of this statement is correct. I initially used npm install to install dependency, but CI doesn't like it because it uses yarn as config and it was expecting to find a yarn.lock file, so I had to resort to yarn to generate the lock file to make CI happy.

The following was the error I ran into previously

Run actions/setup-node@v4 Found in cache @ /Users/runner/hostedtoolcache/node/18.19.0/x64 Environment details /Users/runner/.yarn/bin/yarn --version 1.22.19 /Users/runner/.yarn/bin/yarn cache dir /Users/runner/Library/Caches/Yarn/v6 Error: Dependencies lock file is not found in /Users/runner/work//. Supported file patterns: yarn.lock (Log based on https://github.com/xitanggg/enigo-node-insert-text/actions/runs/7324902521/job/19948934147)

Suggestion 2 is pertaining to the following statement in the doc

In order to publish packages in GitHub Actions, you need to configure the NPM_TOKEN environment variable in your GitHub repo. In the project Settings -> Secrets, add your NPM_TOKEN into it.

Environment secret, environment variable, repository secret are 3 different things. The CI.yml is actually using NPM_TOKEN as a repository secret secrets.NPM_TOKEN, so I'd suggest paraphrasing it with something like the following to make it more clear

In order to publish packages in GitHub Actions, you need to configure the NPM_TOKEN as a repository secret in your GitHub repo. In the project Settings -> Secrets and variables -> Actions -> Repository secrets, add your NPM_TOKEN into it.

Thanks