create-fhevm-playground-pro 1.0.20 → 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 -21
- 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,28 +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
|
|
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
|
-
}
|
|
93
|
-
}
|
|
73
|
+
fs_extra_1.default.copySync(testSrc, testDest, { overwrite: true });
|
|
94
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
|
+
}
|
|
95
84
|
// Create test-helpers.js stub if it doesn't exist
|
|
96
85
|
const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
|
|
97
86
|
if (!fs_extra_1.default.existsSync(testHelpersPath)) {
|