@tantawowa/hosanna-tools 0.1.0

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/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Getting started
2
+
3
+ Ensure you have a version of node that is the same or higher than [yml.ci](.github/workflows/ci.yml), which is node 20 or higher at time of writing.
4
+
5
+ run `npm install` to install all dependencies
6
+
7
+
8
+ Install ts-node globally:
9
+
10
+ ```bash
11
+ npm install -g ts-node
12
+ ```
13
+
14
+ Ensure you have hosanna compiler (hsc) installed globally. Tantawowa Ltd will provide you with the compiler.
15
+
16
+
17
+ # Requirements
18
+
19
+ - Node.js 20.5.0 or higher
20
+ - Python installed
21
+ - *nix operating system (BSD, macOS, Unix, WSL)
22
+ - Visual Studio Code or any MS Language Server Protocol (LSP) supported editor (only VS Code is officially supported by Tantawowa Ltd.)
23
+
24
+ **Note:** Windows is not supported directly. Developers can use WSL on Windows to meet the requirements. For more information, refer to the [WSL installation guide](https://docs.microsoft.com/en-us/windows/wsl/install) and the [VS Code WSL guide](https://code.visualstudio.com/docs/remote/wsl).
25
+
26
+ # Development Workflow
27
+
28
+ ## Editing code
29
+
30
+ 1. Use vscode
31
+ 2. Ensure the hosanna-ui *and* brightscript extensions are installed
32
+ 3. Open this folder
33
+
34
+ ## Developer Process
35
+
36
+ Before checking in your changes, ensure the following steps are completed:
37
+
38
+ 1. **Run the linter**: Ensure your code adheres to the project's coding standards by running the linter:
39
+ ```bash
40
+ npm run lint
41
+ ```
42
+
43
+ 2. **Run tests**: Verify that all tests pass to ensure your changes do not introduce regressions:
44
+ ```bash
45
+ npm test
46
+ ```
47
+
48
+ 3. **Commit your changes**: Once the linter and tests pass, commit your changes with a meaningful commit message.
49
+
50
+ Following these steps helps maintain code quality and stability across the project.
51
+
52
+ # hosanna tools
53
+
54
+ This directory contains various tools for working with hosanna.
55
+
56
+ These tools are going to move to a standalone repository, and be part of a single comprehensive tool for hosanna.
57
+
58
+ This tool:
59
+
60
+ - Generates a new hosanna project
61
+ - Generates a new hosanna view
62
+ - Generates structs while deubgging
63
+ - Runs a debug server for connecting hosanna on device
64
+ - Updates the hosanna framework in your project to the correct version
65
+
66
+ # To debug
67
+
68
+ - Run the hosanna server in a terminal, with Javscript debugging (i.e. Javascript Debug Terminal)
69
+ - Run the hosanna tool in a terminal: breakpoint debugging will be available
@@ -0,0 +1,3 @@
1
+ {
2
+ "buildDate": "2025-05-02T00:10:44.440Z"
3
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ // hs:exclude-from-platform roku
31
+ const chokidar = __importStar(require("chokidar"));
32
+ const path = __importStar(require("path"));
33
+ const fs = __importStar(require("fs"));
34
+ const view_generator_js_1 = require("./generation/view-generator.js");
35
+ const yargs_1 = __importDefault(require("yargs"));
36
+ const helpers_1 = require("yargs/helpers");
37
+ const generation_utils_js_1 = require("./generation/generation-utils.js");
38
+ const sdk_manager_js_1 = require("./updater/sdk-manager.js");
39
+ // Read build date from build-info.json
40
+ let buildDate = 'unknown';
41
+ try {
42
+ const buildInfoPath = path.resolve(__dirname, '../dist/build-info.json');
43
+ const buildInfo = JSON.parse(fs.readFileSync(buildInfoPath, 'utf-8'));
44
+ buildDate = buildInfo.buildDate || 'unknown';
45
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
46
+ }
47
+ catch (err) {
48
+ console.warn('Build date not found. Ensure build-info.json is generated during the build process.');
49
+ }
50
+ console.log(`hosanna-tools: Version: 1.0.0 (build date: ${buildDate})`);
51
+ /*******************************************************************
52
+ * CLI Handling
53
+ *******************************************************************/
54
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
55
+ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
56
+ .usage('$0 <command> [options]', `Hosanna Tools CLI\nVersion: 1.0.0\nBuild Date: ${buildDate}`)
57
+ .command('generate', 'Generate structs and command handler maps', yargs => yargs
58
+ .option('watch', { type: 'boolean', description: 'Watch for file changes' })
59
+ .option('rootFolder', { type: 'string', description: 'Root folder for the operation' })
60
+ .example('$0 generate --rootFolder ./src', 'Generate structs and command handler maps for the specified root folder')
61
+ .example('$0 generate --watch', 'Generate structs and command handler maps and watch for file changes'), args => {
62
+ const rootFolder = args.rootFolder ? path.resolve(args.rootFolder) : path.resolve(process.cwd(), 'src');
63
+ console.log(`Running generate command in folder ${rootFolder}`);
64
+ if (args.watch) {
65
+ console.log(`Watching for changes in ${rootFolder}...`);
66
+ }
67
+ (async () => {
68
+ await (0, generation_utils_js_1.generateAll)(rootFolder); // Ensure generateAll completes
69
+ if (args.watch) {
70
+ const watcher = chokidar.watch(rootFolder, {
71
+ persistent: true,
72
+ ignoreInitial: false,
73
+ ignored: /(^|[/\\])\../ // ignore dotfiles
74
+ });
75
+ watcher.on('add', (filePath) => (0, generation_utils_js_1.debounceHandler)(generation_utils_js_1.handleFileChange)(filePath, generation_utils_js_1.ChangeType.Add, rootFolder));
76
+ watcher.on('change', (filePath) => (0, generation_utils_js_1.debounceHandler)(generation_utils_js_1.handleFileChange)(filePath, generation_utils_js_1.ChangeType.Change, rootFolder));
77
+ watcher.on('unlink', (filePath) => (0, generation_utils_js_1.debounceHandler)(generation_utils_js_1.handleFileChange)(filePath, generation_utils_js_1.ChangeType.Unlink, rootFolder));
78
+ }
79
+ else {
80
+ console.log('Generate command completed.');
81
+ process.exit(0); // Exit after finishing when not in watch mode
82
+ }
83
+ })();
84
+ })
85
+ .command('clean', 'Clean generated files', yargs => yargs.option('rootFolder', { type: 'string', description: 'Root folder for the operation' }), async (args) => {
86
+ const rootFolder = args.rootFolder ? path.resolve(args.rootFolder) : path.resolve(process.cwd(), 'src');
87
+ console.log(`Running clean command in folder ${rootFolder}`);
88
+ await (0, generation_utils_js_1.cleanGeneratedFiles)(rootFolder); // Await the cleanup process
89
+ console.log('Cleanup process completed.');
90
+ process.exit(0); // Exit after finishing
91
+ })
92
+ .command('create-view', 'Create a new view', yargs => yargs.option('rootFolder', { type: 'string', description: 'Root folder for the operation' }), async (args) => {
93
+ const rootFolder = args.rootFolder ? path.resolve(args.rootFolder) : path.resolve(__dirname, '../src');
94
+ console.log(`Running create-view command in folder ${rootFolder}`);
95
+ try {
96
+ await (0, view_generator_js_1.generateView)(rootFolder);
97
+ }
98
+ catch (err) {
99
+ console.error(err);
100
+ }
101
+ })
102
+ .command('prepare-gitignore', 'Ensure .gitignore contains required entries', yargs => yargs, () => {
103
+ console.log('Preparing .gitignore...');
104
+ (0, sdk_manager_js_1.prepareGitIgnore)();
105
+ console.log('.gitignore preparation completed.');
106
+ })
107
+ .command('update', 'Update the SDK by cloning the repository, checking out the branch or tag, and setting up symlinks', yargs => yargs, () => {
108
+ console.log('Running update-sdk command...');
109
+ (0, sdk_manager_js_1.updateSdk)();
110
+ console.log('update-sdk command completed.');
111
+ })
112
+ .command('install', 'Install the SDK by creating hosanna.json and setting up the environment', yargs => yargs, async () => {
113
+ console.log('Running install-sdk command...');
114
+ try {
115
+ await (0, sdk_manager_js_1.installSdk)(); // Ensure installSdk is awaited
116
+ console.log('install-sdk command completed.');
117
+ process.exit(0); // Exit after successful completion
118
+ }
119
+ catch (err) {
120
+ console.error('An error occurred during the install process:', err);
121
+ process.exit(1); // Exit with error code on failure
122
+ }
123
+ })
124
+ .help('help', 'View help information about this tool.')
125
+ .demandCommand(1, 'You need to specify a command.')
126
+ .strict()
127
+ .argv;
128
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gCAAgC;AAChC,mDAAqC;AACrC,2CAA6B;AAC7B,uCAAyB;AACzB,sEAA8D;AAC9D,kDAA0B;AAC1B,2CAAwC;AACxC,0EAAmI;AACnI,6DAAmF;AAEnF,uCAAuC;AACvC,IAAI,SAAS,GAAG,SAAS,CAAC;AAC1B,IAAI;IACF,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC;IAC7C,4FAA4F;CAC7F;AAAC,OAAO,GAAY,EAAE;IACrB,OAAO,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;CACrG;AAED,OAAO,CAAC,GAAG,CAAC,8CAA8C,SAAS,GA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N,SAAS,EACT,yEAAyE,EACzE,KAAK,CAAC,EAAE,CAAC,KAAK,EACd,KAAK,IAAI,EAAE;IACT,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,IAAI;QACF,MAAM,IAAA,2BAAU,GAAE,CAAC,CAAC,+BAA+B;QACnD,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;KACrD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,kCAAkC;KACpD;AACH,CAAC,CACF;KACA,IAAI,CAAC,MAAM,EAAE,wCAAwC,CAAC;KACtD,aAAa,CAAC,CAAC,EAAE,gCAAgC,CAAC;KAClD,MAAM,EAAE;KACR,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function generateCommandHandlerMaps(rootProjectPath: string, outputFilePath: string): void;
2
+ export declare function mapContainsHandlerForFile(filePath: string): boolean;
3
+ export declare function fileHasCommandCateogry(filePath: string): boolean;
@@ -0,0 +1,169 @@
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.fileHasCommandCateogry = exports.mapContainsHandlerForFile = exports.generateCommandHandlerMaps = void 0;
27
+ /* eslint-disable @typescript-eslint/no-explicit-any */
28
+ const fs = __importStar(require("fs"));
29
+ const path = __importStar(require("path"));
30
+ const ts = __importStar(require("typescript"));
31
+ const hosanna_tools_utils_js_1 = require("../lib/hosanna-tools-utils.js");
32
+ let _rootProjectPath = '';
33
+ let filePathToCategoryMap = {};
34
+ // Load the project's tsconfig.json settings
35
+ function loadTSConfig() {
36
+ //get tsconfig from ../tsconfig.json
37
+ // const configPath = path.resolve(__dirname, '../tsconfig.json');
38
+ const configPath = path.resolve('./tsconfig.json');
39
+ if (!configPath)
40
+ throw new Error("Could not find a valid 'tsconfig.json'.");
41
+ const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
42
+ if (configFile.error)
43
+ throw new Error("Error reading 'tsconfig.json'.");
44
+ const parsedCommandLine = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
45
+ return parsedCommandLine;
46
+ }
47
+ // Generate command handler maps based on decorators in .ts files
48
+ function generateCommandHandlerMaps(rootProjectPath, outputFilePath) {
49
+ _rootProjectPath = rootProjectPath;
50
+ const parsedConfig = loadTSConfig(); // Moved here
51
+ filePathToCategoryMap = {}; // Reset map on each call
52
+ const files = (0, hosanna_tools_utils_js_1.findAllTSFiles)(rootProjectPath);
53
+ const program = ts.createProgram(files, parsedConfig.options);
54
+ const handlerMap = {};
55
+ const functionMap = {};
56
+ const imports = new Set();
57
+ const outputDir = path.dirname(outputFilePath);
58
+ if (!fs.existsSync(outputDir)) {
59
+ fs.mkdirSync(outputDir, { recursive: true });
60
+ }
61
+ files.forEach(file => {
62
+ const sourceFile = program.getSourceFile(file);
63
+ if (sourceFile) {
64
+ const visit = (node) => {
65
+ if (ts.isClassDeclaration(node) && node.name) {
66
+ // console.log('found class', node.name.text, 'in file', file);
67
+ const categoryDecorator = getDecoratorArgument(node, 'commandCategory');
68
+ if (categoryDecorator) {
69
+ handlerMap[categoryDecorator] = node.name.text;
70
+ filePathToCategoryMap[file] = categoryDecorator;
71
+ // const importPath = path.relative(path.dirname(outputFilePath), file).replace(/\\/g, '/').replace(/\.ts$/, '');
72
+ const importPath = getRelativePath(outputFilePath, file).replace(/\.ts$/, '');
73
+ imports.add(`import { ${node.name.text} } from './${importPath}';`);
74
+ }
75
+ for (const member of node.members) {
76
+ if (ts.isMethodDeclaration(member)) {
77
+ const commandDecorator = getDecoratorArgument(member, 'command');
78
+ if (commandDecorator) {
79
+ if (!functionMap[categoryDecorator]) {
80
+ functionMap[categoryDecorator] = {};
81
+ }
82
+ functionMap[categoryDecorator][commandDecorator] = member.name.text;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ ts.forEachChild(node, visit);
88
+ };
89
+ visit(sourceFile);
90
+ }
91
+ });
92
+ const importsContent = Array.from(imports).join('\n');
93
+ const handlerMapContent = Object.entries(handlerMap)
94
+ .map(([key, value]) => `"${key}": ${value}`)
95
+ .join(',\n ');
96
+ const outputContent = `
97
+ ${importsContent}
98
+
99
+ const handlerMap = {
100
+ ${handlerMapContent}
101
+ };
102
+ const functionMap = ${JSON.stringify(functionMap, null, 2)};
103
+
104
+ export function __hosanna_integrateGeneratedInfo() {
105
+ hs_SetAsyncManagerGeneratedInfo({
106
+ handlerMap: handlerMap,
107
+ functionMap: functionMap
108
+ })
109
+ }
110
+ `;
111
+ fs.writeFileSync(outputFilePath, outputContent);
112
+ console.log(`Generated command handler maps in ${outputFilePath}`);
113
+ const enumsContent = generateEnumsContent(functionMap);
114
+ const enumsOutputPath = path.resolve(outputDir, 'AsyncManagerCommands.ts');
115
+ fs.writeFileSync(enumsOutputPath, enumsContent);
116
+ console.log(`Generated command handler Enums in ${enumsOutputPath}`);
117
+ }
118
+ exports.generateCommandHandlerMaps = generateCommandHandlerMaps;
119
+ function generateEnumsContent(functionMap) {
120
+ let enumsContent = '';
121
+ for (const [category, commands] of Object.entries(functionMap)) {
122
+ // enumsContent += `export enum ${category}Commands {\n`;
123
+ enumsContent += `export enum ${category} {\n`;
124
+ for (const command of Object.keys(commands)) {
125
+ enumsContent += ` ${command} = '${category}.${command}',\n`;
126
+ }
127
+ enumsContent += '}\n\n';
128
+ }
129
+ return enumsContent;
130
+ }
131
+ function mapContainsHandlerForFile(filePath) {
132
+ const categoryName = filePathToCategoryMap[filePath];
133
+ if (!categoryName)
134
+ return false;
135
+ const outputFilePath = path.resolve(__dirname, '../src/AsyncManager-generated-map.ts');
136
+ const outputContent = fs.readFileSync(outputFilePath, 'utf-8');
137
+ return outputContent.includes(`"${categoryName}": `);
138
+ }
139
+ exports.mapContainsHandlerForFile = mapContainsHandlerForFile;
140
+ function fileHasCommandCateogry(filePath) {
141
+ const fileContent = fs.readFileSync(filePath, 'utf-8');
142
+ const categoryRegex = new RegExp(`@commandCategory\\(`);
143
+ return categoryRegex.test(fileContent);
144
+ }
145
+ exports.fileHasCommandCateogry = fileHasCommandCateogry;
146
+ function getDecoratorArgument(node, decoratorName) {
147
+ var _a, _b;
148
+ const decorator = (_a = node === null || node === void 0 ? void 0 : node.modifiers) === null || _a === void 0 ? void 0 : _a.find((modifier) => {
149
+ return (ts.isDecorator(modifier) &&
150
+ ts.isCallExpression(modifier.expression) &&
151
+ modifier.expression.expression.text === decoratorName);
152
+ });
153
+ if (decorator && ts.isCallExpression(decorator.expression)) {
154
+ const decoratorExpression = decorator.expression;
155
+ return ((_b = decoratorExpression.arguments[0]) === null || _b === void 0 ? void 0 : _b.text) || null;
156
+ }
157
+ return null;
158
+ }
159
+ function getRelativePath(fileName, targetPath) {
160
+ const hosannaPath = path.resolve(_rootProjectPath, '../../hosanna-ui');
161
+ targetPath = targetPath.replace(`${hosannaPath}/`, '');
162
+ targetPath = targetPath.replace(/^\.?\/?src\//, '');
163
+ fileName = fileName.replace(`${hosannaPath}/`, '');
164
+ const absoluteTargetPath = path.resolve(_rootProjectPath, targetPath);
165
+ const fromDir = path.dirname(fileName);
166
+ const relative = path.relative(fromDir, absoluteTargetPath);
167
+ return relative.replace(/\\/g, '/');
168
+ }
169
+ //# sourceMappingURL=command-handler-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-handler-generator.js","sourceRoot":"","sources":["../../src/generation/command-handler-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AACjC,0EAA+D;AAE/D,IAAI,gBAAgB,GAAG,EAAE,CAAC;AAC1B,IAAI,qBAAqB,GAA2B,EAAE,CAAC;AAEvD,4CAA4C;AAC5C,SAAS,YAAY;IACnB,oCAAoC;IAEpC,kEAAkE;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAE5E,MAAM,UAAU,GAAG,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClE,IAAI,UAAU,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAExE,MAAM,iBAAiB,GAAG,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7G,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,iEAAiE;AACjE,SAAgB,0BAA0B,CAAC,eAAuB,EAAE,cAAsB;IACxF,gBA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AC,CAAC;IACnD,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC5D,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare enum ChangeType {
2
+ Add = "add",
3
+ Change = "change",
4
+ Unlink = "unlink"
5
+ }
6
+ export declare function generateAll(rootFolder: string): void;
7
+ export declare function cleanGeneratedFiles(rootFolder: string): Promise<void>;
8
+ export declare function handleFileChange(filePath: string, changeType: ChangeType, rootFolder: string): void;
9
+ export declare function debounceHandler(handler: (filePath: string, changeType: ChangeType, rootFolder: string) => void): (filePath: string, changeType: ChangeType, rootFolder: string) => void;
@@ -0,0 +1,114 @@
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.debounceHandler = exports.handleFileChange = exports.cleanGeneratedFiles = exports.generateAll = exports.ChangeType = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const path = __importStar(require("path"));
29
+ const hosanna_tools_utils_js_1 = require("../lib/hosanna-tools-utils.js");
30
+ const struct_generator_js_1 = require("./struct-generator.js");
31
+ const command_handler_generator_1 = require("./command-handler-generator");
32
+ var ChangeType;
33
+ (function (ChangeType) {
34
+ ChangeType["Add"] = "add";
35
+ ChangeType["Change"] = "change";
36
+ ChangeType["Unlink"] = "unlink";
37
+ })(ChangeType || (exports.ChangeType = ChangeType = {}));
38
+ function generateAll(rootFolder) {
39
+ console.log('Generating structs...');
40
+ const structFiles = (0, hosanna_tools_utils_js_1.findAllTSFiles)(rootFolder)
41
+ .filter(f => f.endsWith('.ts') &&
42
+ !f.endsWith('.d.ts') &&
43
+ (0, struct_generator_js_1.containsHosannaView)(f) // only TS files with @view/@aggregateView
44
+ );
45
+ structFiles.forEach(file => {
46
+ console.log(`→ ${file}`);
47
+ (0, struct_generator_js_1.generateStructForFile)(file, rootFolder);
48
+ });
49
+ const outputFilePath = path.resolve(rootFolder, './AsyncManager-generated-map.ts');
50
+ const outputDir = path.dirname(outputFilePath);
51
+ if (!fs.existsSync(outputDir)) {
52
+ fs.mkdirSync(outputDir, { recursive: true });
53
+ }
54
+ console.log('Generating command handlers...');
55
+ (0, command_handler_generator_1.generateCommandHandlerMaps)(rootFolder, outputFilePath);
56
+ }
57
+ exports.generateAll = generateAll;
58
+ async function cleanGeneratedFiles(rootFolder) {
59
+ console.log(`Cleaning generated files in ${rootFolder}...`);
60
+ const generatedFiles = (0, hosanna_tools_utils_js_1.findAllTSFiles)(rootFolder).filter(file => file.includes('-generated-'));
61
+ if (generatedFiles.length === 0) {
62
+ console.log('No generated files found to clean.');
63
+ }
64
+ else {
65
+ for (const file of generatedFiles) {
66
+ console.log(`Deleting generated file: ${file}`);
67
+ fs.unlinkSync(file);
68
+ }
69
+ }
70
+ console.log('Clean completed.');
71
+ }
72
+ exports.cleanGeneratedFiles = cleanGeneratedFiles;
73
+ function handleFileChange(filePath, changeType, rootFolder) {
74
+ const outputFilePath = path.resolve(rootFolder, './AsyncManager-generated-map.ts');
75
+ if (filePath.endsWith('.ts') && !filePath.endsWith('.d.ts')) {
76
+ if (changeType === ChangeType.Unlink) {
77
+ const generatedFilePath = filePath.replace(/\.ts$/, '-generated-struct.ts');
78
+ if (fs.existsSync(generatedFilePath)) {
79
+ console.log(`Detected deletion of ${filePath}. Deleting generated struct file...`);
80
+ fs.unlinkSync(generatedFilePath);
81
+ }
82
+ if ((0, command_handler_generator_1.mapContainsHandlerForFile)(filePath)) {
83
+ console.log(`Detected handler map deletion in ${filePath}. Regenerating command handlers...`);
84
+ (0, command_handler_generator_1.generateCommandHandlerMaps)(rootFolder, outputFilePath);
85
+ }
86
+ }
87
+ else {
88
+ if ((0, struct_generator_js_1.containsHosannaView)(filePath)) {
89
+ console.log(`Detected view change in ${filePath}. Generating struct...`);
90
+ (0, struct_generator_js_1.generateStructForFile)(filePath, rootFolder);
91
+ }
92
+ else if ((0, command_handler_generator_1.fileHasCommandCateogry)(filePath)) {
93
+ console.log(`Detected command category change in ${filePath}. Generating command handlers...`);
94
+ (0, command_handler_generator_1.generateCommandHandlerMaps)(rootFolder, outputFilePath);
95
+ }
96
+ }
97
+ }
98
+ }
99
+ exports.handleFileChange = handleFileChange;
100
+ function debounceHandler(handler) {
101
+ return (filePath, changeType, rootFolder) => {
102
+ let debounceTimeout;
103
+ const DEBOUNCE_DELAY = 3000; // 3 seconds
104
+ if (debounceTimeout) {
105
+ clearTimeout(debounceTimeout);
106
+ }
107
+ debounceTimeout = setTimeout(() => {
108
+ handler(filePath, changeType, rootFolder);
109
+ debounceTimeout = undefined;
110
+ }, DEBOUNCE_DELAY);
111
+ };
112
+ }
113
+ exports.debounceHandler = debounceHandler;
114
+ //# sourceMappingURL=generation-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation-utils.js","sourceRoot":"","sources":["../../src/generation/generation-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,0EAA+D;AAC/D,+DAAmF;AACnF,2EAA4H;AAE5H,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,SAAgB,WAAW,CAAC,UAAkB;IAC5C,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,IAAA,uCAAc,EAAC,UAAU,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,CACV,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;QACpB,IAAA,yCAAmB,EAAC,CAAC,CAAC,CAAK,0CAA0C;KACtE,CAAC;IAEJ,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACzB,IAAA,2CAAqB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,iCAAiC,CAAC,CAAC;IACnF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,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Name: string;
7
+ }
8
+ export declare function generateStructForFile(fileName: string, rootProjectPath: string): void;
9
+ export declare function getViewMetadata(sourceFile: ts.SourceFile): IGeneratedViewMetadata | undefined;
10
+ export declare function containsHosannaView(filePath: string): boolean;