Skip to content

Commit ed91c20

Browse files
CopilotRetricSu
andauthored
Fix README template file extensions: use ts/js instead of typescript/javascript (#327)
* Initial plan * Fix README template to use correct file extensions (ts/js) instead of full language names Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RetricSu <23436060+RetricSu@users.noreply.github.com>
1 parent 1567558 commit ed91c20

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dist/
77
.vscode
88
templates/temp-clone-folder
99
build/
10+
package-lock.json

src/templates/processor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export class TemplateProcessor {
5353
processed = processed.replace(/\{\{PROJECT_PATH\}\}/g, context.projectPath || '.');
5454
processed = processed.replace(/\{\{CONTRACT_NAME\}\}/g, context.contractName || 'hello-world');
5555
processed = processed.replace(/\{\{LANGUAGE\}\}/g, context.language);
56+
// Add LANGUAGE_EXT variable for file extensions (typescript -> ts, javascript -> js)
57+
const languageExtension = context.language === 'typescript' ? 'ts' : 'js';
58+
processed = processed.replace(/\{\{LANGUAGE_EXT\}\}/g, languageExtension);
5659
processed = processed.replace(/\{\{PACKAGE_MANAGER\}\}/g, context.packageManager);
5760

5861
return processed;

templates/v4/base-template/README.md.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ This project uses the CKB JavaScript VM (ckb-js-vm) to write smart contracts in
1313
├── contracts/ # Smart contract source code
1414
│ └── hello-world/
1515
│ └── src/
16-
│ └── index.{{LANGUAGE}} # Contract implementation
16+
│ └── index.{{LANGUAGE_EXT}} # Contract implementation
1717
├── tests/ # Contract tests
18-
│ └── hello-world.test.{{LANGUAGE}}
18+
│ └── hello-world.test.{{LANGUAGE_EXT}}
1919
├── scripts/ # Build and utility scripts
2020
│ ├── build-all.js
2121
│ ├── build-contract.js
@@ -93,7 +93,7 @@ This will:
9393

9494
### Contract Development
9595

96-
1. Edit your contract in `contracts/<contract-name>/src/index.{{LANGUAGE}}`
96+
1. Edit your contract in `contracts/<contract-name>/src/index.{{LANGUAGE_EXT}}`
9797
2. Build the contract: `{{PACKAGE_MANAGER}} run build:contract <contract-name>`
9898
3. Run tests: `{{PACKAGE_MANAGER}} test -- <contract-name>`
9999

0 commit comments

Comments
 (0)