Before opening an issue try to search the existing ones for the same problem.
Make sure to include on your issue the following information:
- Node.js Version
- yarn / npm version
- Operational System (name and version)
- Package version
- Logs of the installation
The package manager used on this project is yarn
The addon lib code is written in Typescript, while the addon itself is written in C++.
Folders ./scripts
and ./tools
contain scripts in Javascript, those are used mostly during installation and on CI.
C/C++ code is written following Google style guide (with some minor changes), and clang-format
can/should be used to automatically format the code. There is already a .clang-format
on the repository.
cpplint
is used to lint C/C++ code
TS/JS code should be formatted using prettier
ts-lint
is used to lint TS code, while JS code is using eslint
.
If on Windows, first you will need to grab the deps:
$ node scripts/update-deps.js
Install the dependencies, this will also build the addon:
$ yarn install
If you made some change to the C++ code, you can just build the addon again:
$ yarn pregyp build
In case you need to rebuild:
$ yarn pregyp rebuild
If you have any issues with the build process, please refer to a readme build troubleshooting section.
If you want to include a new libcurl option on the addon, those are the basic steps:
- Add the option to their correct category on
Curl.cc
There are different vectors there for the expected type of the option's value, likecurlOptionInteger
,curlOptionString
, etc. Make sure to use a#if
directive to include this option only if building against a libcurl version that supports it, otherwise there will be an compilation error on older versions. - In case the option expects a value of type other than
number | string | boolean
, you must also add it to their respective key on the objectoptionKindMap
inside./scripts/data/options.js
. In case you add it to theother
key, which means this option has a specific value, you must also add the option expected value type to the objectoptionKindValueMap
right below, on that same file. - Run
node ./scripts/build-constants.js
, this will generate an updated list of options on./lib/generated/
, and also update the files [./lib/Curl.ts
] and [./lib/EasyNativeBinding.ts
] with overloads for thesetOpt
method. Make sure the options added are correct.
You will need to open a PR against the repository JCMais/curl-for-windows
upgrading libcurl there.
After that a new tag will be created on this repo, which we can them use on the file LIBCURL_VERSION_WIN_DEPS
.
- Install lldb On Debian based linux:
sudo apt-get install lldb
- Install Node.js lldb plugin:
npm i -g llnode
- Run script that causes core dump
llnode -- /path/to/bin/node --abort_on_uncaught_exception script.js
- Profit
More information go to https://github.com/nodejs/llnode
We are using np
for releases.
- Checkout
master
- Merge changes from
develop
- Update docs by running
yarn docs
and commit the changes. - Create version
- Publish
So basically:
git checkout master
git merge develop
And then:
npx np [major|minor|patch]
or if you are having trouble with np
:
yarn publish
or even if you are having trouble with yarn
:
npm version [major|minor|patch]
npm publish
And finally
git push --follow-tags
git checkout develop
git merge master
git push
For prereleases, use something like this from the develop
branch:
$ yarn np prerelease --any-branch --tag next
If for some reason np fails to run with Yarn, you can use this command to skip cleaning up and use npm to publish:
$ yarn np prerelease --no-yarn --no-cleanup --any-branch --tag next