Skip to content

Commit d440184

Browse files
committed
refactor: rename from go-ipfs to kubo
Closes #51
1 parent 807ce2b commit d440184

File tree

14 files changed

+62
-62
lines changed

14 files changed

+62
-62
lines changed

.github/actions/check-for-go-ipfs-release/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:14
22

33
LABEL "com.github.actions.name"="Update and publish"
4-
LABEL "com.github.actions.description"="Publish new version when a new go-ipfs version is relased"
4+
LABEL "com.github.actions.description"="Publish new version when a new kubo version is relased"
55
LABEL "com.github.actions.icon"="rss"
66
LABEL "com.github.actions.color"="green"
77

.github/actions/check-for-go-ipfs-release/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Check for go-ipfs release'
1+
name: 'Check for kubo release'
22
runs:
33
using: 'docker'
44
image: 'Dockerfile'

.github/actions/check-for-go-ipfs-release/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22
set -eu
33

4-
echo '💫 Checking https://dist.ipfs.tech/go-ipfs/versions for new releases...'
4+
echo '💫 Checking https://dist.ipfs.tech/kubo/versions for new releases...'
55

66
# The version in packge.json e.g. "0.4.20"
77
CURRENT=`node -e 'console.log(require("./package.json").version)'`
88
# The latest version on dist.ipfs.tech e.g. "0.4.21"
9-
LATEST=`curl --silent https://dist.ipfs.tech/go-ipfs/versions | tail -n 1 | cut -c 2-`
9+
LATEST=`curl --silent https://dist.ipfs.tech/kubo/versions | tail -n 1 | cut -c 2-`
1010

1111
# Verify $LATEST is valid semver!
1212
if ! npx semver $LATEST; then

.github/actions/publish/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:14
22

33
LABEL "com.github.actions.name"="Version and publish"
4-
LABEL "com.github.actions.description"="npm version and publish with new go-ipfs version"
4+
LABEL "com.github.actions.description"="npm version and publish with new kubo version"
55
LABEL "com.github.actions.icon"="box"
66
LABEL "com.github.actions.color"="green"
77

.github/actions/publish/entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323
# The version in packge.json e.g. "0.4.20"
2424
CURRENT=`node -e 'console.log(require("./package.json").version)'`
2525
# The latest version on dist.ipfs.tech e.g. "0.4.21"
26-
LATEST=`curl --silent https://dist.ipfs.tech/go-ipfs/versions | tail -n 1 | cut -c 2-`
26+
LATEST=`curl --silent https://dist.ipfs.tech/kubo/versions | tail -n 1 | cut -c 2-`
2727

2828
# Verify $LATEST is valid semver!
2929
if ! npx semver $LATEST; then
@@ -37,10 +37,10 @@ if [[ "$CURRENT" != "$LATEST" ]]; then
3737
# Publish pre-releases under the @next tag and releases @latest tag.
3838
if [[ $LATEST =~ "-" ]]; then
3939
NPM_DIST_TAG='next'
40-
echo "🧪 Found new go-ipfs pre-release $LATEST@$NPM_DIST_TAG"
40+
echo "🧪 Found new kubo pre-release $LATEST@$NPM_DIST_TAG"
4141
else
4242
NPM_DIST_TAG='latest'
43-
echo "🎉 Found new go-ipfs release $LATEST@$NPM_DIST_TAG"
43+
echo "🎉 Found new kubo release $LATEST@$NPM_DIST_TAG"
4444
fi
4545

4646
git config --global --add safe.directory /github/workspace
@@ -60,7 +60,7 @@ if [[ "$CURRENT" != "$LATEST" ]]; then
6060
npm install
6161
npm version $LATEST
6262
npm publish --access public --tag $NPM_DIST_TAG
63-
echo "📦 Published $LATEST to npm as go-ipfs@$NPM_DIST_TAG"
63+
echo "📦 Published $LATEST to npm as kubo@$NPM_DIST_TAG"
6464

