@ruiapp/rapid-configure-tools 0.5.0 → 0.5.1
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/mod.js
CHANGED
|
@@ -22,7 +22,8 @@ function ensureDirectoryExists(dirPath) {
|
|
|
22
22
|
fs__default["default"].mkdirSync(dirPath);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function enumFileBaseNamesInDirectory(
|
|
25
|
+
function enumFileBaseNamesInDirectory(options) {
|
|
26
|
+
const { dirPath, prefix, fileNameFilter } = options;
|
|
26
27
|
let fileNames = [];
|
|
27
28
|
let resolvedDirPath = dirPath;
|
|
28
29
|
const isRelative = dirPath.startsWith(".") || dirPath.startsWith("..");
|
|
@@ -38,9 +39,16 @@ function enumFileBaseNamesInDirectory(dirPath, prefix = "") {
|
|
|
38
39
|
const filePathName = path__default["default"].join(resolvedDirPath, fileName);
|
|
39
40
|
const fileStat = fs__default["default"].statSync(filePathName);
|
|
40
41
|
if (fileStat.isDirectory()) {
|
|
41
|
-
fileNames = fileNames.concat(enumFileBaseNamesInDirectory(
|
|
42
|
+
fileNames = fileNames.concat(enumFileBaseNamesInDirectory({
|
|
43
|
+
dirPath: filePathName,
|
|
44
|
+
prefix: prefix ? `${prefix}/${fileName}` : fileName,
|
|
45
|
+
fileNameFilter,
|
|
46
|
+
}));
|
|
42
47
|
}
|
|
43
48
|
else if (fileStat.isFile()) {
|
|
49
|
+
if (fileNameFilter && !fileNameFilter(fileName)) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
44
52
|
const baseName = path__default["default"].parse(fileName).name;
|
|
45
53
|
if (prefix) {
|
|
46
54
|
fileNames.push(`${prefix}/${baseName}`);
|
|
@@ -59,7 +67,12 @@ function enumFileBaseNamesInDirectory(dirPath, prefix = "") {
|
|
|
59
67
|
*/
|
|
60
68
|
function generateEntityModelIndexFilesOfTypeDir({ modelsDir, outputDir, typeDefFilePath, categoryDirName, modelTypeName, modelsFileName, extraImports, modelWrapper, flattenModelArray, }) {
|
|
61
69
|
const filesDir = path__default["default"].join(modelsDir, categoryDirName);
|
|
62
|
-
const fileNames = enumFileBaseNamesInDirectory(
|
|
70
|
+
const fileNames = enumFileBaseNamesInDirectory({
|
|
71
|
+
dirPath: filesDir,
|
|
72
|
+
fileNameFilter(fileName) {
|
|
73
|
+
return !(fileName.endsWith(".test.js") || fileName.endsWith(".test.ts"));
|
|
74
|
+
},
|
|
75
|
+
});
|
|
63
76
|
const models = fileNames.map((fileName) => {
|
|
64
77
|
return {
|
|
65
78
|
modelName: fileName.replaceAll("/", "$"),
|
|
@@ -113,7 +126,12 @@ function generateEntityModelIndexFilesOfTypeDir({ modelsDir, outputDir, typeDefF
|
|
|
113
126
|
}
|
|
114
127
|
function generateModelIndexFilesOfTypeDir({ modelsDir, outputDir, typeDefFilePath, categoryDirName, modelTypeName, modelsFileName, extraImports, modelWrapper, flattenModelArray, }) {
|
|
115
128
|
const filesDir = path__default["default"].join(modelsDir, categoryDirName);
|
|
116
|
-
const fileNames = enumFileBaseNamesInDirectory(
|
|
129
|
+
const fileNames = enumFileBaseNamesInDirectory({
|
|
130
|
+
dirPath: filesDir,
|
|
131
|
+
fileNameFilter(fileName) {
|
|
132
|
+
return !(fileName.endsWith(".test.js") || fileName.endsWith(".test.ts"));
|
|
133
|
+
},
|
|
134
|
+
});
|
|
117
135
|
const models = fileNames.map((fileName) => {
|
|
118
136
|
return {
|
|
119
137
|
modelName: fileName.replaceAll("/", "$"),
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export declare function ensureDirectoryExists(dirPath: string): void;
|
|
2
|
-
export
|
|
2
|
+
export type EnumFileBaseNamesOptions = {
|
|
3
|
+
dirPath: string;
|
|
4
|
+
prefix?: string;
|
|
5
|
+
fileNameFilter?: (fileName: string) => boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function enumFileBaseNamesInDirectory(options: EnumFileBaseNamesOptions): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruiapp/rapid-configure-tools",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/mod.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"axios-cookiejar-support": "^4.0.7",
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
22
|
"tough-cookie": "^4.1.3",
|
|
23
|
-
"@ruiapp/rapid-extension": "^0.5.
|
|
23
|
+
"@ruiapp/rapid-extension": "^0.5.23"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"scripts": {
|
|
@@ -50,7 +50,12 @@ function generateEntityModelIndexFilesOfTypeDir({
|
|
|
50
50
|
flattenModelArray,
|
|
51
51
|
}: GenerateModelsIndexFileOption) {
|
|
52
52
|
const filesDir = path.join(modelsDir, categoryDirName);
|
|
53
|
-
const fileNames = enumFileBaseNamesInDirectory(
|
|
53
|
+
const fileNames = enumFileBaseNamesInDirectory({
|
|
54
|
+
dirPath: filesDir,
|
|
55
|
+
fileNameFilter(fileName) {
|
|
56
|
+
return !(fileName.endsWith(".test.js") || fileName.endsWith(".test.ts"));
|
|
57
|
+
},
|
|
58
|
+
});
|
|
54
59
|
|
|
55
60
|
const models = fileNames.map((fileName) => {
|
|
56
61
|
return {
|
|
@@ -122,7 +127,12 @@ function generateModelIndexFilesOfTypeDir({
|
|
|
122
127
|
flattenModelArray,
|
|
123
128
|
}: GenerateModelsIndexFileOption) {
|
|
124
129
|
const filesDir = path.join(modelsDir, categoryDirName);
|
|
125
|
-
const fileNames = enumFileBaseNamesInDirectory(
|
|
130
|
+
const fileNames = enumFileBaseNamesInDirectory({
|
|
131
|
+
dirPath: filesDir,
|
|
132
|
+
fileNameFilter(fileName) {
|
|
133
|
+
return !(fileName.endsWith(".test.js") || fileName.endsWith(".test.ts"));
|
|
134
|
+
},
|
|
135
|
+
});
|
|
126
136
|
|
|
127
137
|
const models = fileNames.map((fileName) => {
|
|
128
138
|
return {
|
|
@@ -10,7 +10,14 @@ export function ensureDirectoryExists(dirPath: string) {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type EnumFileBaseNamesOptions = {
|
|
14
|
+
dirPath: string;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
fileNameFilter?: (fileName: string) => boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function enumFileBaseNamesInDirectory(options: EnumFileBaseNamesOptions): string[] {
|
|
20
|
+
const { dirPath, prefix, fileNameFilter } = options;
|
|
14
21
|
let fileNames = [];
|
|
15
22
|
|
|
16
23
|
let resolvedDirPath = dirPath;
|
|
@@ -29,8 +36,18 @@ export function enumFileBaseNamesInDirectory(dirPath: string, prefix: string = "
|
|
|
29
36
|
const filePathName = path.join(resolvedDirPath, fileName);
|
|
30
37
|
const fileStat = fs.statSync(filePathName);
|
|
31
38
|
if (fileStat.isDirectory()) {
|
|
32
|
-
fileNames = fileNames.concat(
|
|
39
|
+
fileNames = fileNames.concat(
|
|
40
|
+
enumFileBaseNamesInDirectory({
|
|
41
|
+
dirPath: filePathName,
|
|
42
|
+
prefix: prefix ? `${prefix}/${fileName}` : fileName,
|
|
43
|
+
fileNameFilter,
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
33
46
|
} else if (fileStat.isFile()) {
|
|
47
|
+
if (fileNameFilter && !fileNameFilter(fileName)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
const baseName = path.parse(fileName).name;
|
|
35
52
|
if (prefix) {
|
|
36
53
|
fileNames.push(`${prefix}/${baseName}`);
|