This module downloads go-ipfs binaries from https://dist.ipfs.io into your project.
By default it will download the go-ipfs version that matches the npm version of this module. So depending on [email protected] will install go-ipfs v0.4.19 for your current system architecture, in to your project at node_modules/go-ipfs-dep/go-ipfs/ipfs.
After downloading you can find out the path of the installed binary by calling the path function exported by this module:
const{ path }=require('go-ipfs-dep')console.info('go-ipfs is installed at',path())
An error will be thrown if the path to the binary cannot be resolved - if you do not wish this to happen, call path.silent():
const{path: silent}=require('go-ipfs-dep')console.info('go-ipfs may installed at',silent())
Overriding the go-ipfs version
You can override the version of go-ipfs that gets downloaded by adding by adding a go-ipfs.version field to your package.json
"go-ipfs": {
"version": "v0.4.13"
},
Using local IPFS daemon as the package download url
The url to download the binaries from can be specified by adding a field go-ipfs.distUrl field to your package.json, eg:
When used via node src/bin.js, you can specify the target platform, version and architecture via environment variables: TARGET_OS, TARGET_VERSION and TARGET_ARCH.
We fetch the versions dynamically from https://dist.ipfs.io/go-ipfs/versions and the OSes and architectures from https://dist.ipfs.io/go-ipfs/${VERSION}/dist.json.
Note: The binary gets put in the go-ipfs folder inside the module folder.
Deployment
Publishing is handled by GitHub Actions. The workflow is set to run every hour. It checks dist.ipfs.io for the latest go-ipfs version number, and compares with the version property in the package.json for this module. If they are different, the action will update the version of this module, publish it to npm, and push the change back to the master branch.
.github/main.workflow defines how frequently we check for a new go-ipfs release, (hourly) and the steps to carry out.
action-check-for-go-ipfs-release compares the module version with the latest go-ipfs release as published to dist.ipfs.io. This lets us bail early if everything is up to date.
action-publish handles updating the module version, publishing to npm, and pushing the changes back to the repo.
If for some reason you need to run it manually, follow the instructions below.
Publish a Prerelease to npm
You have made changes and want to triple check everything is working. You can! If you publish with a numeric prerelease identifier then go-ipfs-dep will strip it and install the corresponding version e.g. 0.4.19-0 installs go-ipfs version 0.4.19.
To deploy a new version with a prerelease identifier run the following command:
请发表评论