33import fs from 'fs' ;
44import path from 'path' ;
55import readline from 'readline' ;
6- import { fileURLToPath } from 'url' ;
7-
8- const __filename = fileURLToPath ( import . meta. url ) ;
9- const __dirname = path . dirname ( __filename ) ;
106
117function askQuestion ( question ) {
128 const rl = readline . createInterface ( {
@@ -28,10 +24,6 @@ function validateContractName(name) {
2824 return validNamePattern . test ( name ) && name . length > 0 ;
2925}
3026
31- function processTemplate ( content , contractName , language ) {
32- return content . replace ( / \{ \{ C O N T R A C T _ N A M E \} \} / g, contractName ) . replace ( / \{ \{ L A N G U A G E \} \} / g, language ) ;
33- }
34-
3527async function addContract ( ) {
3628 let contractName = process . argv [ 2 ] ;
3729
@@ -123,7 +115,7 @@ describe('${contractName} contract', () => {
123115
124116 const mainScript = resource.deployCell(hexFrom(readFileSync(DEFAULT_SCRIPT_CKB_JS_VM)), tx, false);
125117 const alwaysSuccessScript = resource.deployCell(hexFrom(readFileSync(DEFAULT_SCRIPT_ALWAYS_SUCCESS)), tx, false);
126- const contractScript = resource.deployCell(hexFrom(readFileSync('contracts/${ contractName } /dist/index .bc')), tx, false);
118+ const contractScript = resource.deployCell(hexFrom(readFileSync('contracts/${ contractName } /dist/${ contractName } .bc')), tx, false);
127119
128120 mainScript.args = hexFrom(
129121 '0x0000' +
0 commit comments