@offckb/cli 0.4.2-canary-451da89.0 → 0.4.2
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.
- package/README.md +1 -1
- package/build/index.js +37 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -267,7 +267,7 @@ Example result:
|
|
|
267
267
|
Pay attention to the `devnet.configPath` and `devnet.dataPath`.
|
|
268
268
|
|
|
269
269
|
2. `cd` into the `devnet.configPath` . Modify the config files as needed. See [Custom Devnet Setup](https://docs.nervos.org/docs/node/run-devnet-node#custom-devnet-setup) and [Configure CKB](https://github.com/nervosnetwork/ckb/blob/develop/docs/configure.md) for details.
|
|
270
|
-
3. After modifications,
|
|
270
|
+
3. After modifications, run `offckb clean -d` to remove the chain data if needed while keeping the updated config files.
|
|
271
271
|
4. Restart local blockchain by running `offckb node`
|
|
272
272
|
|
|
273
273
|
|
package/build/index.js
CHANGED
|
@@ -394,7 +394,11 @@ program
|
|
|
394
394
|
}
|
|
395
395
|
return (0, system_scripts_1.printSystemScripts)({ style: exportStyle, network });
|
|
396
396
|
}));
|
|
397
|
-
program
|
|
397
|
+
program
|
|
398
|
+
.command('clean')
|
|
399
|
+
.description('Clean the devnet data, need to stop running the chain first')
|
|
400
|
+
.option('-d, --data', 'Only remove chain data, keep devnet config files')
|
|
401
|
+
.action((options) => (0, clean_1.clean)(options));
|
|
398
402
|
program.command('accounts').description('Print account list info').action(accounts_1.accounts);
|
|
399
403
|
program
|
|
400
404
|
.command('deposit [toAddress] [amountInCKB]')
|
|
@@ -544,22 +548,43 @@ const fs_1 = __importDefault(__nccwpck_require__(79896));
|
|
|
544
548
|
const fs_2 = __nccwpck_require__(37293);
|
|
545
549
|
const setting_1 = __nccwpck_require__(25546);
|
|
546
550
|
const logger_1 = __nccwpck_require__(65370);
|
|
547
|
-
function clean() {
|
|
551
|
+
function clean(options) {
|
|
548
552
|
const settings = (0, setting_1.readSettings)();
|
|
549
553
|
const allDevnetDataPath = settings.devnet.configPath;
|
|
550
|
-
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
554
|
+
const dataOnly = (options === null || options === void 0 ? void 0 : options.data) || false;
|
|
555
|
+
if (dataOnly) {
|
|
556
|
+
// Only clean the chain data subdirectory
|
|
557
|
+
const chainDataPath = settings.devnet.dataPath;
|
|
558
|
+
if ((0, fs_2.isFolderExists)(chainDataPath)) {
|
|
559
|
+
try {
|
|
560
|
+
fs_1.default.rmSync(chainDataPath, { recursive: true });
|
|
561
|
+
logger_1.logger.info(`Chain data cleaned. Devnet config files preserved.`);
|
|
562
|
+
}
|
|
563
|
+
catch (error) {
|
|
564
|
+
logger_1.logger.info(`Did you stop running the chain first?`);
|
|
565
|
+
logger_1.logger.error(error.message);
|
|
566
|
+
}
|
|
555
567
|
}
|
|
556
|
-
|
|
557
|
-
logger_1.logger.info(`
|
|
558
|
-
logger_1.logger.error(error.message);
|
|
568
|
+
else {
|
|
569
|
+
logger_1.logger.info(`Nothing to clean. Chain data directory ${chainDataPath} not found.`);
|
|
559
570
|
}
|
|
560
571
|
}
|
|
561
572
|
else {
|
|
562
|
-
|
|
573
|
+
// Clean everything - the original behavior
|
|
574
|
+
// this is the root folder of devnet, it contains config, data, debugFullTransactions, transactions, failed-transactions, contracts
|
|
575
|
+
if ((0, fs_2.isFolderExists)(allDevnetDataPath)) {
|
|
576
|
+
try {
|
|
577
|
+
fs_1.default.rmSync(allDevnetDataPath, { recursive: true });
|
|
578
|
+
logger_1.logger.info(`Chain data cleaned.`);
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
logger_1.logger.info(`Did you stop running the chain first?`);
|
|
582
|
+
logger_1.logger.error(error.message);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
logger_1.logger.info(`Nothing to clean. Devnet data directory ${allDevnetDataPath} not found.`);
|
|
587
|
+
}
|
|
563
588
|
}
|
|
564
589
|
}
|
|
565
590
|
|
|
@@ -129022,7 +129047,7 @@ module.exports = {"version":"3.17.0"};
|
|
|
129022
129047
|
/***/ ((module) => {
|
|
129023
129048
|
|
|
129024
129049
|
"use strict";
|
|
129025
|
-
module.exports = /*#__PURE__*/JSON.parse('{"rE":"0.4.
|
|
129050
|
+
module.exports = /*#__PURE__*/JSON.parse('{"rE":"0.4.2","h_":"ckb development network for your first try"}');
|
|
129026
129051
|
|
|
129027
129052
|
/***/ })
|
|
129028
129053
|
|