6565
git push -u origin master
6666
git push --tags

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v3
13-
- name: Check for new go-ipfs version
13+
- name: Check for new kubo version
1414
id: check
15-
uses: ./.github/actions/check-for-go-ipfs-release
15+
uses: ./.github/actions/check-for-kubo-release
1616
- name: Set up node
1717
if: steps.check.outputs.publish == 'true'
1818
uses: actions/setup-node@v3

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# npm-go-ipfs
1+
# npm-kubo
22

33
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech/)
44
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
55

6-
> install [Kubo](https://github.com/ipfs/kubo) (previously known as "go-ipfs") from npm
6+
> install [Kubo](https://github.com/ipfs/kubo) (previously known as "kubo") from npm
77
88
## Table of Contents
99

@@ -16,32 +16,32 @@
1616

1717
## Install
1818

19-
Install the latest [Kubo](https://github.com/ipfs/kubo/) (go-ipfs) binary:
19+
Install the latest [Kubo](https://github.com/ipfs/kubo/) (kubo) binary:
2020

2121
```sh
2222
# Install globally
23-
> npm install -g go-ipfs
23+
> npm install -g kubo
2424
> ipfs version
2525
ipfs version v0.7.0
2626

2727
# Install locally
28-
> npm install go-ipfs
28+
> npm install kubo
2929
> ./node_modules/.bin/ipfs
3030
ipfs version v0.7.0
3131
```
3232

3333
## Usage
3434

35-
This module downloads Kubo (go-ipfs) binaries from https://dist.ipfs.tech into your project.
35+
This module downloads Kubo (kubo) binaries from https://dist.ipfs.tech into your project.
3636

37-
It will download the go-ipfs version that matches the npm version of this module. So depending on `go-ipfs@0.7.0` will install `go-ipfs v0.7.0` for your current system architecture, in to your project at `node_modules/go-ipfs/go-ipfs/ipfs` and additional symlink to it at `node_modules/go-ipfs/bin/ipfs`.
37+
It will download the kubo version that matches the npm version of this module. So depending on `kubo@0.7.0` will install `kubo v0.7.0` for your current system architecture, in to your project at `node_modules/kubo/kubo/ipfs` and additional symlink to it at `node_modules/kubo/bin/ipfs`.
3838

3939
After downloading you can find out the path of the installed binary by calling the `path` function exported by this module:
4040

4141
```javascript
42-
const { path } = require('go-ipfs')
42+
const { path } = require('kubo')
4343

44-
console.info('go-ipfs is installed at', path())
44+
console.info('kubo is installed at', path())
4545
```
4646

4747
An error will be thrown if the path to the binary cannot be resolved.
@@ -67,7 +67,7 @@ You should be able to just run `./publish.sh` for example:
6767
```sh
6868
> ./publish.sh
6969
usage ./publish.sh <version>
70-
publish a version of go-ipfs to npm
70+
publish a version of kubo to npm
7171

7272
> ./publish.sh 0.3.11
7373
```
@@ -78,26 +78,26 @@ This will:
7878
- check the size of `bin/ipfs` is right (must be the checked in file)
7979
- update the version numbers in `package.json` and `README.md`
8080
- `git commit` the changes
81-
- push to https://github.com/ipfs/npm-go-ipfs
82-
- publish to `go-ipfs@$version` to https://npmjs.com/package/go-ipfs
81+
- push to https://github.com/ipfs/npm-kubo
82+
- publish to `kubo@$version` to https://npmjs.com/package/kubo
8383

8484
Open an issue in the repo if you run into trouble.
8585

86-
### Publish a new version of this module with exact same go-ipfs version
86+
### Publish a new version of this module with exact same kubo version
8787

88-
If some problem happens, and you need to publish a new version of this module targetting _the same_ go-ipfs version, then please follow this convention:
88+
If some problem happens, and you need to publish a new version of this module targetting _the same_ kubo version, then please follow this convention:
8989

90-
1. **Clean up bad stuff:** unpublish all modules with this exact same `<go-ipfs-version>`
91-
2. **Add a "hacky" version suffix:** use version: `<go-ipfs-version>-hacky<num>`
92-
3. **Publish version:** publish the module. Since it's the only one with the go-ipfs version, then it should be installed.
90+
1. **Clean up bad stuff:** unpublish all modules with this exact same `<kubo-version>`
91+
2. **Add a "hacky" version suffix:** use version: `<kubo-version>-hacky<num>`
92+
3. **Publish version:** publish the module. Since it's the only one with the kubo version, then it should be installed.
9393

9494
> Why do this?
9595
96-
Well, if you previously published npm module `go-ipfs@0.4.0` and there was a problem, we now must publish a different version, but we want to keep the version number the same. so the strategy is to publish as `go-ipfs@0.4.0-hacky1`, and unpublish `go-ipfs@0.4.0`.
96+
Well, if you previously published npm module `kubo@0.4.0` and there was a problem, we now must publish a different version, but we want to keep the version number the same. so the strategy is to publish as `kubo@0.4.0-hacky1`, and unpublish `kubo@0.4.0`.
9797

9898
> Why `-hacky<num>`?
9999
100-
Because it is unlikely to be a legitimate go-ipfs version, and we want to support go-ipfs versions like `floodsub-1` etc.
100+
Because it is unlikely to be a legitimate kubo version, and we want to support kubo versions like `floodsub-1` etc.
101101

102102
> Do i have to say `-hacky<num>` or can i just use `-<num>`?
103103
@@ -106,7 +106,7 @@ change the convention, go for it, and update this readme accordingly.
106106

107107
## Contribute
108108

109-
Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/npm-go-ipfs/issues)!
109+
Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/npm-kubo/issues)!
110110

111111
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
112112

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "go-ipfs",
2+
"name": "kubo",
33
"version": "0.22.0",
4-
"description": "Install the latest go-ipfs binary",
4+
"description": "Install the latest Kubo (go-ipfs) binary",
55
"main": "src/index.js",
66
"scripts": {
77
"postinstall": "node src/post-install.js",
@@ -26,7 +26,7 @@
2626
],
2727
"repository": {
2828
"type": "git",
29-
"url": "git+https://github.com/ipfs/npm-go-ipfs.git"
29+
"url": "git+https://github.com/ipfs/npm-kubo.git"
3030
},
3131
"keywords": [
3232
"ipfs",
@@ -35,9 +35,9 @@
3535
"author": "Protocol Labs, Inc.",
3636
"license": "MIT",
3737
"bugs": {
38-
"url": "https://github.com/ipfs/npm-go-ipfs/issues"
38+
"url": "https://github.com/ipfs/npm-kubo/issues"
3939
},
40-
"homepage": "https://github.com/ipfs/npm-go-ipfs",
40+
"homepage": "https://github.com/ipfs/npm-kubo",
4141
"types": "./src/types.d.ts",
4242
"devDependencies": {
4343
"@types/got": "^9.6.12",

src/download.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
'use strict'
22

33
/*
4-
Download go-ipfs distribution package for desired version, platform and architecture,
4+
Download kubo distribution package for desired version, platform and architecture,
55
and unpack it to a desired output directory.
66
77
API:
88
download(<version>, <platform>, <arch>, <outputPath>)
99
1010
Defaults:
11-
go-ipfs version: value in package.json/go-ipfs/version
12-
go-ipfs platform: the platform this program is run from
13-
go-ipfs architecture: the architecture of the hardware this program is run from
14-
go-ipfs install path: './go-ipfs'
11+
kubo version: value in package.json/kubo/version
12+
kubo platform: the platform this program is run from
13+
kubo architecture: the architecture of the hardware this program is run from
14+
kubo install path: './kubo'
1515
*/
1616
const goenv = require('./go-platform')
1717
const gunzip = require('gunzip-maybe')
@@ -33,7 +33,7 @@ const isWin = process.platform === 'win32'
3333
* @param {string} url
3434
*/
3535
async function cachingFetchAndVerify (url) {
36-
const cacheDir = process.env.NPM_GO_IPFS_CACHE || cachedir('npm-go-ipfs')
36+
const cacheDir = process.env.NPM_GO_IPFS_CACHE || cachedir('npm-kubo')
3737
const filename = url.split('/').pop()
3838

3939
if (!filename) {
@@ -112,7 +112,7 @@ function unpack (url, installPath, stream) {
112112
* @param {string} [installPath]
113113
*/
114114
function cleanArguments (version, platform, arch, installPath) {
115-
const conf = pkgConf.sync('go-ipfs', {
115+
const conf = pkgConf.sync('kubo', {
116116
cwd: process.env.INIT_CWD || process.cwd(),
117117
defaults: {
118118
version: 'v' + pkg.version.replace(/-[0-9]+/, ''),
@@ -134,8 +134,8 @@ function cleanArguments (version, platform, arch, installPath) {
134134
* @param {string} distUrl
135135
*/
136136
async function ensureVersion (version, distUrl) {
137-
console.info(`${distUrl}/go-ipfs/versions`)
138-
const versions = (await got(`${distUrl}/go-ipfs/versions`).text()).trim().split('\n')
137+
console.info(`${distUrl}/kubo/versions`)
138+
const versions = (await got(`${distUrl}/kubo/versions`).text()).trim().split('\n')
139139

140140
if (versions.indexOf(version) === -1) {
141141
throw new Error(`Version '${version}' not available`)
@@ -151,7 +151,7 @@ async function ensureVersion (version, distUrl) {
151151
async function getDownloadURL (version, platform, arch, distUrl) {
152152
await ensureVersion(version, distUrl)
153153

154-
const data = await got(`${distUrl}/go-ipfs/${version}/dist.json`).json()
154+
const data = await got(`${distUrl}/kubo/${version}/dist.json`).json()
155155

156156
if (!data.platforms[platform]) {
157157
throw new Error(`No binary available for platform '${platform}'`)
@@ -162,7 +162,7 @@ async function getDownloadURL (version, platform, arch, distUrl) {
162162
}
163163

164164
const link = data.platforms[platform].archs[arch].link
165-
return `${distUrl}/go-ipfs/${version}${link}`
165+
return `${distUrl}/kubo/${version}${link}`
166166
}
167167

168168
/**
@@ -180,7 +180,7 @@ async function download ({ version, platform, arch, installPath, distUrl }) {
180180
await unpack(url, installPath, data)
181181
console.info(`Unpacked ${installPath}`)
182182

183-
return path.join(installPath, 'go-ipfs', `ipfs${platform === 'windows' ? '.exe' : ''}`)
183+
return path.join(installPath, 'kubo', `ipfs${platform === 'windows' ? '.exe' : ''}`)
184184
}
185185

186186
/**
@@ -196,7 +196,7 @@ async function link ({ depBin, version }) {
196196
}
197197

198198
if (!fs.existsSync(depBin)) {
199-
throw new Error('ipfs binary not found. maybe go-ipfs did not install correctly?')
199+
throw new Error('ipfs binary not found. maybe kubo did not install correctly?')
200200
}
201201

202202
if (fs.existsSync(localBin)) {
@@ -211,7 +211,7 @@ async function link ({ depBin, version }) {
211211
const cmdFile = path.join(__dirname, '..', '..', 'ipfs.cmd')
212212

213213
fs.writeFileSync(cmdFile, `@ECHO OFF
214-
"%~dp0\\node_modules\\go-ipfs\\bin\\ipfs.exe" %*`)
214+
"%~dp0\\node_modules\\kubo\\bin\\ipfs.exe" %*`)
215215
}
216216

217217
// test ipfs installed correctly.

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ module.exports.path = function () {
99
}
1010

1111
const paths = [
12-
path.resolve(path.join(__dirname, '..', 'go-ipfs', 'ipfs')),
13-
path.resolve(path.join(__dirname, '..', 'go-ipfs', 'ipfs.exe'))
12+
path.resolve(path.join(__dirname, '..', 'kubo', 'ipfs')),
13+
path.resolve(path.join(__dirname, '..', 'kubo', 'ipfs.exe'))
1414
]
1515

1616
for (const bin of paths) {
@@ -19,5 +19,5 @@ module.exports.path = function () {
1919
}
2020
}
2121

22-
throw new Error('go-ipfs binary not found, it may not be installed or an error may have occurred during installation')
22+
throw new Error('kubo binary not found, it may not be installed or an error may have occurred during installation')
2323
}

test/download.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ test('Ensure ipfs gets downloaded (current version and platform)', async (t) =>
1212
const installPath = await download()
1313
const stats = await fs.stat(installPath)
1414

15-
t.ok(stats, 'go-ipfs was downloaded')
16-
t.ok(installPath, detectLocation(), 'go-ipfs binary was detected')
15+
t.ok(stats, 'kubo was downloaded')
16+
t.ok(installPath, detectLocation(), 'kubo binary was detected')
1717

1818
t.end()
1919
})

test/fixtures/clean.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const path = require('path')
55
const execa = require('execa')
66

77
module.exports = async function clean () {
8-
await fs.remove(path.resolve(__dirname, '../../go-ipfs'))
8+
await fs.remove(path.resolve(__dirname, '../../kubo'))
99
await execa('git', ['checkout', '--', path.resolve(__dirname, '../../bin/ipfs')])
1010
}

test/fixtures/example-project/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"author": "",
77
"license": "ISC",
88
"dependencies": {
9-
"go-ipfs": "file://../../../"
9+
"kubo": "file://../../../"
1010
}
1111
}

test/install.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ const execa = require('execa')
55
const cachedir = require('cachedir')
66

77
/*
8-
Test that correct go-ipfs is downloaded during npm install.
8+
Test that correct kubo is downloaded during npm install.
99
*/
1010

1111
const expectedVersion = require('../package.json').version
1212

1313
async function clean () {
1414
await fs.remove(path.join(__dirname, 'fixtures', 'example-project', 'node_modules'))
1515
await fs.remove(path.join(__dirname, 'fixtures', 'example-project', 'package-lock.json'))
16-
await fs.remove(cachedir('npm-go-ipfs'))
16+
await fs.remove(cachedir('npm-kubo'))
1717
}
1818

1919
test.onFinish(clean)
2020

21-
test('Ensure go-ipfs defined in package.json is fetched on dependency install', async (t) => {
21+
test('Ensure kubo defined in package.json is fetched on dependency install', async (t) => {
2222
await clean()
2323

2424
const exampleProjectRoot = path.join(__dirname, 'fixtures', 'example-project')
@@ -29,11 +29,11 @@ test('Ensure go-ipfs defined in package.json is fetched on dependency install',
2929
})
3030

3131
// confirm package.json is correct
32-
const fetchedVersion = require(path.join(exampleProjectRoot, 'node_modules', 'go-ipfs', 'package.json')).version
32+
const fetchedVersion = require(path.join(exampleProjectRoot, 'node_modules', 'kubo', 'package.json')).version
3333
t.ok(expectedVersion === fetchedVersion, `package.json versions match '${expectedVersion}'`)
3434

3535
// confirm binary is correct
36-
const binary = path.join(exampleProjectRoot, 'node_modules', 'go-ipfs', 'bin', 'ipfs')
36+
const binary = path.join(exampleProjectRoot, 'node_modules', 'kubo', 'bin', 'ipfs')
3737
const versionRes = execa.sync(binary, ['--version'], {
3838
cwd: exampleProjectRoot
3939
})

0 commit comments

Comments
 (0)