@offckb/cli 0.3.0-canary-e7bf6be.0 → 0.3.0-canary-4e24414.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,18 +68,16 @@ function installCKBBinary(version) {
68
68
  exports.installCKBBinary = installCKBBinary;
69
69
  function downloadCKBBinaryAndUnzip(version) {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
- const arch = getArch();
72
- const osname = getOS();
73
- const ext = getExtension();
74
- const ckbVersionOSName = `ckb_v${version}_${arch}-${osname}`;
71
+ const ckbPackageName = buildCKBGithubReleasePackageName(version);
75
72
  try {
76
- const tempFilePath = path.join(os_1.default.tmpdir(), `${ckbVersionOSName}.${ext}`);
73
+ const ext = getExtension();
74
+ const tempFilePath = path.join(os_1.default.tmpdir(), `${ckbPackageName}.${ext}`);
77
75
  yield downloadAndSaveCKBBinary(version, tempFilePath);
78
76
  // Unzip the file
79
77
  const extractDir = path.join((0, setting_1.readSettings)().bins.downloadPath, `ckb_v${version}`);
80
78
  yield unZipFile(tempFilePath, extractDir, ext === 'tar.gz');
81
79
  // Install the extracted files
82
- const sourcePath = path.join(extractDir, ckbVersionOSName);
80
+ const sourcePath = path.join(extractDir, ckbPackageName);
83
81
  const targetPath = (0, setting_1.getCKBBinaryInstallPath)(version);
84
82
  if (fs.existsSync(targetPath)) {
85
83
  fs.rmdirSync(targetPath, { recursive: true });
@@ -200,15 +198,29 @@ function isPortable() {
200
198
  }
201
199
  return false;
202
200
  }
203
- function buildDownloadUrl(version, opt = {}) {
201
+ function buildCKBGithubReleasePackageName(version, opt = {}) {
202
+ const os = opt.os || getOS();
203
+ const arch = opt.arch || getArch();
204
+ if (isPortable()) {
205
+ return `ckb_v${version}_${arch}-${os}-portable`;
206
+ }
207
+ else {
208
+ return `ckb_v${version}_${arch}-${os}`;
209
+ }
210
+ }
211
+ function buildCKBGithubReleasePackageNameWithExtension(version, opt = {}) {
204
212
  const os = opt.os || getOS();
205
213
  const arch = opt.arch || getArch();
206
214
  const extension = opt.ext || getExtension();
207
215
  if (isPortable()) {
208
- return `https://github.com/nervosnetwork/ckb/releases/download/v${version}/ckb_v${version}_${arch}-${os}-portable.${extension}`;
216
+ return `ckb_v${version}_${arch}-${os}-portable.${extension}`;
209
217
  }
210
218
  else {
211
- return `https://github.com/nervosnetwork/ckb/releases/download/v${version}/ckb_v${version}_${arch}-${os}.${extension}`;
219
+ return `ckb_v${version}_${arch}-${os}.${extension}`;
212
220
  }
213
221
  }
222
+ function buildDownloadUrl(version, opt = {}) {
223
+ const fullPackageName = buildCKBGithubReleasePackageNameWithExtension(version, opt);
224
+ return `https://github.com/nervosnetwork/ckb/releases/download/v${version}/${fullPackageName}`;
225
+ }
214
226
  exports.buildDownloadUrl = buildDownloadUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.3.0-canary-e7bf6be.0",
3
+ "version": "0.3.0-canary-4e24414.0",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "CKB EcoFund",
6
6
  "license": "MIT",