definition-generator-framework 1.12.12 → 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.
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SingleDefinitionComponent = exports.DefinitionComponent = exports.DefinitionComponentDecorator = void 0;
4
+ function toPascalCase(input) {
5
+ return input
6
+ .replace(/[-_]/g, ' ')
7
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
8
+ .replace(/\s+/g, ' ')
9
+ .trim()
10
+ .toLowerCase()
11
+ .split(' ')
12
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
13
+ .join('');
14
+ }
4
15
  function DefinitionComponentDecorator(meta) {
5
16
  return function (ComponentClass) {
6
17
  if (meta.singleton) {
@@ -18,6 +29,7 @@ function DefinitionComponentDecorator(meta) {
18
29
  }
19
30
  ComponentClass.$meta = {
20
31
  componentName: meta.componentName,
32
+ pascalCaseComponentName: toPascalCase(meta.componentName),
21
33
  keyName: meta.keyName,
22
34
  singleton: meta.singleton,
23
35
  validationSchema: meta.validationSchema
@@ -21,7 +21,7 @@ class Context {
21
21
  this.output.push({
22
22
  path: request.path,
23
23
  content: await file_content_generator_1.FileContentGenerator.generate({
24
- preText: request.preText,
24
+ preText: helpers_lib_1.Comparator.isArray(request.preText) ? request.preText.join('\n') : request.preText,
25
25
  variableName: request.variableName,
26
26
  variableType: request.variableType,
27
27
  variable: request.variable,
@@ -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 () => {
@@ -0,0 +1,13 @@
1
+ export declare class IndexFileGenerator {
2
+ private static premadeInterfaces;
3
+ private static idTypes;
4
+ static addPremadeInterface(value: string): void;
5
+ static addIdType(constantName: string, keys: string[]): void;
6
+ static generateFile(pretext: string, outputIndexFile: string): Promise<void>;
7
+ private static createIndexFile;
8
+ private static generateFileDevMode;
9
+ private static generateExportsContent;
10
+ private static generateInterfacesContent;
11
+ private static getInterfacesFromFile;
12
+ static generateTypes(): string;
13
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.IndexFileGenerator = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const glob = __importStar(require("glob"));
29
+ const helpers_lib_1 = require("helpers-lib");
30
+ const context_1 = require("../context");
31
+ const file_content_generator_1 = require("../file-content-generator/file-content-generator");
32
+ const START_COMMAND = '// ---- INDEX OUTPUT ----';
33
+ const END_COMMAND = '// ---- END ----';
34
+ class IndexFileGenerator {
35
+ static { this.premadeInterfaces = []; }
36
+ static { this.idTypes = []; }
37
+ static addPremadeInterface(value) {
38
+ this.premadeInterfaces.push(value);
39
+ }
40
+ static addIdType(constantName, keys) {
41
+ let value = `export type ${constantName}ID = ${keys.map(key => `'${key}'`).join(' | ')};`;
42
+ this.idTypes.push(value);
43
+ }
44
+ static async generateFile(pretext, outputIndexFile) {
45
+ if (context_1.Context.config.compilerModulesPath) {
46
+ let content = await this.generateFileDevMode(pretext);
47
+ if (content) {
48
+ await this.createIndexFile(content);
49
+ }
50
+ }
51
+ else {
52
+ await this.createIndexFile(outputIndexFile);
53
+ }
54
+ }
55
+ static async createIndexFile(outputIndexFile) {
56
+ let outputContent = outputIndexFile;
57
+ let typesContent = this.generateTypes();
58
+ if (typesContent) {
59
+ outputContent += '\n\n' + typesContent;
60
+ }
61
+ context_1.Context.output.push({
62
+ path: '/index.ts',
63
+ content: await file_content_generator_1.FileContentGenerator.format(outputContent)
64
+ });
65
+ }
66
+ static async generateFileDevMode(pretext) {
67
+ let fileUrls = glob.sync(`${context_1.Context.config.compilerModulesPath}/**/*.ts`).map(filePath => filePath.replace(/\\/g, '/'));
68
+ if (fileUrls.length === 0) {
69
+ helpers_lib_1.ConsoleHelper.log(`No typescript file found to generate index.ts file.`, 'red');
70
+ }
71
+ let exportsContent = this.generateExportsContent();
72
+ let interfacesContent = await this.generateInterfacesContent(fileUrls);
73
+ if (interfacesContent !== undefined) {
74
+ let output = `${pretext}\n${exportsContent}\n\n${interfacesContent}`;
75
+ output = await file_content_generator_1.FileContentGenerator.format(output);
76
+ fs.writeFileSync(`${context_1.Context.compilerExecutionPath}/output-index-file.ts`, `// AUTO GENERATED - CHANGES WILL BE REPLACED\nexport const OutputIndexFile = \`${output}\`;\n`);
77
+ helpers_lib_1.ConsoleHelper.log(`Index content 'output-index-file.ts' is generated.`, 'green');
78
+ return output;
79
+ }
80
+ }
81
+ static generateExportsContent() {
82
+ return context_1.Context.exports
83
+ .map(exportItem => `export { ${exportItem.variableName} } from '.${exportItem.path.substring(0, exportItem.path.lastIndexOf('.'))}';`)
84
+ .join('\n');
85
+ }
86
+ static async generateInterfacesContent(fileUrls) {
87
+ let errorCount = 0;
88
+ let outputs = [];
89
+ fileUrls.forEach(fileUrl => {
90
+ let fileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1, fileUrl.lastIndexOf('.'));
91
+ let fileContent = fs.readFileSync(fileUrl, 'utf-8');
92
+ try {
93
+ let output = this.getInterfacesFromFile(fileName, fileContent);
94
+ if (output) {
95
+ outputs.push(output);
96
+ }
97
+ }
98
+ catch (error) {
99
+ errorCount++;
100
+ helpers_lib_1.ConsoleHelper.log(`Error parsing file: ${fileUrl}, error: '${error.message}'`, 'red');
101
+ }
102
+ });
103
+ let output = `//-------------------------- DEFINITIONS --------------------------\n`;
104
+ if (this.premadeInterfaces.length > 0) {
105
+ output += '// ---- premade ----';
106
+ output += this.premadeInterfaces.join('\n');
107
+ output += '\n\n';
108
+ }
109
+ output += outputs.join('\n');
110
+ return errorCount === 0 ? output : undefined;
111
+ }
112
+ static getInterfacesFromFile(fileName, fileContent) {
113
+ let index = fileContent.indexOf(START_COMMAND);
114
+ let definitionsFound = index !== -1;
115
+ let contents = [];
116
+ while (index !== -1) {
117
+ let endIndex = fileContent.indexOf(END_COMMAND, index);
118
+ if (endIndex === -1) {
119
+ throw new Error(`No end command found.`);
120
+ }
121
+ contents.push(fileContent.substring(fileContent.indexOf('\n', index + START_COMMAND.length) + 1, endIndex));
122
+ index = fileContent.indexOf(START_COMMAND, endIndex);
123
+ }
124
+ if (definitionsFound) {
125
+ return `// ---- ${fileName} ----\n${contents.join('\n')}`;
126
+ }
127
+ }
128
+ static generateTypes() {
129
+ let output = '';
130
+ if (this.idTypes.length > 0) {
131
+ output += `//-------------------------- ID TYPES --------------------------\n`;
132
+ output += this.idTypes.join('\n');
133
+ output += '\n';
134
+ }
135
+ return output;
136
+ }
137
+ }
138
+ exports.IndexFileGenerator = IndexFileGenerator;
139
+ //# sourceMappingURL=index-file-generator.js.map
@@ -0,0 +1,6 @@
1
+ export declare class TypesFileGenerator {
2
+ private static idTypes;
3
+ static addIdType(constantName: string, keys: string[]): void;
4
+ static generateFile(pretext: string): Promise<void>;
5
+ private static generateContent;
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypesFileGenerator = void 0;
4
+ const glob_1 = require("glob");
5
+ const helpers_lib_1 = require("helpers-lib");
6
+ const context_1 = require("../context");
7
+ const file_content_generator_1 = require("../file-content-generator/file-content-generator");
8
+ class TypesFileGenerator {
9
+ static { this.idTypes = []; }
10
+ static addIdType(constantName, keys) {
11
+ let value = `export type ${constantName}ID = ${keys.map(key => `'${key}'`).join(' | ')};`;
12
+ this.idTypes.push(value);
13
+ }
14
+ static async generateFile(pretext) {
15
+ let fileUrls = glob_1.glob.sync(`${context_1.Context.config.compilerModulesPath}/**/*.ts`).map(filePath => filePath.replace(/\\/g, '/'));
16
+ if (fileUrls.length === 0) {
17
+ helpers_lib_1.ConsoleHelper.log(`No typescript file found to generate index.ts file.`, 'red');
18
+ }
19
+ let output = this.generateContent();
20
+ context_1.Context.output.push({
21
+ path: '/types.ts',
22
+ content: await file_content_generator_1.FileContentGenerator.format(output)
23
+ });
24
+ }
25
+ static generateContent() {
26
+ let output = '';
27
+ if (this.idTypes.length > 0) {
28
+ output += `//-------------------------- ID TYPES --------------------------\n`;
29
+ output += this.idTypes.join('\n');
30
+ }
31
+ return output;
32
+ }
33
+ }
34
+ exports.TypesFileGenerator = TypesFileGenerator;
35
+ //# sourceMappingURL=types-file-generator.js.map
@@ -9,7 +9,7 @@ export interface AddFileOptions {
9
9
  path: string;
10
10
  variableName: string;
11
11
  variable: any;
12
- preText?: string;
12
+ preText?: string | string[];
13
13
  variableType?: string;
14
14
  replaceMap?: {
15
15
  target: string;
@@ -34,7 +34,7 @@ const _3_config_1 = require("../pipeline/3-config");
34
34
  const raw_data_parser_1 = require("../pipeline/raw-data-parser");
35
35
  const context_1 = require("./context");
36
36
  const definition_store_1 = require("./definition-store");
37
- const index_file_generator_1 = require("./index-file-generator/index-file-generator");
37
+ const index_file_generator_1 = require("./file-generators/index-file-generator");
38
38
  const KeyValueRegex = /^[a-z]+([a-zA-Z0-9]+)*$/;
39
39
  const HeavySeperator = '======================================================';
40
40
  const LightSeperator = '------------------------------------------------------';
@@ -219,13 +219,17 @@ class Kernel {
219
219
  for (let preparedItem of preparedItems) {
220
220
  if (preparedItem.definitionToProcess) {
221
221
  let module = new preparedItem.ModuleClass();
222
+ let keyName = preparedItem.ModuleClass.$meta.keyName;
223
+ if (keyName) {
224
+ index_file_generator_1.IndexFileGenerator.addIdType(preparedItem.ModuleClass.$meta.pascalCaseComponentName, preparedItem.definitionToProcess.map((definition) => definition[keyName]));
225
+ }
222
226
  await module.process(preparedItem.definitionToProcess, preparedItem.output);
223
227
  }
224
228
  }
225
229
  context_1.Context.flushErrorLogs(); // Still there might be some errors that customly added
226
230
  custom_validator_helper_1.CustomValidatorHelper.logDuplicates();
227
231
  if (context_1.Context.successful) {
228
- index_file_generator_1.IndexFileGenerator.generateIndexFile(indexFilePretext, outputIndexFile);
232
+ await index_file_generator_1.IndexFileGenerator.generateFile(indexFilePretext, outputIndexFile);
229
233
  }
230
234
  return this.getOutputFiles();
231
235
  }
package/dist/index.d.ts CHANGED
@@ -7,11 +7,11 @@ export { JoiCustomValidators } from './helpers/validator/joi-custom-validators';
7
7
  export { Validator } from './helpers/validator/validator';
8
8
  export * from './pre-made-components/_validators/shape-validators';
9
9
  export * from './pre-made-components/_validators/sprite-validators';
10
- export { SpriteComponent } from './pre-made-components/assets/1-sprite';
11
- export { SpriteGroupComponent } from './pre-made-components/assets/2-sprite-group';
12
- export { FontComponent } from './pre-made-components/assets/3-font';
13
- export { ScriptComponent } from './pre-made-components/events/1-script';
10
+ export { SpriteComponent, SpriteID } from './pre-made-components/assets/1-sprite';
11
+ export { SpriteGroupComponent, SpriteGroupID } from './pre-made-components/assets/2-sprite-group';
12
+ export { FontComponent, FontID } from './pre-made-components/assets/3-font';
13
+ export { ScriptComponent, ScriptID } from './pre-made-components/events/1-script';
14
14
  export { ScriptTestComponent } from './pre-made-components/events/2-script-test';
15
- export { EventComponent } from './pre-made-components/events/3-event';
15
+ export { EventComponent, EventID } from './pre-made-components/events/3-event';
16
16
  export { EventTestComponent } from './pre-made-components/events/4-event-test';
17
17
  export { ScriptTesting } from './pre-made-components/events/scripting-setup';
@@ -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);
@@ -2,6 +2,7 @@ import { Vec2 } from 'helpers-lib';
2
2
  import { DefinitionComponent } from '../../decorators/definition-component';
3
3
  import { Output } from '../../framework/interfaces';
4
4
  import { ValidatedSpriteUrl } from '../../helpers/validator/custom-validators/sprite.custom-validator';
5
+ export type SpriteID = string;
5
6
  export interface RawSpriteDefinition {
6
7
  id: string;
7
8
  url: ValidatedSpriteUrl;
@@ -1,5 +1,6 @@
1
1
  import { DefinitionComponent } from '../../decorators/definition-component';
2
2
  import { Output } from '../../framework/interfaces';
3
+ export type SpriteGroupID = string;
3
4
  interface SpriteGroupDefinition {
4
5
  id: string;
5
6
  group: string[];
@@ -1,12 +1,13 @@
1
1
  import { DefinitionComponent } from '../../decorators/definition-component';
2
2
  import { Output } from '../../framework/interfaces';
3
+ export type FontID = string;
3
4
  interface RawFontDefinition {
4
5
  id: string;
5
6
  fontFamily: string;
6
7
  url: string;
7
8
  }
8
9
  export interface FontDefinition {
9
- readonly id: string;
10
+ readonly id: FontID;
10
11
  readonly fontFamily: string;
11
12
  }
12
13
  export declare class FontComponent extends DefinitionComponent<RawFontDefinition> {
@@ -16,11 +16,11 @@ exports.FontComponent = void 0;
16
16
  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
- const index_file_generator_1 = require("../../framework/index-file-generator/index-file-generator");
20
- const INDEX_ENTRY = `
21
- export interface FontDefinition {
22
- readonly id: string;
23
- readonly fontFamily: string;
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;
24
24
  }`;
25
25
  let FontComponent = class FontComponent extends definition_component_1.DefinitionComponent {
26
26
  constructor() {
@@ -1,6 +1,7 @@
1
1
  import { ScriptDefinition } from 'script-engine-lib';
2
2
  import { DefinitionComponent } from '../../decorators/definition-component';
3
3
  import { Output } from '../../framework/interfaces';
4
+ export type ScriptID = string;
4
5
  export declare const ScriptNames: Set<string>;
5
6
  export declare class ScriptComponent extends DefinitionComponent<ScriptDefinition> {
6
7
  process(definitions: ScriptDefinition[], output: Output): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { ScriptDefinition } from 'script-engine-lib';
2
2
  import { DefinitionComponent } from '../../decorators/definition-component';
3
3
  import { Output } from '../../framework/interfaces';
4
+ export type EventID = string;
4
5
  export declare class EventComponent extends DefinitionComponent<ScriptDefinition> {
5
6
  process(definitions: ScriptDefinition[], output: Output): Promise<void>;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "definition-generator-framework",
3
- "version": "1.12.12",
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 cache clean --force && npm install",
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": "1.6.0"
55
+ "vitest": "3.2.4"
59
56
  },
60
57
  "types": "dist/index.d.ts"
61
58
  }