definition-generator-framework 1.12.4 → 1.12.6
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/framework/definition-component.d.ts +11 -9
- package/dist/framework/definition-component.js +18 -18
- package/dist/framework/definition-generator.d.ts +6 -5
- package/dist/framework/definition-generator.js +16 -18
- package/dist/framework/file-content-generator/file-content-generator.js +1 -1
- package/dist/framework/file-content-generator/file-content-generator.test.js +49 -49
- package/dist/framework/framework.d.ts +14 -13
- package/dist/framework/framework.data.d.ts +3 -3
- package/dist/framework/framework.data.js +13 -7
- package/dist/framework/framework.js +36 -33
- package/dist/framework/framework.model.d.ts +15 -15
- package/dist/framework/framework.model.js +3 -3
- package/dist/helpers/common-functions/common-functions.js +1 -1
- package/dist/helpers/common-functions/common-functions.spec.d.ts +1 -0
- package/dist/helpers/common-functions/common-functions.spec.js +50 -0
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.d.ts +1 -0
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +54 -0
- package/dist/helpers/output-helper/output-helper.d.ts +26 -26
- package/dist/helpers/output-helper/output-helper.js +127 -107
- package/dist/helpers/output-helper/output-helper.spec.d.ts +24 -0
- package/dist/helpers/output-helper/output-helper.spec.js +261 -0
- package/dist/helpers/output-helper/output-helper.test.d.ts +22 -22
- package/dist/helpers/output-helper/output-helper.test.js +224 -212
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.d.ts +1 -0
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +143 -0
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +1 -0
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +191 -0
- package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +6 -6
- package/dist/helpers/validator/custom-validators/image.custom-validator.js +40 -39
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +4 -4
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +29 -29
- package/dist/helpers/validator/joi-custom-validators.spec.d.ts +1 -0
- package/dist/helpers/validator/joi-custom-validators.spec.js +304 -0
- package/dist/helpers/validator/validator.spec.d.ts +1 -0
- package/dist/helpers/validator/validator.spec.js +332 -0
- package/dist/pipeline/1-select-definitions-helper.d.ts +13 -13
- package/dist/pipeline/1-select-definitions-helper.js +68 -72
- package/dist/pipeline/1-select-definitions.helper.test.js +40 -40
- package/dist/pipeline/1-select-definitions.spec.d.ts +1 -0
- package/dist/pipeline/1-select-definitions.spec.js +140 -0
- package/dist/pipeline/2-structure-parser.helper.spec.d.ts +1 -0
- package/dist/pipeline/2-structure-parser.helper.spec.js +280 -0
- package/dist/pipeline/parsers/array-parser.spec.d.ts +1 -0
- package/dist/pipeline/parsers/array-parser.spec.js +128 -0
- package/dist/pipeline/parsers/object-parser.spec.d.ts +1 -0
- package/dist/pipeline/parsers/object-parser.spec.js +179 -0
- package/dist/pipeline/parsers/primitive-parser.spec.d.ts +1 -0
- package/dist/pipeline/parsers/primitive-parser.spec.js +79 -0
- package/dist/pre-made-components/assets/3-font.js +4 -4
- package/dist/pre-made-components/events/1-event.d.ts +1 -1
- package/dist/pre-made-components/events/1-event.js +157 -125
- package/dist/pre-made-components/events/2-event-test.d.ts +8 -8
- package/dist/pre-made-components/events/2-event-test.js +156 -119
- package/dist/pre-made-components/events/2-script-test.js +0 -1
- package/dist/pre-made-components/events/event-setup.d.ts +10 -5
- package/dist/pre-made-components/events/event-setup.js +15 -15
- package/dist/pre-made-components/events/script-setup.d.ts +5 -3
- package/dist/pre-made-components/events/script-setup.js +11 -11
- package/package.json +11 -11
- package/.eslintrc.js +0 -212
- package/.vscode/launch.json +0 -15
- package/.vscode/settings.json +0 -25
- package/coverage/clover.xml +0 -503
- package/coverage/coverage-final.json +0 -16
- package/coverage/lcov-report/_mocks/index.html +0 -116
- package/coverage/lcov-report/_mocks/mocks.ts.html +0 -223
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/framework/framework.data.ts.html +0 -109
- package/coverage/lcov-report/framework/index.html +0 -116
- package/coverage/lcov-report/helpers/common-functions/common-functions.ts.html +0 -178
- package/coverage/lcov-report/helpers/common-functions/index.html +0 -116
- package/coverage/lcov-report/helpers/duplicate-helper/duplicate-helper.ts.html +0 -196
- package/coverage/lcov-report/helpers/duplicate-helper/index.html +0 -116
- package/coverage/lcov-report/helpers/output-helper/index.html +0 -116
- package/coverage/lcov-report/helpers/output-helper/output-helper.ts.html +0 -277
- package/coverage/lcov-report/helpers/raw-definition-helper/index.html +0 -116
- package/coverage/lcov-report/helpers/raw-definition-helper/raw-definition.helper.ts.html +0 -256
- package/coverage/lcov-report/helpers/validator/index.html +0 -131
- package/coverage/lcov-report/helpers/validator/joi-custom-validators.ts.html +0 -643
- package/coverage/lcov-report/helpers/validator/validator.ts.html +0 -310
- package/coverage/lcov-report/index.html +0 -251
- package/coverage/lcov-report/pipeline/1-select-definitions-helper.ts.html +0 -358
- package/coverage/lcov-report/pipeline/2-structure-parser.helper.ts.html +0 -301
- package/coverage/lcov-report/pipeline/3-config.ts.html +0 -178
- package/coverage/lcov-report/pipeline/_mocks/index.html +0 -116
- package/coverage/lcov-report/pipeline/_mocks/index.ts.html +0 -229
- package/coverage/lcov-report/pipeline/index.html +0 -146
- package/coverage/lcov-report/pipeline/parsers/array-parser.ts.html +0 -271
- package/coverage/lcov-report/pipeline/parsers/index.html +0 -146
- package/coverage/lcov-report/pipeline/parsers/object-parser.ts.html +0 -439
- package/coverage/lcov-report/pipeline/parsers/primitive-parser.ts.html +0 -370
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -911
- package/dist/_mocks/mocks.js.map +0 -1
- package/dist/decorators/definition-component.js.map +0 -1
- package/dist/decorators/definition-generator.js.map +0 -1
- package/dist/framework/context.js.map +0 -1
- package/dist/framework/definition-component.js.map +0 -1
- package/dist/framework/definition-generator.js.map +0 -1
- package/dist/framework/definition-store.js.map +0 -1
- package/dist/framework/file-content-generator/file-content-generator.js.map +0 -1
- package/dist/framework/file-content-generator/file-content-generator.test.js.map +0 -1
- package/dist/framework/framework.data.js.map +0 -1
- package/dist/framework/framework.js.map +0 -1
- package/dist/framework/framework.model.js.map +0 -1
- package/dist/framework/index-file-generator/index-file-generator.js.map +0 -1
- package/dist/framework/interfaces.js.map +0 -1
- package/dist/framework/kernel.js.map +0 -1
- package/dist/helpers/common-functions/common-functions.js.map +0 -1
- package/dist/helpers/common-functions/common-functions.spec.js.map +0 -1
- package/dist/helpers/common-functions/common-functions.test.js.map +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.js.map +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js.map +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.test.js.map +0 -1
- package/dist/helpers/output-helper/output-helper.js.map +0 -1
- package/dist/helpers/output-helper/output-helper.spec.js.map +0 -1
- package/dist/helpers/output-helper/output-helper.test.js.map +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.js.map +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js.map +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.test.js.map +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.js.map +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js.map +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.js.map +0 -1
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.js.map +0 -1
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.js.map +0 -1
- package/dist/helpers/validator/custom-validators/image.custom-validator.js.map +0 -1
- package/dist/helpers/validator/custom-validators/path.custom-validator.js.map +0 -1
- package/dist/helpers/validator/custom-validators/position-on-sprite.js.map +0 -1
- package/dist/helpers/validator/custom-validators/reference.custom-validator.js.map +0 -1
- package/dist/helpers/validator/custom-validators/sprite.custom-validator.js.map +0 -1
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js.map +0 -1
- package/dist/helpers/validator/custom-validators/unique.custom-validator.js.map +0 -1
- package/dist/helpers/validator/joi-custom-validators.js.map +0 -1
- package/dist/helpers/validator/joi-custom-validators.spec.js.map +0 -1
- package/dist/helpers/validator/validator.js.map +0 -1
- package/dist/helpers/validator/validator.spec.js.map +0 -1
- package/dist/helpers/validator/validator.test.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pipeline/1-select-definitions-helper.js.map +0 -1
- package/dist/pipeline/1-select-definitions.helper.js.map +0 -1
- package/dist/pipeline/1-select-definitions.helper.test.js.map +0 -1
- package/dist/pipeline/1-select-definitions.spec.js.map +0 -1
- package/dist/pipeline/2-structure-parser.helper.js.map +0 -1
- package/dist/pipeline/2-structure-parser.helper.spec.js.map +0 -1
- package/dist/pipeline/2-structure-parser.helper.test.js.map +0 -1
- package/dist/pipeline/3-config.js.map +0 -1
- package/dist/pipeline/_mocks/index.js.map +0 -1
- package/dist/pipeline/parsers/array-parser.js.map +0 -1
- package/dist/pipeline/parsers/array-parser.spec.js.map +0 -1
- package/dist/pipeline/parsers/array-parser.test.js.map +0 -1
- package/dist/pipeline/parsers/object-parser.js.map +0 -1
- package/dist/pipeline/parsers/object-parser.spec.js.map +0 -1
- package/dist/pipeline/parsers/object-parser.test.js.map +0 -1
- package/dist/pipeline/parsers/primitive-parser.js.map +0 -1
- package/dist/pipeline/parsers/primitive-parser.spec.js.map +0 -1
- package/dist/pipeline/parsers/primitive-parser.test.js.map +0 -1
- package/dist/pipeline/raw-data-parser.js.map +0 -1
- package/dist/pre-made-components/_validators/shape-validators.js.map +0 -1
- package/dist/pre-made-components/_validators/sprite-validators.js.map +0 -1
- package/dist/pre-made-components/assets/1-sprite.js.map +0 -1
- package/dist/pre-made-components/assets/2-sprite-group.js.map +0 -1
- package/dist/pre-made-components/assets/3-font.js.map +0 -1
- package/dist/pre-made-components/events/1-event.js.map +0 -1
- package/dist/pre-made-components/events/1-script.js.map +0 -1
- package/dist/pre-made-components/events/2-event-test.js.map +0 -1
- package/dist/pre-made-components/events/2-script-test.js.map +0 -1
- package/dist/pre-made-components/events/3-event.js.map +0 -1
- package/dist/pre-made-components/events/4-event-test.js.map +0 -1
- package/dist/pre-made-components/events/event-setup.js.map +0 -1
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js.map +0 -1
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js.map +0 -1
- package/dist/pre-made-components/events/helpers/script-testing.helper.js.map +0 -1
- package/dist/pre-made-components/events/script-setup.js.map +0 -1
- package/dist/pre-made-components/events/scripting-setup.js.map +0 -1
- package/dist/pre-made-components/events/validators.js.map +0 -1
- package/dist/setup.js.map +0 -1
- package/package.json.bak +0 -60
- package/scripts/prepare-package-json.ts +0 -23
- package/tsconfig.json +0 -24
- package/vitest.config.ts +0 -1
|
@@ -1,250 +1,262 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.Const = void 0;
|
|
4
|
-
const vitest_1 = require(
|
|
5
|
-
const mocks_1 = require(
|
|
6
|
-
const context_1 = require(
|
|
7
|
-
const output_helper_1 = require(
|
|
4
|
+
const vitest_1 = require('vitest');
|
|
5
|
+
const mocks_1 = require('../../_mocks/mocks');
|
|
6
|
+
const context_1 = require('../../framework/context');
|
|
7
|
+
const output_helper_1 = require('./output-helper');
|
|
8
8
|
let complexObject = {
|
|
9
|
+
type: 'bow',
|
|
10
|
+
material: 'WoodenItemMaterial',
|
|
11
|
+
maxQuantity: 10,
|
|
12
|
+
mainHand: undefined,
|
|
13
|
+
offHand: undefined,
|
|
14
|
+
bothHands: {
|
|
15
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
16
|
+
parryDice: undefined,
|
|
17
|
+
attacks: [
|
|
18
|
+
{
|
|
19
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
20
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
21
|
+
range: 'WeaponRange.ranged',
|
|
22
|
+
requiresSetup: false,
|
|
23
|
+
unparryable: true,
|
|
24
|
+
lowersQuantity: true,
|
|
25
|
+
projectileType: 'ProjectileType.arrow',
|
|
26
|
+
sounds: {
|
|
27
|
+
hit: 'AssetGroups.battleSoundArrowHit',
|
|
28
|
+
pre: 'AssetGroups.battleSoundArrowShot'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
let emptyArrayExpected = `export const Groups: any[] = [];
|
|
35
|
+
`;
|
|
36
|
+
let basicArrayExpected = `export const Groups: any[] = [
|
|
37
|
+
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
38
|
+
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
39
|
+
];
|
|
40
|
+
`;
|
|
41
|
+
let complexArrayExpected = `export const Groups: any[] = [
|
|
42
|
+
{
|
|
9
43
|
type: 'bow',
|
|
10
44
|
material: 'WoodenItemMaterial',
|
|
11
45
|
maxQuantity: 10,
|
|
12
46
|
mainHand: undefined,
|
|
13
47
|
offHand: undefined,
|
|
14
48
|
bothHands: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
49
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
50
|
+
parryDice: undefined,
|
|
51
|
+
attacks: [
|
|
52
|
+
{
|
|
53
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
54
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
55
|
+
range: 'WeaponRange.ranged',
|
|
56
|
+
requiresSetup: false,
|
|
57
|
+
unparryable: true,
|
|
58
|
+
lowersQuantity: true,
|
|
59
|
+
projectileType: 'ProjectileType.arrow',
|
|
60
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
61
|
+
}
|
|
62
|
+
]
|
|
32
63
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
`;
|
|
36
|
-
let basicArrayExpected = `export const Groups: any[] = [
|
|
37
|
-
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
38
|
-
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
39
|
-
];
|
|
40
|
-
`;
|
|
41
|
-
let complexArrayExpected = `export const Groups: any[] = [
|
|
42
|
-
{
|
|
43
|
-
type: 'bow',
|
|
44
|
-
material: 'WoodenItemMaterial',
|
|
45
|
-
maxQuantity: 10,
|
|
46
|
-
mainHand: undefined,
|
|
47
|
-
offHand: undefined,
|
|
48
|
-
bothHands: {
|
|
49
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
50
|
-
parryDice: undefined,
|
|
51
|
-
attacks: [
|
|
52
|
-
{
|
|
53
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
54
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
55
|
-
range: 'WeaponRange.ranged',
|
|
56
|
-
requiresSetup: false,
|
|
57
|
-
unparryable: true,
|
|
58
|
-
lowersQuantity: true,
|
|
59
|
-
projectileType: 'ProjectileType.arrow',
|
|
60
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
`;
|
|
67
|
-
let complexArrayReplaceExpected = `export const Groups: any[] = [
|
|
68
|
-
{
|
|
69
|
-
type: 'bow',
|
|
70
|
-
material: 'WoodenItemMaterial',
|
|
71
|
-
maxQuantity: 10,
|
|
72
|
-
mainHand: undefined,
|
|
73
|
-
offHand: undefined,
|
|
74
|
-
bothHands: {
|
|
75
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
76
|
-
parryDice: undefined,
|
|
77
|
-
attacks: [
|
|
78
|
-
{
|
|
79
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
80
|
-
attackDices: [DiceType.d6, DiceType.d6],
|
|
81
|
-
range: 'WeaponRange.ranged',
|
|
82
|
-
requiresSetup: false,
|
|
83
|
-
unparryable: true,
|
|
84
|
-
lowersQuantity: true,
|
|
85
|
-
projectileType: 'ProjectileType.arrow',
|
|
86
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
];
|
|
64
|
+
}
|
|
65
|
+
];
|
|
92
66
|
`;
|
|
93
|
-
|
|
67
|
+
let complexArrayReplaceExpected = `export const Groups: any[] = [
|
|
68
|
+
{
|
|
94
69
|
type: 'bow',
|
|
95
70
|
material: 'WoodenItemMaterial',
|
|
96
71
|
maxQuantity: 10,
|
|
97
72
|
mainHand: undefined,
|
|
98
73
|
offHand: undefined,
|
|
99
74
|
bothHands: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
]
|
|
75
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
76
|
+
parryDice: undefined,
|
|
77
|
+
attacks: [
|
|
78
|
+
{
|
|
79
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
80
|
+
attackDices: [DiceType.d6, DiceType.d6],
|
|
81
|
+
range: 'WeaponRange.ranged',
|
|
82
|
+
requiresSetup: false,
|
|
83
|
+
unparryable: true,
|
|
84
|
+
lowersQuantity: true,
|
|
85
|
+
projectileType: 'ProjectileType.arrow',
|
|
86
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
87
|
+
}
|
|
88
|
+
]
|
|
117
89
|
}
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
`;
|
|
93
|
+
exports.Const = {
|
|
94
|
+
type: 'bow',
|
|
95
|
+
material: 'WoodenItemMaterial',
|
|
96
|
+
maxQuantity: 10,
|
|
97
|
+
mainHand: undefined,
|
|
98
|
+
offHand: undefined,
|
|
99
|
+
bothHands: {
|
|
100
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
101
|
+
parryDice: undefined,
|
|
102
|
+
attacks: [
|
|
103
|
+
{
|
|
104
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
105
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
106
|
+
range: 'WeaponRange.ranged',
|
|
107
|
+
requiresSetup: false,
|
|
108
|
+
unparryable: true,
|
|
109
|
+
lowersQuantity: true,
|
|
110
|
+
projectileType: 'ProjectileType.arrow',
|
|
111
|
+
sounds: {
|
|
112
|
+
hit: 'AssetGroups.battleSoundArrowHit',
|
|
113
|
+
pre: 'AssetGroups.battleSoundArrowShot'
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
118
|
};
|
|
119
|
-
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
119
|
+
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
120
120
|
`;
|
|
121
|
-
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
121
|
+
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
122
122
|
`;
|
|
123
|
-
let complexConstExpected = `export const ConstSample: any = {
|
|
124
|
-
type: 'bow',
|
|
125
|
-
material: 'WoodenItemMaterial',
|
|
126
|
-
maxQuantity: 10,
|
|
127
|
-
mainHand: undefined,
|
|
128
|
-
offHand: undefined,
|
|
129
|
-
bothHands: {
|
|
130
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
131
|
-
parryDice: undefined,
|
|
132
|
-
attacks: [
|
|
133
|
-
{
|
|
134
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
135
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
136
|
-
range: 'WeaponRange.ranged',
|
|
137
|
-
requiresSetup: false,
|
|
138
|
-
unparryable: true,
|
|
139
|
-
lowersQuantity: true,
|
|
140
|
-
projectileType: 'ProjectileType.arrow',
|
|
141
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
};
|
|
123
|
+
let complexConstExpected = `export const ConstSample: any = {
|
|
124
|
+
type: 'bow',
|
|
125
|
+
material: 'WoodenItemMaterial',
|
|
126
|
+
maxQuantity: 10,
|
|
127
|
+
mainHand: undefined,
|
|
128
|
+
offHand: undefined,
|
|
129
|
+
bothHands: {
|
|
130
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
131
|
+
parryDice: undefined,
|
|
132
|
+
attacks: [
|
|
133
|
+
{
|
|
134
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
135
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
136
|
+
range: 'WeaponRange.ranged',
|
|
137
|
+
requiresSetup: false,
|
|
138
|
+
unparryable: true,
|
|
139
|
+
lowersQuantity: true,
|
|
140
|
+
projectileType: 'ProjectileType.arrow',
|
|
141
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
146
|
`;
|
|
147
|
-
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
148
|
-
type: 'bow',
|
|
149
|
-
material: 'WoodenItemMaterial',
|
|
150
|
-
maxQuantity: 10,
|
|
151
|
-
mainHand: undefined,
|
|
152
|
-
offHand: undefined,
|
|
153
|
-
bothHands: {
|
|
154
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
155
|
-
parryDice: undefined,
|
|
156
|
-
attacks: [
|
|
157
|
-
{
|
|
158
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
159
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
160
|
-
range: WeaponRange,
|
|
161
|
-
requiresSetup: false,
|
|
162
|
-
unparryable: true,
|
|
163
|
-
lowersQuantity: true,
|
|
164
|
-
projectileType: 'ProjectileType.arrow',
|
|
165
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
};
|
|
147
|
+
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
148
|
+
type: 'bow',
|
|
149
|
+
material: 'WoodenItemMaterial',
|
|
150
|
+
maxQuantity: 10,
|
|
151
|
+
mainHand: undefined,
|
|
152
|
+
offHand: undefined,
|
|
153
|
+
bothHands: {
|
|
154
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
155
|
+
parryDice: undefined,
|
|
156
|
+
attacks: [
|
|
157
|
+
{
|
|
158
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
159
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
160
|
+
range: WeaponRange,
|
|
161
|
+
requiresSetup: false,
|
|
162
|
+
unparryable: true,
|
|
163
|
+
lowersQuantity: true,
|
|
164
|
+
projectileType: 'ProjectileType.arrow',
|
|
165
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
170
|
`;
|
|
171
171
|
(0, vitest_1.describe)('Output Helper: Array Output', () => {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
(0, vitest_1.test)('should handle empty array', async () => {
|
|
173
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
174
|
+
variableName: 'Groups',
|
|
175
|
+
variableType: 'any[]',
|
|
176
|
+
variable: []
|
|
175
177
|
});
|
|
176
|
-
(0, vitest_1.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
178
|
+
(0, vitest_1.expect)(output).toStrictEqual(emptyArrayExpected);
|
|
179
|
+
});
|
|
180
|
+
(0, vitest_1.test)('should handle basic array', async () => {
|
|
181
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
182
|
+
variableName: 'Groups',
|
|
183
|
+
variableType: 'any[]',
|
|
184
|
+
variable: [
|
|
185
|
+
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
186
|
+
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
187
|
+
]
|
|
186
188
|
});
|
|
187
|
-
(0, vitest_1.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
(0, vitest_1.expect)(output).toStrictEqual(basicArrayExpected);
|
|
190
|
+
});
|
|
191
|
+
(0, vitest_1.test)('should handle complex array', async () => {
|
|
192
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
193
|
+
variableName: 'Groups',
|
|
194
|
+
variableType: 'any[]',
|
|
195
|
+
variable: [complexObject]
|
|
194
196
|
});
|
|
195
|
-
(0, vitest_1.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
(0, vitest_1.expect)(output).toStrictEqual(complexArrayExpected);
|
|
198
|
+
});
|
|
199
|
+
(0, vitest_1.test)('should handle replacing complex array', async () => {
|
|
200
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
201
|
+
variableName: 'Groups',
|
|
202
|
+
variableType: 'any[]',
|
|
203
|
+
variable: [complexObject],
|
|
204
|
+
replaceMap: [{ target: `"DiceType.d6"`, replace: 'DiceType.d6' }]
|
|
203
205
|
});
|
|
206
|
+
(0, vitest_1.expect)(output).toStrictEqual(complexArrayReplaceExpected);
|
|
207
|
+
});
|
|
204
208
|
});
|
|
205
209
|
(0, vitest_1.describe)('Output Helper: Const Output', () => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
(0, vitest_1.test)('should handle no type', async () => {
|
|
211
|
+
let output = await output_helper_1.OutputHelper.generateOutput({ variableName: 'ConstSample', variable: { type: 'item' } });
|
|
212
|
+
(0, vitest_1.expect)(output).toStrictEqual(noTypeExpected);
|
|
213
|
+
});
|
|
214
|
+
(0, vitest_1.test)('should handle basic value', async () => {
|
|
215
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
216
|
+
variableName: 'ConstSample',
|
|
217
|
+
variableType: 'string',
|
|
218
|
+
variable: 'basic'
|
|
213
219
|
});
|
|
214
|
-
(0, vitest_1.
|
|
215
|
-
|
|
216
|
-
|
|
220
|
+
(0, vitest_1.expect)(output).toStrictEqual(basicConstExpected);
|
|
221
|
+
});
|
|
222
|
+
(0, vitest_1.test)('should handle complex object', async () => {
|
|
223
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
224
|
+
variableName: 'ConstSample',
|
|
225
|
+
variableType: 'any',
|
|
226
|
+
variable: complexObject
|
|
217
227
|
});
|
|
218
|
-
(0, vitest_1.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
(0, vitest_1.expect)(output).toStrictEqual(complexConstExpected);
|
|
229
|
+
});
|
|
230
|
+
(0, vitest_1.test)('should handle replacing complex object', async () => {
|
|
231
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
232
|
+
variableName: 'ConstSample',
|
|
233
|
+
variableType: 'any',
|
|
234
|
+
variable: complexObject,
|
|
235
|
+
replaceMap: [{ target: `"WeaponRange.ranged"`, replace: 'WeaponRange' }]
|
|
226
236
|
});
|
|
237
|
+
(0, vitest_1.expect)(output).toStrictEqual(complexConstReplaceExpected);
|
|
238
|
+
});
|
|
227
239
|
});
|
|
228
240
|
(0, vitest_1.describe)('Output Helper: stringify', () => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
});
|
|
235
|
-
(0, vitest_1.expect)(output).toStrictEqual('{"a":undefined,"b":undefined}');
|
|
241
|
+
(0, vitest_1.test)('should not lose properties with undefined or null value', async () => {
|
|
242
|
+
let output = await output_helper_1.OutputHelper['stringify']({
|
|
243
|
+
a: undefined,
|
|
244
|
+
// eslint-disable-next-line no-null/no-null
|
|
245
|
+
b: null
|
|
236
246
|
});
|
|
247
|
+
(0, vitest_1.expect)(output).toStrictEqual('{"a":undefined,"b":undefined}');
|
|
248
|
+
});
|
|
237
249
|
});
|
|
238
250
|
(0, vitest_1.describe)('Output Helper: convertToRelativePath', () => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
251
|
+
(0, vitest_1.test)('should convert to relative path', async () => {
|
|
252
|
+
(0, mocks_1.resetContext)();
|
|
253
|
+
context_1.Context.outputPath = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/src/.asset-build';
|
|
254
|
+
context_1.Context.config.projectRoot = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/';
|
|
255
|
+
let original = '.src/definitions-sample/images/nested/test2.png';
|
|
256
|
+
let desired = '../../../definitions-sample/images/nested/test2.png';
|
|
257
|
+
let filePath = '/0-global-definitions/assets/images.ts';
|
|
258
|
+
let output = output_helper_1.OutputHelper['convertToRelativePath'](filePath, original);
|
|
259
|
+
(0, vitest_1.expect)(output).toStrictEqual(desired);
|
|
260
|
+
});
|
|
249
261
|
});
|
|
250
|
-
//# sourceMappingURL=output-helper.test.js.map
|
|
262
|
+
//# sourceMappingURL=output-helper.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const mocks_1 = require('../../_mocks/mocks');
|
|
4
|
+
const raw_definition_helper_1 = require('./raw-definition.helper');
|
|
5
|
+
const ComponentName = 'ASSET';
|
|
6
|
+
describe('RAW DEFINITION HELPER', () => {
|
|
7
|
+
describe('Find Parsed Structure', () => {
|
|
8
|
+
test('nested definition', () => {
|
|
9
|
+
let rawDefinition = {
|
|
10
|
+
componentName: ComponentName,
|
|
11
|
+
location: mocks_1.SampleLocation1,
|
|
12
|
+
parsedStructure: {
|
|
13
|
+
line: mocks_1.SampleLocation1.line + 1,
|
|
14
|
+
rawData: {
|
|
15
|
+
obj1: {
|
|
16
|
+
line: mocks_1.SampleLocation1.line + 2,
|
|
17
|
+
rawData: [
|
|
18
|
+
{
|
|
19
|
+
line: mocks_1.SampleLocation1.line + 3,
|
|
20
|
+
rawData: {
|
|
21
|
+
obj2: {
|
|
22
|
+
line: mocks_1.SampleLocation1.line + 4,
|
|
23
|
+
rawData: 'test data'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, [])).toEqual(mocks_1.SampleLocation1.line + 1);
|
|
33
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, ['obj1'])).toEqual(
|
|
34
|
+
mocks_1.SampleLocation1.line + 2
|
|
35
|
+
);
|
|
36
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, ['obj1', 0])).toEqual(
|
|
37
|
+
mocks_1.SampleLocation1.line + 3
|
|
38
|
+
);
|
|
39
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, ['obj1', 0, 'obj2'])).toEqual(
|
|
40
|
+
mocks_1.SampleLocation1.line + 4
|
|
41
|
+
);
|
|
42
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, ['notExists'])).toEqual(
|
|
43
|
+
mocks_1.SampleLocation1.line + 1
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('Flattening', () => {
|
|
48
|
+
test('primitive', () => {
|
|
49
|
+
let rawDefinition = {
|
|
50
|
+
componentName: ComponentName,
|
|
51
|
+
location: mocks_1.SampleLocation1,
|
|
52
|
+
parsedStructure: {
|
|
53
|
+
line: 0,
|
|
54
|
+
rawData: 'test'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
let expected = 'test';
|
|
58
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.flatten(rawDefinition)).toStrictEqual(expected);
|
|
59
|
+
});
|
|
60
|
+
test('array', () => {
|
|
61
|
+
let rawDefinition = {
|
|
62
|
+
componentName: ComponentName,
|
|
63
|
+
location: mocks_1.SampleLocation1,
|
|
64
|
+
parsedStructure: {
|
|
65
|
+
line: 0,
|
|
66
|
+
rawData: [
|
|
67
|
+
{
|
|
68
|
+
line: 0,
|
|
69
|
+
rawData: [
|
|
70
|
+
{
|
|
71
|
+
line: 0,
|
|
72
|
+
rawData: 'orange'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
line: 0,
|
|
76
|
+
rawData: 'banana'
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
line: 0,
|
|
82
|
+
rawData: [
|
|
83
|
+
{
|
|
84
|
+
line: 0,
|
|
85
|
+
rawData: '1'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
line: 0,
|
|
89
|
+
rawData: '2'
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
let expected = [
|
|
97
|
+
['orange', 'banana'],
|
|
98
|
+
['1', '2']
|
|
99
|
+
];
|
|
100
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.flatten(rawDefinition)).toStrictEqual(expected);
|
|
101
|
+
});
|
|
102
|
+
test('object', () => {
|
|
103
|
+
let rawDefinition = {
|
|
104
|
+
componentName: ComponentName,
|
|
105
|
+
location: mocks_1.SampleLocation1,
|
|
106
|
+
parsedStructure: {
|
|
107
|
+
line: 0,
|
|
108
|
+
rawData: {
|
|
109
|
+
array1: {
|
|
110
|
+
line: 0,
|
|
111
|
+
rawData: [
|
|
112
|
+
{
|
|
113
|
+
line: 0,
|
|
114
|
+
rawData: 'apple'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
line: 0,
|
|
118
|
+
rawData: 'orange'
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
array2: {
|
|
123
|
+
line: 0,
|
|
124
|
+
rawData: [
|
|
125
|
+
{
|
|
126
|
+
line: 0,
|
|
127
|
+
rawData: 'xWing'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
line: 0,
|
|
131
|
+
rawData: 'tieFighter'
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
let expected = { array1: ['apple', 'orange'], array2: ['xWing', 'tieFighter'] };
|
|
139
|
+
expect(raw_definition_helper_1.RawDefinitionHelper.flatten(rawDefinition)).toStrictEqual(expected);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=raw-definition.helper.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AssetComponentName = 'ASSET';
|