definition-generator-framework 1.13.0 → 1.13.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.
|
@@ -57,57 +57,57 @@ exports.Const = {
|
|
|
57
57
|
]
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
60
|
+
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
61
61
|
`;
|
|
62
|
-
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
62
|
+
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
63
63
|
`;
|
|
64
|
-
let complexConstExpected = `export const ConstSample: any = {
|
|
65
|
-
type: 'bow',
|
|
66
|
-
material: 'WoodenItemMaterial',
|
|
67
|
-
maxQuantity: 10,
|
|
68
|
-
mainHand: undefined,
|
|
69
|
-
offHand: undefined,
|
|
70
|
-
bothHands: {
|
|
71
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
72
|
-
parryDice: undefined,
|
|
73
|
-
attacks: [
|
|
74
|
-
{
|
|
75
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
76
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
77
|
-
range: 'WeaponRange.ranged',
|
|
78
|
-
requiresSetup: false,
|
|
79
|
-
unparryable: true,
|
|
80
|
-
lowersQuantity: true,
|
|
81
|
-
projectileType: 'ProjectileType.arrow',
|
|
82
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
};
|
|
64
|
+
let complexConstExpected = `export const ConstSample: any = {
|
|
65
|
+
type: 'bow',
|
|
66
|
+
material: 'WoodenItemMaterial',
|
|
67
|
+
maxQuantity: 10,
|
|
68
|
+
mainHand: undefined,
|
|
69
|
+
offHand: undefined,
|
|
70
|
+
bothHands: {
|
|
71
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
72
|
+
parryDice: undefined,
|
|
73
|
+
attacks: [
|
|
74
|
+
{
|
|
75
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
76
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
77
|
+
range: 'WeaponRange.ranged',
|
|
78
|
+
requiresSetup: false,
|
|
79
|
+
unparryable: true,
|
|
80
|
+
lowersQuantity: true,
|
|
81
|
+
projectileType: 'ProjectileType.arrow',
|
|
82
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
87
|
`;
|
|
88
|
-
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
89
|
-
type: 'bow',
|
|
90
|
-
material: 'WoodenItemMaterial',
|
|
91
|
-
maxQuantity: 10,
|
|
92
|
-
mainHand: undefined,
|
|
93
|
-
offHand: undefined,
|
|
94
|
-
bothHands: {
|
|
95
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
96
|
-
parryDice: undefined,
|
|
97
|
-
attacks: [
|
|
98
|
-
{
|
|
99
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
100
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
101
|
-
range: WeaponRange,
|
|
102
|
-
requiresSetup: false,
|
|
103
|
-
unparryable: true,
|
|
104
|
-
lowersQuantity: true,
|
|
105
|
-
projectileType: 'ProjectileType.arrow',
|
|
106
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
};
|
|
88
|
+
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
89
|
+
type: 'bow',
|
|
90
|
+
material: 'WoodenItemMaterial',
|
|
91
|
+
maxQuantity: 10,
|
|
92
|
+
mainHand: undefined,
|
|
93
|
+
offHand: undefined,
|
|
94
|
+
bothHands: {
|
|
95
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
96
|
+
parryDice: undefined,
|
|
97
|
+
attacks: [
|
|
98
|
+
{
|
|
99
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
100
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
101
|
+
range: WeaponRange,
|
|
102
|
+
requiresSetup: false,
|
|
103
|
+
unparryable: true,
|
|
104
|
+
lowersQuantity: true,
|
|
105
|
+
projectileType: 'ProjectileType.arrow',
|
|
106
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
111
|
`;
|
|
112
112
|
(0, vitest_1.describe)('File Content Generator: Const Output', () => {
|
|
113
113
|
(0, vitest_1.test)('should handle no type', async () => {
|
|
@@ -19,12 +19,12 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
19
19
|
(0, vitest_1.expect)(result.errorLogs).toStrictEqual([]);
|
|
20
20
|
});
|
|
21
21
|
(0, vitest_1.test)('should handle files without definitions', () => {
|
|
22
|
-
let content = `
|
|
23
|
-
Explanation
|
|
24
|
-
|
|
25
|
-
### ASSET
|
|
26
|
-
Name: singular name
|
|
27
|
-
Path: path to file
|
|
22
|
+
let content = `
|
|
23
|
+
Explanation
|
|
24
|
+
|
|
25
|
+
### ASSET
|
|
26
|
+
Name: singular name
|
|
27
|
+
Path: path to file
|
|
28
28
|
`;
|
|
29
29
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
30
30
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -32,11 +32,11 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
32
32
|
(0, vitest_1.expect)(result.errorLogs).toStrictEqual([]);
|
|
33
33
|
});
|
|
34
34
|
(0, vitest_1.test)('should select definitions', () => {
|
|
35
|
-
let content = `
|
|
36
|
-
# DEFINITIONS
|
|
37
|
-
### ASSET
|
|
38
|
-
Name: test
|
|
39
|
-
Path: test.png
|
|
35
|
+
let content = `
|
|
36
|
+
# DEFINITIONS
|
|
37
|
+
### ASSET
|
|
38
|
+
Name: test
|
|
39
|
+
Path: test.png
|
|
40
40
|
`;
|
|
41
41
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
42
42
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -50,12 +50,12 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
50
50
|
(0, vitest_1.expect)(result.errorLogs).toStrictEqual([]);
|
|
51
51
|
});
|
|
52
52
|
(0, vitest_1.test)('should ignore comments', () => {
|
|
53
|
-
let content = `
|
|
54
|
-
# DEFINITIONS
|
|
55
|
-
### ASSET
|
|
56
|
-
Name: test // comment
|
|
57
|
-
Path: test.png // comment
|
|
58
|
-
// ----comment----\r
|
|
53
|
+
let content = `
|
|
54
|
+
# DEFINITIONS
|
|
55
|
+
### ASSET
|
|
56
|
+
Name: test // comment
|
|
57
|
+
Path: test.png // comment
|
|
58
|
+
// ----comment----\r
|
|
59
59
|
`;
|
|
60
60
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
61
61
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -69,9 +69,9 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
69
69
|
(0, vitest_1.expect)(result.errorLogs).toStrictEqual([]);
|
|
70
70
|
});
|
|
71
71
|
(0, vitest_1.test)('should not allow empty definitions', () => {
|
|
72
|
-
let content = `
|
|
73
|
-
# DEFINITIONS
|
|
74
|
-
### ASSET
|
|
72
|
+
let content = `
|
|
73
|
+
# DEFINITIONS
|
|
74
|
+
### ASSET
|
|
75
75
|
`;
|
|
76
76
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
77
77
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -84,14 +84,14 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
84
84
|
]);
|
|
85
85
|
});
|
|
86
86
|
(0, vitest_1.test)('should not allow unknown definition header after the first valid definition', () => {
|
|
87
|
-
let content = `
|
|
88
|
-
# DEFINITIONS
|
|
89
|
-
### ASSET
|
|
90
|
-
Name: test
|
|
91
|
-
Path: test.png
|
|
92
|
-
|
|
93
|
-
### Some text
|
|
94
|
-
some text
|
|
87
|
+
let content = `
|
|
88
|
+
# DEFINITIONS
|
|
89
|
+
### ASSET
|
|
90
|
+
Name: test
|
|
91
|
+
Path: test.png
|
|
92
|
+
|
|
93
|
+
### Some text
|
|
94
|
+
some text
|
|
95
95
|
`;
|
|
96
96
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
97
97
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -103,18 +103,18 @@ definition_store_1.DefinitionStore['definitionsMap'].set(custom_validator_helper
|
|
|
103
103
|
]);
|
|
104
104
|
});
|
|
105
105
|
(0, vitest_1.test)('invalid definitions should not corrupt other definitions', () => {
|
|
106
|
-
let content = `
|
|
107
|
-
# DEFINITIONS
|
|
108
|
-
### ASSET
|
|
109
|
-
Name: test
|
|
110
|
-
Path: test.png
|
|
111
|
-
|
|
112
|
-
### Some text
|
|
113
|
-
some text
|
|
114
|
-
|
|
115
|
-
### ASSET
|
|
116
|
-
Name: test2
|
|
117
|
-
Path: test2.png
|
|
106
|
+
let content = `
|
|
107
|
+
# DEFINITIONS
|
|
108
|
+
### ASSET
|
|
109
|
+
Name: test
|
|
110
|
+
Path: test.png
|
|
111
|
+
|
|
112
|
+
### Some text
|
|
113
|
+
some text
|
|
114
|
+
|
|
115
|
+
### ASSET
|
|
116
|
+
Name: test2
|
|
117
|
+
Path: test2.png
|
|
118
118
|
`;
|
|
119
119
|
let fileInfo = (0, mocks_1.getMockFileInfo)(content);
|
|
120
120
|
let result = selectDefinitionsHelper.process(fileInfo);
|
|
@@ -17,10 +17,10 @@ const helpers_lib_1 = require("helpers-lib");
|
|
|
17
17
|
const joi_1 = __importDefault(require("joi"));
|
|
18
18
|
const definition_component_1 = require("../../decorators/definition-component");
|
|
19
19
|
const index_file_generator_1 = require("../../framework/file-generators/index-file-generator");
|
|
20
|
-
const INDEX_ENTRY = `
|
|
21
|
-
export interface FontDefinition {
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly fontFamily: string;
|
|
20
|
+
const INDEX_ENTRY = `
|
|
21
|
+
export interface FontDefinition {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly fontFamily: string;
|
|
24
24
|
}`;
|
|
25
25
|
let FontComponent = class FontComponent extends definition_component_1.DefinitionComponent {
|
|
26
26
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "definition-generator-framework",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Definition Generator Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,16 +20,10 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/sefabaser/definition-generator-framework/issues"
|
|
22
22
|
},
|
|
23
|
-
"prettier": {
|
|
24
|
-
"trailingComma": "none",
|
|
25
|
-
"tabWidth": 2,
|
|
26
|
-
"printWidth": 130,
|
|
27
|
-
"singleQuote": true,
|
|
28
|
-
"arrowParens": "avoid"
|
|
29
|
-
},
|
|
30
23
|
"homepage": "https://github.com/sefabaser/definition-generator-framework#readme",
|
|
31
24
|
"scripts": {
|
|
32
|
-
"clean-install": "cls && rm -rf node_modules && rm -rf package-lock.json && npm
|
|
25
|
+
"clean-install": "cls && rm -rf node_modules && rm -rf package-lock.json && npm run i",
|
|
26
|
+
"i": "npm cache clean --force && npm install",
|
|
33
27
|
"pretest": "cls",
|
|
34
28
|
"test": "vitest",
|
|
35
29
|
"start": "npm run build && node dist",
|
|
@@ -40,14 +34,17 @@
|
|
|
40
34
|
"postpack": "mv package.json.bak package.json"
|
|
41
35
|
},
|
|
42
36
|
"dependencies": {
|
|
43
|
-
"helpers-lib": "1.13.10",
|
|
44
37
|
"image-size": "1.1.1",
|
|
45
|
-
"joi": "17.11.0",
|
|
46
38
|
"prettier": "3.3.3",
|
|
47
39
|
"jsonpath-plus": "8.1.0",
|
|
48
40
|
"script-engine-lib": "0.4.3",
|
|
49
41
|
"glob": "10.3.14"
|
|
50
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"helpers-lib": "^1.13.10",
|
|
45
|
+
"joi": "^17.11.0",
|
|
46
|
+
"script-engine-lib": "^0.4.3"
|
|
47
|
+
},
|
|
51
48
|
"devDependencies": {
|
|
52
49
|
"@biomejs/biome": "2.2.4",
|
|
53
50
|
"@types/glob": "8.1.0",
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
"@types/rimraf": "4.0.5",
|
|
56
53
|
"ts-node": "10.9.2",
|
|
57
54
|
"typescript": "5.3.3",
|
|
58
|
-
"vitest": "
|
|
55
|
+
"vitest": "3.2.4"
|
|
59
56
|
},
|
|
60
57
|
"types": "dist/index.d.ts"
|
|
61
58
|
}
|