After #301, will use the Mozilla CA certificate provided by the node.js. And use the fs.rmSync API to generate a local ca when install.
But the fs.rmSync was introduced in Node.js v14.14.0, so an error will occur when installing now.
TypeError: fs.rmSync is not a function
Modifications
Use fs.existsSync and unlinkSync instead of fs.rmSync.
Since Mozilla CA requires a Node.js version greater than v12.3.0, the README and package.json should be modified to indicate that it is only compatible with versions 12.3.0 and above.
Verifying this change
Test on ubuntu-22.04
Use node.js v12.3.0 can work.
gitpod /workspace/pulsar-client-node (compatible_version) $ npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
> pulsar-client@1.12.0-rc.0 install /workspace/pulsar-client-node
> node-pre-gyp install --fallback-to-build && node GenCertFile.js
[pulsar-client] Success: "/workspace/pulsar-client-node/lib/binding/pulsar.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 746 packages from 559 contributors and audited 748 packages in 10.463s
found 6 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
Documentation
[ ] doc-required
(Your PR needs to update docs and you will update later)
Motivation
After #301, will use the Mozilla CA certificate provided by the node.js. And use the
fs.rmSync
API to generate a local ca when install.But the fs.rmSync was introduced in Node.js v14.14.0, so an error will occur when installing now.
Modifications
fs.existsSync and unlinkSync
instead offs.rmSync
.v12.3.0
, theREADME
andpackage.json
should be modified to indicate that it is only compatible with versions 12.3.0 and above.Verifying this change
Test on ubuntu-22.04
Use node.js v12.3.0 can work.
Documentation
[ ]
doc-required
(Your PR needs to update docs and you will update later)[x]
doc-not-needed
(Please explain why)[ ]
doc
(Your PR contains doc changes)[ ]
doc-complete
(Docs have been already added)