pika-ux 1.0.0-beta.5 → 1.0.0-beta.6
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/cli/index.js +31 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -101,15 +101,34 @@ function toHumanReadable(projectName) {
|
|
|
101
101
|
return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join(" ");
|
|
102
102
|
}
|
|
103
103
|
async function processTemplateFiles(sourceDir, targetDir, variables) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
logger.debug(`Processing template files from: ${sourceDir}`);
|
|
105
|
+
logger.debug(`Target directory: ${targetDir}`);
|
|
106
|
+
let files;
|
|
107
|
+
try {
|
|
108
|
+
files = await glob("**/*", {
|
|
109
|
+
cwd: sourceDir,
|
|
110
|
+
dot: true,
|
|
111
|
+
nodir: true,
|
|
112
|
+
absolute: false
|
|
113
|
+
});
|
|
114
|
+
logger.debug(`Glob found ${files.length} files`);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
logger.debug(`Glob error: ${error}`);
|
|
117
|
+
throw new Error(`Failed to read template directory: ${error}`);
|
|
118
|
+
}
|
|
119
|
+
if (files.length === 0) {
|
|
120
|
+
logger.warn(`No files found in template directory: ${sourceDir}`);
|
|
121
|
+
try {
|
|
122
|
+
const dirContents = await fs.readdir(sourceDir);
|
|
123
|
+
logger.debug(`Directory contents: ${dirContents.join(", ")}`);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
logger.debug(`Could not read directory: ${e}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
110
128
|
for (const file of files) {
|
|
111
129
|
const sourcePath = path2.join(sourceDir, file);
|
|
112
130
|
const targetPath = path2.join(targetDir, file);
|
|
131
|
+
logger.debug(`Copying: ${file}`);
|
|
113
132
|
await fs.ensureDir(path2.dirname(targetPath));
|
|
114
133
|
let content = await fs.readFile(sourcePath, "utf8");
|
|
115
134
|
content = content.replace(/\{projectName\}/g, variables.projectName).replace(/\{humanReadableProjectName\}/g, variables.humanReadableProjectName).replace(/\{pikaUxVersion\}/g, variables.pikaUxVersion);
|
|
@@ -192,8 +211,13 @@ async function createCommand(options = {}) {
|
|
|
192
211
|
try {
|
|
193
212
|
const pikaUxRoot = path2.dirname(require2.resolve("pika-ux/package.json"));
|
|
194
213
|
templateDir = path2.join(pikaUxRoot, "dist/cli/template-files");
|
|
214
|
+
logger.debug(`Template directory resolved to: ${templateDir}`);
|
|
195
215
|
} catch (error) {
|
|
196
216
|
templateDir = path2.join(__dirname, "../template-files");
|
|
217
|
+
logger.debug(`Using fallback template directory: ${templateDir}`);
|
|
218
|
+
}
|
|
219
|
+
if (!await fs.pathExists(templateDir)) {
|
|
220
|
+
throw new Error(`Template directory not found: ${templateDir}`);
|
|
197
221
|
}
|
|
198
222
|
logger.updateSpinner("Processing template files...");
|
|
199
223
|
await copyAndProcessTemplate(templateDir, targetPath, {
|
|
@@ -201,6 +225,7 @@ async function createCommand(options = {}) {
|
|
|
201
225
|
humanReadableProjectName: humanReadableName,
|
|
202
226
|
pikaUxVersion
|
|
203
227
|
});
|
|
228
|
+
logger.debug(`Files copied to: ${targetPath}`);
|
|
204
229
|
logger.stopSpinner(true, "Template files processed");
|
|
205
230
|
const installSpinner = logger.startSpinner("Installing dependencies with pnpm...");
|
|
206
231
|
try {
|