@epic-web/workshop-utils 6.49.0 → 6.49.2
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/workshops.server.d.ts +13 -0
- package/dist/workshops.server.js +28 -0
- package/package.json +1 -1
|
@@ -21,6 +21,19 @@ export declare function getReposDirectory(): Promise<string>;
|
|
|
21
21
|
export declare function isReposDirectoryConfigured(): Promise<boolean>;
|
|
22
22
|
export declare function getDefaultReposDir(): string;
|
|
23
23
|
export declare function setReposDirectory(directory: string): Promise<void>;
|
|
24
|
+
export type ReposDirectoryStatus = {
|
|
25
|
+
accessible: true;
|
|
26
|
+
} | {
|
|
27
|
+
accessible: false;
|
|
28
|
+
error: string;
|
|
29
|
+
path: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Verify that the configured repos directory exists and is accessible.
|
|
33
|
+
* If the directory doesn't exist, attempts to create it.
|
|
34
|
+
* Returns status indicating whether the directory is accessible.
|
|
35
|
+
*/
|
|
36
|
+
export declare function verifyReposDirectory(): Promise<ReposDirectoryStatus>;
|
|
24
37
|
/**
|
|
25
38
|
* Scan a directory for workshops (directories with package.json containing "epicshop" property)
|
|
26
39
|
*/
|
package/dist/workshops.server.js
CHANGED
|
@@ -86,6 +86,34 @@ export async function setReposDirectory(directory) {
|
|
|
86
86
|
config.reposDirectory = path.resolve(directory);
|
|
87
87
|
await saveConfig(config);
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Verify that the configured repos directory exists and is accessible.
|
|
91
|
+
* If the directory doesn't exist, attempts to create it.
|
|
92
|
+
* Returns status indicating whether the directory is accessible.
|
|
93
|
+
*/
|
|
94
|
+
export async function verifyReposDirectory() {
|
|
95
|
+
const reposDir = await getReposDirectory();
|
|
96
|
+
try {
|
|
97
|
+
// Try to access the directory
|
|
98
|
+
await fs.access(reposDir);
|
|
99
|
+
return { accessible: true };
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Directory doesn't exist, try to create it
|
|
103
|
+
try {
|
|
104
|
+
await fs.mkdir(reposDir, { recursive: true });
|
|
105
|
+
return { accessible: true };
|
|
106
|
+
}
|
|
107
|
+
catch (mkdirError) {
|
|
108
|
+
const errorMessage = mkdirError instanceof Error ? mkdirError.message : String(mkdirError);
|
|
109
|
+
return {
|
|
110
|
+
accessible: false,
|
|
111
|
+
error: errorMessage,
|
|
112
|
+
path: reposDir,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
89
117
|
/**
|
|
90
118
|
* Scan a directory for workshops (directories with package.json containing "epicshop" property)
|
|
91
119
|
*/
|