create-fhevm-playground-pro 1.0.12 → 1.0.14
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/package.json +3 -0
- package/dist/scaffolder.js +38 -0
- package/package.json +1 -1
package/dist/scaffolder.js
CHANGED
|
@@ -72,6 +72,44 @@ 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'));
|
|
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
|
+
}
|
|
84
|
+
// Create test-helpers.js stub if it doesn't exist
|
|
85
|
+
const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
|
|
86
|
+
if (!fs_extra_1.default.existsSync(testHelpersPath)) {
|
|
87
|
+
const testHelpersContent = `const isMocked = process.env.MOCK === 'true';
|
|
88
|
+
|
|
89
|
+
export async function initGateway() {
|
|
90
|
+
if (isMocked) {
|
|
91
|
+
console.log('Gateway initialized (mocked mode)');
|
|
92
|
+
} else {
|
|
93
|
+
console.log('Gateway initialized');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function getSignatureAndEncryption(data) {
|
|
98
|
+
// In mocked mode, return dummy encrypted values for fast testing
|
|
99
|
+
// In real mode, this would handle actual FHE cryptographic operations
|
|
100
|
+
return {
|
|
101
|
+
ciphertext: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
102
|
+
signature: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
103
|
+
encryption: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function isMockedMode() {
|
|
108
|
+
return isMocked;
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
fs_extra_1.default.writeFileSync(testHelpersPath, testHelpersContent);
|
|
112
|
+
}
|
|
75
113
|
}
|
|
76
114
|
}
|
|
77
115
|
else {
|