create-fhevm-playground-pro 1.0.26 → 1.0.30

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.
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Base template for fhEVM example projects",
5
5
  "scripts": {
6
- "test": "hardhat compile && mocha --require ts-node/register --require hardhat/register 'test/**/*.test.ts'",
6
+ "test": "hardhat compile && (ls test/*.test.* >/dev/null 2>&1 && mocha --require ts-node/register --require hardhat/register 'test/**/*.test.ts' || echo 'No test files found')",
7
7
  "compile": "hardhat compile"
8
8
  },
9
9
  "dependencies": {
@@ -47,21 +47,37 @@ async function createExample(options) {
47
47
  fs_extra_1.default.copySync(baseTemplate, projectDir);
48
48
  // Try to find and overlay the actual example's contracts/tests
49
49
  const exampleDirName = CATEGORY_TO_EXAMPLE_DIR[options.category] || options.category;
50
- const searchPaths = [
51
- // Search relative to package installation
52
- path_1.default.resolve(__dirname, '..', '..', 'central-repo', 'examples', `${exampleDirName}-premium`),
53
- // Also search relative to cwd (for development/local use)
54
- path_1.default.resolve(process.cwd(), 'central-repo', 'examples', `${exampleDirName}-premium`),
55
- path_1.default.resolve(process.cwd(), '..', 'central-repo', 'examples', `${exampleDirName}-premium`),
56
- path_1.default.resolve(process.cwd(), '..', '..', 'central-repo', 'examples', `${exampleDirName}-premium`),
57
- ];
50
+ // Build a list of candidate search paths. Prefer paths relative to the
51
+ // installed package (`__dirname`) first, then fall back to the current
52
+ // working directory and its parents (for development runs).
53
+ const searchPaths = [];
54
+ // Search upward from __dirname (package location)
55
+ let dir = path_1.default.resolve(__dirname);
56
+ for (let i = 0; i < 5; i++) {
57
+ searchPaths.push(path_1.default.join(dir, 'central-repo', 'examples', `${exampleDirName}-premium`));
58
+ dir = path_1.default.resolve(dir, '..');
59
+ }
60
+ // Also search upward from process.cwd()
61
+ dir = path_1.default.resolve(process.cwd());
62
+ for (let i = 0; i < 5; i++) {
63
+ searchPaths.push(path_1.default.join(dir, 'central-repo', 'examples', `${exampleDirName}-premium`));
64
+ dir = path_1.default.resolve(dir, '..');
65
+ }
58
66
  let centralRepoExampleDir = null;
59
67
  for (const searchPath of searchPaths) {
60
68
  if (fs_extra_1.default.existsSync(searchPath)) {
61
69
  centralRepoExampleDir = searchPath;
70
+ console.log(chalk_1.default.green(`Found central-repo example at ${searchPath}`));
62
71
  break;
63
72
  }
64
73
  }
74
+ if (!centralRepoExampleDir) {
75
+ console.log(chalk_1.default.yellow(`Example ${exampleDirName}-premium not found in any of these locations:`));
76
+ // Show a few of the paths we tried (first 8)
77
+ for (const p of searchPaths.slice(0, 8)) {
78
+ console.log(chalk_1.default.gray(` - ${p}`));
79
+ }
80
+ }
65
81
  if (centralRepoExampleDir) {
66
82
  // Overlay contracts and tests from the real example
67
83
  const contractsSrc = path_1.default.join(centralRepoExampleDir, 'contracts');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.26",
3
+ "version": "1.0.30",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {