@ruiapp/rapid-configure-tools 0.5.0 → 0.5.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/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("/", "$"),
|
|
@@ -715,7 +733,7 @@ function newDictionaryEntryUpdater(rapidConfigApi) {
|
|
|
715
733
|
return entity.name === input.name;
|
|
716
734
|
},
|
|
717
735
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
718
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "locales", "deprecated"]);
|
|
736
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "color", "icon", "i18n", "locales", "deprecated"]);
|
|
719
737
|
if (changedFieldNames.length) {
|
|
720
738
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
721
739
|
}
|
|
@@ -729,6 +747,9 @@ function newDictionaryEntryUpdater(rapidConfigApi) {
|
|
|
729
747
|
color: input.color,
|
|
730
748
|
icon: input.icon,
|
|
731
749
|
description: input.description,
|
|
750
|
+
i18n: input.i18n,
|
|
751
|
+
locales: input.locales,
|
|
752
|
+
deprecated: input.deprecated,
|
|
732
753
|
orderNum: inputIndex + 1,
|
|
733
754
|
disabled: false,
|
|
734
755
|
};
|
|
@@ -743,6 +764,9 @@ function newDictionaryEntryUpdater(rapidConfigApi) {
|
|
|
743
764
|
color: input.color,
|
|
744
765
|
icon: input.icon,
|
|
745
766
|
description: input.description,
|
|
767
|
+
i18n: input.i18n,
|
|
768
|
+
locales: input.locales,
|
|
769
|
+
deprecated: input.deprecated,
|
|
746
770
|
orderNum: inputIndex + 1,
|
|
747
771
|
disabled: remoteEntity.disabled,
|
|
748
772
|
};
|
|
@@ -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.2",
|
|
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.26"
|
|
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 {
|
|
@@ -42,7 +42,7 @@ export function newDictionaryEntryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
45
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "locales", "deprecated"]);
|
|
45
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "color", "icon", "i18n", "locales", "deprecated"]);
|
|
46
46
|
if (changedFieldNames.length) {
|
|
47
47
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
48
48
|
}
|
|
@@ -57,6 +57,9 @@ export function newDictionaryEntryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
57
57
|
color: input.color,
|
|
58
58
|
icon: input.icon,
|
|
59
59
|
description: input.description,
|
|
60
|
+
i18n: input.i18n,
|
|
61
|
+
locales: input.locales,
|
|
62
|
+
deprecated: input.deprecated,
|
|
60
63
|
orderNum: inputIndex + 1,
|
|
61
64
|
disabled: false,
|
|
62
65
|
};
|
|
@@ -72,6 +75,9 @@ export function newDictionaryEntryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
72
75
|
color: input.color,
|
|
73
76
|
icon: input.icon,
|
|
74
77
|
description: input.description,
|
|
78
|
+
i18n: input.i18n,
|
|
79
|
+
locales: input.locales,
|
|
80
|
+
deprecated: input.deprecated,
|
|
75
81
|
orderNum: inputIndex + 1,
|
|
76
82
|
disabled: remoteEntity.disabled,
|
|
77
83
|
};
|
|
@@ -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}`);
|