@autobe/filesystem 0.29.2 → 0.30.0-dev.20260315
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/LICENSE +661 -661
- package/README.md +261 -0
- package/lib/RepositoryFileSystem.js +2 -2
- package/lib/RepositoryFileSystem.js.map +1 -1
- package/package.json +4 -3
- package/src/CompressUtil.ts +20 -20
- package/src/FileSystemIterator.ts +54 -54
- package/src/RepositoryFileSystem.ts +93 -92
- package/src/index.ts +3 -3
|
@@ -1,92 +1,93 @@
|
|
|
1
|
-
import { OpenApi } from "@
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
1
|
+
import { OpenApi } from "@typia/interface";
|
|
2
|
+
import { OpenApiConverter } from "@typia/utils";
|
|
3
|
+
import cp from "child_process";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { VariadicSingleton } from "tstl";
|
|
6
|
+
|
|
7
|
+
import { FileSystemIterator } from "./FileSystemIterator";
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
export namespace RepositoryFileSystem {
|
|
11
|
+
export const analyze = async (
|
|
12
|
+
account: string,
|
|
13
|
+
project: string,
|
|
14
|
+
): Promise<Record<string, string>> => {
|
|
15
|
+
await vs.get(account, project);
|
|
16
|
+
return FileSystemIterator.read({
|
|
17
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/docs/requirements`,
|
|
18
|
+
extension: "md",
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const prisma = async (
|
|
23
|
+
account: string,
|
|
24
|
+
project: string,
|
|
25
|
+
): Promise<Record<string, string>> => {
|
|
26
|
+
await vs.get(account, project);
|
|
27
|
+
const result: Record<string, string> = await FileSystemIterator.read({
|
|
28
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/prisma/schema`,
|
|
29
|
+
extension: "prisma",
|
|
30
|
+
});
|
|
31
|
+
for (const [key, value] of Object.entries(result))
|
|
32
|
+
result[key] = value.split("@author Samchon").join("@author AutoBE");
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const src = async (
|
|
37
|
+
account: string,
|
|
38
|
+
project: string,
|
|
39
|
+
): Promise<Record<string, string>> => {
|
|
40
|
+
await vs.get(account, project);
|
|
41
|
+
return FileSystemIterator.read({
|
|
42
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/src`,
|
|
43
|
+
prefix: "src/",
|
|
44
|
+
extension: "ts",
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const swagger = async (
|
|
49
|
+
account: string,
|
|
50
|
+
project: string,
|
|
51
|
+
): Promise<OpenApi.IDocument> => {
|
|
52
|
+
await vs.get(account, project);
|
|
53
|
+
return OpenApiConverter.upgradeDocument(
|
|
54
|
+
JSON.parse(
|
|
55
|
+
await fs.promises.readFile(
|
|
56
|
+
`${ROOT}/internals/repositories/${account}/${project}/packages/api/swagger.json`,
|
|
57
|
+
"utf8",
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const clone = async (
|
|
64
|
+
account: string,
|
|
65
|
+
project: string,
|
|
66
|
+
): Promise<void> => {
|
|
67
|
+
await vs.get(account, project);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const vs = new VariadicSingleton(
|
|
71
|
+
async (account: string, project: string): Promise<void> => {
|
|
72
|
+
const location: string = `${ROOT}/internals/repositories/${account}/${project}`;
|
|
73
|
+
if (fs.existsSync(location))
|
|
74
|
+
cp.execSync("git pull", {
|
|
75
|
+
cwd: location,
|
|
76
|
+
stdio: "ignore",
|
|
77
|
+
});
|
|
78
|
+
else {
|
|
79
|
+
try {
|
|
80
|
+
await fs.promises.mkdir(`${ROOT}/internals/repositories/${account}`, {
|
|
81
|
+
recursive: true,
|
|
82
|
+
});
|
|
83
|
+
} catch {}
|
|
84
|
+
cp.execSync(`git clone https://github.com/${account}/${project}`, {
|
|
85
|
+
cwd: `${ROOT}/internals/repositories/${account}`,
|
|
86
|
+
stdio: "ignore",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const ROOT = `${__dirname}/../../..`;
|
|
93
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./FileSystemIterator";
|
|
2
|
-
export * from "./CompressUtil";
|
|
3
|
-
export * from "./RepositoryFileSystem";
|
|
1
|
+
export * from "./FileSystemIterator";
|
|
2
|
+
export * from "./CompressUtil";
|
|
3
|
+
export * from "./RepositoryFileSystem";
|