create-fhevm-playground-pro 1.0.21 → 1.0.22
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 +5 -4
- package/dist/scaffolder.js +10 -28
- package/package.json +1 -1
|
@@ -9,10 +9,11 @@ const config = {
|
|
|
9
9
|
artifacts: './artifacts'
|
|
10
10
|
},
|
|
11
11
|
mocha: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
timeout: 200000
|
|
12
|
+
extension: ['ts', 'js'],
|
|
13
|
+
spec: 'test/**/*.test.{ts,js}',
|
|
14
|
+
require: 'ts-node/register',
|
|
15
|
+
timeout: 200000,
|
|
16
|
+
reporter: 'spec'
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
package/dist/scaffolder.js
CHANGED
|
@@ -70,35 +70,17 @@ 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
|
-
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 carefully
|
|
86
|
-
if (file.endsWith('.ts')) {
|
|
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, ') {');
|
|
97
|
-
}
|
|
98
|
-
fs_extra_1.default.writeFileSync(finalDestPath, content);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
73
|
+
fs_extra_1.default.copySync(testSrc, testDest, { overwrite: true });
|
|
101
74
|
console.log(chalk_1.default.cyan(`Overlaid tests from ${exampleDirName}-premium`));
|
|
75
|
+
// Fix import paths in test files for standalone projects
|
|
76
|
+
const testFiles = fs_extra_1.default.readdirSync(testDest).filter(f => f.endsWith('.ts') || f.endsWith('.js'));
|
|
77
|
+
for (const testFile of testFiles) {
|
|
78
|
+
const testPath = path_1.default.join(testDest, testFile);
|
|
79
|
+
let testContent = fs_extra_1.default.readFileSync(testPath, 'utf-8');
|
|
80
|
+
// Replace absolute paths: ../../../../scripts/test-helpers -> ./test-helpers.js
|
|
81
|
+
testContent = testContent.replace(/import\s+{([^}]+)}\s+from\s+"\.\.\/\.\.\/\.\.\/\.\.\/scripts\/test-helpers"/, 'import { $1 } from "./test-helpers.js"');
|
|
82
|
+
fs_extra_1.default.writeFileSync(testPath, testContent);
|
|
83
|
+
}
|
|
102
84
|
// Create test-helpers.js stub if it doesn't exist
|
|
103
85
|
const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
|
|
104
86
|
if (!fs_extra_1.default.existsSync(testHelpersPath)) {
|