create-fhevm-playground-pro 1.0.18 → 1.0.20
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/base-template/hardhat.config.js +3 -0
- package/dist/scaffolder.js +21 -10
- package/package.json +1 -1
package/dist/scaffolder.js
CHANGED
|
@@ -70,17 +70,28 @@ async function createExample(options) {
|
|
|
70
70
|
console.log(chalk_1.default.cyan(`Overlaid contracts from ${exampleDirName}-premium`));
|
|
71
71
|
}
|
|
72
72
|
if (fs_extra_1.default.existsSync(testSrc)) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
// Copy tests directory content
|
|
74
|
+
const testFiles = fs_extra_1.default.readdirSync(testSrc);
|
|
75
|
+
for (const file of testFiles) {
|
|
76
|
+
const srcPath = path_1.default.join(testSrc, file);
|
|
77
|
+
if (fs_extra_1.default.statSync(srcPath).isFile()) {
|
|
78
|
+
const destPath = path_1.default.join(testDest, file);
|
|
79
|
+
// Convert .ts to .js (rename extension)
|
|
80
|
+
const destFileName = file.endsWith('.ts') ? file.replace('.ts', '.js') : file;
|
|
81
|
+
const finalDestPath = path_1.default.join(testDest, destFileName);
|
|
82
|
+
let content = fs_extra_1.default.readFileSync(srcPath, 'utf-8');
|
|
83
|
+
// Fix import paths in test files
|
|
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 - remove type annotations
|
|
86
|
+
if (file.endsWith('.ts')) {
|
|
87
|
+
// Remove ": Type" patterns for variable declarations
|
|
88
|
+
// This regex matches "variable: TypeAnnotation" patterns
|
|
89
|
+
content = content.replace(/([a-zA-Z_$]\w*)\s*:\s*(?:any|void|string|number|boolean|object|{[^}]*}|[A-Za-z_$][A-Za-z0-9_$<>\[\]|&\s]*)/g, '$1');
|
|
90
|
+
}
|
|
91
|
+
fs_extra_1.default.writeFileSync(finalDestPath, content);
|
|
92
|
+
}
|
|
83
93
|
}
|
|
94
|
+
console.log(chalk_1.default.cyan(`Overlaid tests from ${exampleDirName}-premium`));
|
|
84
95
|
// Create test-helpers.js stub if it doesn't exist
|
|
85
96
|
const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
|
|
86
97
|
if (!fs_extra_1.default.existsSync(testHelpersPath)) {
|