create-fhevm-playground-pro 1.0.14 → 1.0.15

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.
Files changed (2) hide show
  1. package/dist/scaffolder.js +12 -5
  2. package/package.json +1 -1
@@ -72,14 +72,21 @@ async function createExample(options) {
72
72
  if (fs_extra_1.default.existsSync(testSrc)) {
73
73
  fs_extra_1.default.copySync(testSrc, testDest, { overwrite: true });
74
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'));
75
+ // Convert TypeScript test files to JavaScript for ESM compatibility
76
+ const testFiles = fs_extra_1.default.readdirSync(testDest).filter(f => f.endsWith('.ts'));
77
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');
78
+ const tsPath = path_1.default.join(testDest, testFile);
79
+ const jsPath = path_1.default.join(testDest, testFile.replace('.ts', '.test.js'));
80
+ let testContent = fs_extra_1.default.readFileSync(tsPath, 'utf-8');
81
+ // Remove TypeScript type annotations and imports
82
+ // Remove type annotations like : any, : type, etc.
83
+ testContent = testContent.replace(/:\s*(\w+(<[^>]*>)?(\[\])?)/g, '');
80
84
  // Replace absolute paths: ../../../../scripts/test-helpers -> ./test-helpers.js
81
85
  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);
86
+ // Write as .test.js
87
+ fs_extra_1.default.writeFileSync(jsPath, testContent);
88
+ // Remove original .ts file
89
+ fs_extra_1.default.removeSync(tsPath);
83
90
  }
84
91
  // Create test-helpers.js stub if it doesn't exist
85
92
  const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {