@offckb/cli 0.2.0-canary-b94f482.0 → 0.2.0-canary-d9fd5d4.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.
@@ -35,11 +35,12 @@ const config_1 = require("../util/config");
35
35
  const validator_1 = require("../util/validator");
36
36
  const type_1 = require("../util/type");
37
37
  function injectConfig() {
38
- const targetPath = const_1.currentExecPath;
39
38
  (0, validator_1.validateTypescriptWorkspace)();
40
39
  // inject the offckb.config.ts file into users workspace
41
40
  // copy config template
42
- (0, fs_1.copyFileSync)(const_1.predefinedOffCKBConfigTsPath, targetPath);
41
+ (0, fs_1.copyFileSync)(const_1.predefinedOffCKBConfigTsPath, const_1.userOffCKBConfigPath);
42
+ // update the version in the offckb.config.ts
43
+ (0, config_1.updateOffCKBConfigVersion)(const_1.userOffCKBConfigPath);
43
44
  // update the config
44
45
  const devnetFullLumosConfig = (0, config_1.buildFullLumosConfig)(type_1.Network.devnet);
45
46
  const testnetFullLumosConfig = (0, config_1.buildFullLumosConfig)(type_1.Network.testnet);
@@ -59,7 +60,7 @@ function injectConfig() {
59
60
  const indexer = offCKB.indexer;
60
61
  const rpc = offCKB.rpc;
61
62
 
62
- Check example at https://github.com/nervosnetwork/docs.nervos.org/tree/develop-v2/examples/create-dob
63
+ Check example at https://github.com/nervosnetwork/docs.nervos.org/tree/develop/examples/simple-transfer
63
64
  `);
64
65
  }
65
66
  exports.injectConfig = injectConfig;
@@ -1,5 +1,6 @@
1
1
  import { config } from '@ckb-lumos/lumos';
2
2
  import { Network } from './type';
3
+ export declare function updateOffCKBConfigVersion(filePath: string): void;
3
4
  export declare function updateScriptInfoInOffCKBConfigTs(newConfig: config.Config, filePath: string, network: Network): void;
4
5
  export declare function readUserDeployedScriptsInfo(network: Network): Record<string, config.ScriptConfig>;
5
6
  export declare function readPredefinedDevnetLumosConfig(): config.Config;
@@ -23,12 +23,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.buildFullLumosConfig = exports.readPredefinedTestnetLumosConfig = exports.readPredefinedMainnetLumosConfig = exports.readPredefinedDevnetLumosConfig = exports.readUserDeployedScriptsInfo = exports.updateScriptInfoInOffCKBConfigTs = void 0;
26
+ exports.buildFullLumosConfig = exports.readPredefinedTestnetLumosConfig = exports.readPredefinedMainnetLumosConfig = exports.readPredefinedDevnetLumosConfig = exports.readUserDeployedScriptsInfo = exports.updateScriptInfoInOffCKBConfigTs = exports.updateOffCKBConfigVersion = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
29
  const const_1 = require("../cfg/const");
30
30
  const lumos_1 = require("@ckb-lumos/lumos");
31
31
  const type_1 = require("./type");
32
+ const version = require('../../package.json').version;
33
+ function updateOffCKBConfigVersion(filePath) {
34
+ const versionTarget = 'update-me-offckb-config-version';
35
+ let fileContent = fs.readFileSync(filePath, 'utf-8');
36
+ fileContent = fileContent.replace(versionTarget, version);
37
+ // Write the updated content back to the file
38
+ fs.writeFileSync(filePath, fileContent, 'utf-8');
39
+ }
40
+ exports.updateOffCKBConfigVersion = updateOffCKBConfigVersion;
32
41
  function updateScriptInfoInOffCKBConfigTs(newConfig, filePath, network) {
33
42
  // Read the content of the offckb.config.ts file
34
43
  let fileContent = fs.readFileSync(filePath, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.2.0-canary-b94f482.0",
3
+ "version": "0.2.0-canary-d9fd5d4.0",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "Retric Su <retric@cryptape.com>",
6
6
  "license": "MIT",