napi-rs / napi-rs/website

2 small suggestions to enhance “A simple package” documentation

Open
#180 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MDX
Stars
25
Forks
48
Avg merge
3d 22h
Merged PRs (30d)
7

Description

👋 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “A simple package” page at https://napi.rs/docs/introduction/simple-package and compare its publishing guidance with the CI.yml workflow mentioned in the issue. Clarify the package-manager and lockfile requirement, and identify NPM_TOKEN as a repository secret with the correct GitHub Settings path; done means the page accurately matches the workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, node.js
Domain
ci-cd, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.