epicshop 6.49.1 ā 6.49.3
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/commands/workshops.js +68 -0
- package/package.json +2 -2
|
@@ -1212,6 +1212,70 @@ export async function config(options = {}) {
|
|
|
1212
1212
|
};
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Ensure the configured repos directory is accessible.
|
|
1217
|
+
* If it's not accessible, prompts the user to change the directory.
|
|
1218
|
+
* Returns true if the directory is accessible (after potential change), false if user cancels.
|
|
1219
|
+
*/
|
|
1220
|
+
async function ensureReposDirectoryAccessible() {
|
|
1221
|
+
const { verifyReposDirectory, setReposDirectory, getReposDirectory } = await import('@epic-web/workshop-utils/workshops.server');
|
|
1222
|
+
const status = await verifyReposDirectory();
|
|
1223
|
+
if (status.accessible) {
|
|
1224
|
+
return true;
|
|
1225
|
+
}
|
|
1226
|
+
// Directory is not accessible
|
|
1227
|
+
console.log();
|
|
1228
|
+
console.log(chalk.red(`ā Cannot access the configured workshops directory:`));
|
|
1229
|
+
console.log(chalk.gray(` Path: ${status.path}`));
|
|
1230
|
+
console.log(chalk.gray(` Error: ${status.error}`));
|
|
1231
|
+
console.log();
|
|
1232
|
+
// In CI mode, we can't prompt - just fail
|
|
1233
|
+
if (isCiEnvironment()) {
|
|
1234
|
+
console.log(chalk.yellow(`š” Tip: Set a different directory with: npx epicshop config --repos-dir <path>`));
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
// Check if we can prompt
|
|
1238
|
+
assertCanPrompt({
|
|
1239
|
+
reason: 'change the workshops directory',
|
|
1240
|
+
hints: [
|
|
1241
|
+
'Set a different directory: npx epicshop config --repos-dir <path>',
|
|
1242
|
+
'Or run this command in a TTY to change the directory interactively.',
|
|
1243
|
+
],
|
|
1244
|
+
});
|
|
1245
|
+
const { confirm } = await import('@inquirer/prompts');
|
|
1246
|
+
const shouldChange = await confirm({
|
|
1247
|
+
message: 'Would you like to change the configured directory?',
|
|
1248
|
+
default: true,
|
|
1249
|
+
});
|
|
1250
|
+
if (!shouldChange) {
|
|
1251
|
+
console.log(chalk.gray(`\nš” Tip: You can change the directory later with: npx epicshop config --repos-dir <path>`));
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
// Let user browse for a new directory
|
|
1255
|
+
console.log();
|
|
1256
|
+
console.log(chalk.cyan('šØ Use the directory browser to select a new location.'));
|
|
1257
|
+
console.log(chalk.gray(' Type to search, use arrow keys to navigate.\n'));
|
|
1258
|
+
const currentDir = await getReposDirectory();
|
|
1259
|
+
const newDir = await browseDirectory(path.dirname(currentDir));
|
|
1260
|
+
const resolvedPath = path.resolve(newDir);
|
|
1261
|
+
// Create the directory first to ensure it's accessible before saving config
|
|
1262
|
+
try {
|
|
1263
|
+
await fs.promises.mkdir(resolvedPath, { recursive: true });
|
|
1264
|
+
}
|
|
1265
|
+
catch (mkdirError) {
|
|
1266
|
+
const errorMessage = mkdirError instanceof Error ? mkdirError.message : String(mkdirError);
|
|
1267
|
+
console.log();
|
|
1268
|
+
console.log(chalk.red(`ā Failed to create directory: ${errorMessage}`));
|
|
1269
|
+
console.log(chalk.gray(`\nš” Tip: Choose a different location or check permissions.`));
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
// Only save the config after the directory is confirmed accessible
|
|
1273
|
+
await setReposDirectory(resolvedPath);
|
|
1274
|
+
console.log();
|
|
1275
|
+
console.log(chalk.green(`ā
Workshops directory set to: ${chalk.bold(resolvedPath)}`));
|
|
1276
|
+
console.log();
|
|
1277
|
+
return true;
|
|
1278
|
+
}
|
|
1215
1279
|
/**
|
|
1216
1280
|
* Check if the workshops directory is configured, and run onboarding if not
|
|
1217
1281
|
* Call this at the start of any command that requires the config to be set
|
|
@@ -1219,6 +1283,10 @@ export async function config(options = {}) {
|
|
|
1219
1283
|
export async function ensureConfigured() {
|
|
1220
1284
|
const { isReposDirectoryConfigured } = await import('@epic-web/workshop-utils/workshops.server');
|
|
1221
1285
|
if (await isReposDirectoryConfigured()) {
|
|
1286
|
+
// Directory is configured, but verify it's still accessible
|
|
1287
|
+
if (!(await ensureReposDirectoryAccessible())) {
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1222
1290
|
return true;
|
|
1223
1291
|
}
|
|
1224
1292
|
// Not configured:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epicshop",
|
|
3
|
-
"version": "6.49.
|
|
3
|
+
"version": "6.49.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build:watch": "nx watch --projects=epicshop -- nx run \\$NX_PROJECT_NAME:build"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@epic-web/workshop-utils": "6.49.
|
|
53
|
+
"@epic-web/workshop-utils": "6.49.3",
|
|
54
54
|
"@inquirer/prompts": "^7.5.1",
|
|
55
55
|
"chalk": "^5.6.2",
|
|
56
56
|
"close-with-grace": "^2.3.0",
|