@offckb/cli 0.4.2-canary-1af067f.0 → 0.4.2-canary-451da89.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.
package/build/index.js
CHANGED
|
@@ -356,6 +356,7 @@ program
|
|
|
356
356
|
.option('-o, --output <output>', 'Specify the output folder path for the deployment record files', './deployment')
|
|
357
357
|
.option('-t, --type-id', 'Specify if use upgradable type id to deploy the script')
|
|
358
358
|
.option('--privkey <privkey>', 'Specify the private key to deploy scripts')
|
|
359
|
+
.option('-y, --yes', 'Skip confirmation prompt and deploy immediately')
|
|
359
360
|
.action((options) => (0, deploy_1.deploy)(options));
|
|
360
361
|
program
|
|
361
362
|
.command('debug')
|
|
@@ -1138,12 +1139,15 @@ function deploy() {
|
|
|
1138
1139
|
` 🔑 Using ${opt.privkey ? 'custom' : 'default'} private key`,
|
|
1139
1140
|
` 🔄 Type ID: ${enableTypeId ? 'enabled (upgradable)' : 'disabled (immutable)'}`,
|
|
1140
1141
|
]);
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1142
|
+
// Skip confirmation if -y flag is provided
|
|
1143
|
+
if (!opt.yes) {
|
|
1144
|
+
const res = yield (0, prompts_1.confirm)({
|
|
1145
|
+
message: 'Are you sure you want to deploy these contracts?',
|
|
1146
|
+
});
|
|
1147
|
+
if (!res) {
|
|
1148
|
+
logger_1.logger.info('Deployment cancelled.');
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1147
1151
|
}
|
|
1148
1152
|
const results = yield (0, deploy_1.deployBinaries)(outputFolder, binPaths, privateKey, enableTypeId, ckb);
|
|
1149
1153
|
logger_1.logger.info('');
|
|
@@ -3665,6 +3669,9 @@ class TemplateProcessor {
|
|
|
3665
3669
|
processed = processed.replace(/\{\{PROJECT_PATH\}\}/g, context.projectPath || '.');
|
|
3666
3670
|
processed = processed.replace(/\{\{CONTRACT_NAME\}\}/g, context.contractName || 'hello-world');
|
|
3667
3671
|
processed = processed.replace(/\{\{LANGUAGE\}\}/g, context.language);
|
|
3672
|
+
// Add LANGUAGE_EXT variable for file extensions (typescript -> ts, javascript -> js)
|
|
3673
|
+
const languageExtension = context.language === 'typescript' ? 'ts' : 'js';
|
|
3674
|
+
processed = processed.replace(/\{\{LANGUAGE_EXT\}\}/g, languageExtension);
|
|
3668
3675
|
processed = processed.replace(/\{\{PACKAGE_MANAGER\}\}/g, context.packageManager);
|
|
3669
3676
|
return processed;
|
|
3670
3677
|
}
|
package/package.json
CHANGED
|
@@ -13,9 +13,9 @@ This project uses the CKB JavaScript VM (ckb-js-vm) to write smart contracts in
|
|
|
13
13
|
├── contracts/ # Smart contract source code
|
|
14
14
|
│ └── hello-world/
|
|
15
15
|
│ └── src/
|
|
16
|
-
│ └── index.{{
|
|
16
|
+
│ └── index.{{LANGUAGE_EXT}} # Contract implementation
|
|
17
17
|
├── tests/ # Contract tests
|
|
18
|
-
│ └── hello-world.test.{{
|
|
18
|
+
│ └── hello-world.test.{{LANGUAGE_EXT}}
|
|
19
19
|
├── scripts/ # Build and utility scripts
|
|
20
20
|
│ ├── build-all.js
|
|
21
21
|
│ ├── build-contract.js
|
|
@@ -93,7 +93,7 @@ This will:
|
|
|
93
93
|
|
|
94
94
|
### Contract Development
|
|
95
95
|
|
|
96
|
-
1. Edit your contract in `contracts/<contract-name>/src/index.{{
|
|
96
|
+
1. Edit your contract in `contracts/<contract-name>/src/index.{{LANGUAGE_EXT}}`
|
|
97
97
|
2. Build the contract: `{{PACKAGE_MANAGER}} run build:contract <contract-name>`
|
|
98
98
|
3. Run tests: `{{PACKAGE_MANAGER}} test -- <contract-name>`
|
|
99
99
|
|