codify-plugin-lib 1.0.182-beta32 → 1.0.182-beta33
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/utils/load-resources.js +11 -11
- package/package.json +1 -1
- package/src/utils/load-resources.ts +11 -11
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
export const listAllResources = async () => {
|
|
4
|
-
const resourceDir = await fs.readdir('./
|
|
4
|
+
const resourceDir = await fs.readdir('./resources');
|
|
5
5
|
const dedupSet = new Set();
|
|
6
6
|
const result = new Set();
|
|
7
7
|
for (const folder of resourceDir) {
|
|
8
|
-
if (await fs.stat(path.join('./
|
|
9
|
-
for (const folderContents of await fs.readdir(path.join('./
|
|
10
|
-
const isDirectory = await fs.stat(path.join('./
|
|
8
|
+
if (await fs.stat(path.join('./resources', folder)).then(s => s.isDirectory()).catch(() => false)) {
|
|
9
|
+
for (const folderContents of await fs.readdir(path.join('./resources', folder))) {
|
|
10
|
+
const isDirectory = await fs.stat(path.join('./resources', folder, folderContents)).then(s => s.isDirectory());
|
|
11
11
|
// console.log(folderContents, isDirectory);
|
|
12
12
|
if (isDirectory) {
|
|
13
|
-
for (const innerContents of await fs.readdir(path.join('./
|
|
14
|
-
if (!dedupSet.has(path.join('./
|
|
15
|
-
dedupSet.add(path.join('./
|
|
16
|
-
addResourceFromDir(path.join('./
|
|
13
|
+
for (const innerContents of await fs.readdir(path.join('./resources', folder, folderContents))) {
|
|
14
|
+
if (!dedupSet.has(path.join('./resources', folder, folderContents))) {
|
|
15
|
+
dedupSet.add(path.join('./resources', folder, folderContents));
|
|
16
|
+
addResourceFromDir(path.join('./resources', folder, folderContents), result);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
if (!dedupSet.has(path.join('./
|
|
22
|
-
dedupSet.add(path.join('./
|
|
23
|
-
addResourceFromDir(path.join('./
|
|
21
|
+
if (!dedupSet.has(path.join('./resources', folder))) {
|
|
22
|
+
dedupSet.add(path.join('./resources', folder));
|
|
23
|
+
addResourceFromDir(path.join('./resources', folder), result);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -2,27 +2,27 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
export const listAllResources = async () => {
|
|
5
|
-
const resourceDir = await fs.readdir('./
|
|
5
|
+
const resourceDir = await fs.readdir('./resources');
|
|
6
6
|
const dedupSet = new Set();
|
|
7
7
|
const result = new Set<string>();
|
|
8
8
|
|
|
9
9
|
for (const folder of resourceDir) {
|
|
10
|
-
if (await fs.stat(path.join('./
|
|
11
|
-
for (const folderContents of await fs.readdir(path.join('./
|
|
12
|
-
const isDirectory = await fs.stat(path.join('./
|
|
10
|
+
if (await fs.stat(path.join('./resources', folder)).then(s => s.isDirectory()).catch(() => false)) {
|
|
11
|
+
for (const folderContents of await fs.readdir(path.join('./resources', folder))) {
|
|
12
|
+
const isDirectory = await fs.stat(path.join('./resources', folder, folderContents)).then(s => s.isDirectory());
|
|
13
13
|
|
|
14
14
|
// console.log(folderContents, isDirectory);
|
|
15
15
|
if (isDirectory) {
|
|
16
|
-
for (const innerContents of await fs.readdir(path.join('./
|
|
17
|
-
if (!dedupSet.has(path.join('./
|
|
18
|
-
dedupSet.add(path.join('./
|
|
19
|
-
addResourceFromDir(path.join('./
|
|
16
|
+
for (const innerContents of await fs.readdir(path.join('./resources', folder, folderContents))) {
|
|
17
|
+
if (!dedupSet.has(path.join('./resources', folder, folderContents))) {
|
|
18
|
+
dedupSet.add(path.join('./resources', folder, folderContents));
|
|
19
|
+
addResourceFromDir(path.join('./resources', folder,folderContents), result);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
} else {
|
|
23
|
-
if (!dedupSet.has(path.join('./
|
|
24
|
-
dedupSet.add(path.join('./
|
|
25
|
-
addResourceFromDir(path.join('./
|
|
23
|
+
if (!dedupSet.has(path.join('./resources', folder))) {
|
|
24
|
+
dedupSet.add(path.join('./resources', folder));
|
|
25
|
+
addResourceFromDir(path.join('./resources', folder), result);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|