create-fhevm-playground-pro 1.0.29 → 1.0.31
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/dist/scaffolder.js +24 -8
- package/package.json +1 -1
package/dist/scaffolder.js
CHANGED
|
@@ -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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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');
|