create-fhevm-playground-pro 1.0.20 → 1.0.21
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/dist/scaffolder.js +11 -4
- package/package.json +1 -1
package/dist/scaffolder.js
CHANGED
|
@@ -82,11 +82,18 @@ async function createExample(options) {
|
|
|
82
82
|
let content = fs_extra_1.default.readFileSync(srcPath, 'utf-8');
|
|
83
83
|
// Fix import paths in test files
|
|
84
84
|
content = content.replace(/import\s+{([^}]+)}\s+from\s+"\.\.\/\.\.\/\.\.\/\.\.\/scripts\/test-helpers"/, 'import { $1 } from "./test-helpers.js"');
|
|
85
|
-
// Only convert to .js if it's a .ts file
|
|
85
|
+
// Only convert to .js if it's a .ts file - remove type annotations carefully
|
|
86
86
|
if (file.endsWith('.ts')) {
|
|
87
|
-
// Remove ":
|
|
88
|
-
//
|
|
89
|
-
|
|
87
|
+
// Remove ": TypeAnnotation" patterns but be very specific:
|
|
88
|
+
// Match ": " followed by type patterns (capitalized names, generics, etc.)
|
|
89
|
+
// Use negative lookbehind to avoid matching destructuring patterns like { name: value }
|
|
90
|
+
// Actually, simpler approach: only match patterns clearly TypeScript
|
|
91
|
+
// Pattern: ": " followed by word starting with capital or keywords
|
|
92
|
+
content = content.replace(/:\s*(any|void|string|number|boolean|object|never|unknown|keyof|readonly)\b/g, '');
|
|
93
|
+
// Also match capitalized type names
|
|
94
|
+
content = content.replace(/:\s*([A-Z][A-Za-z0-9_$<>\[\]|&\s]*?)(?=[,}\)\n=;])/g, '');
|
|
95
|
+
// Remove function return type annotations like ": Promise<void>"
|
|
96
|
+
content = content.replace(/\)\s*:\s*([A-Z][A-Za-z0-9_$<>\[\]|&\s]*?)\s*{/g, ') {');
|
|
90
97
|
}
|
|
91
98
|
fs_extra_1.default.writeFileSync(finalDestPath, content);
|
|
92
99
|
}
|