@interopio/iocd-cli 0.0.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.
Files changed (297) hide show
  1. package/README.md +40 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +96 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/apps.command.d.ts +3 -0
  7. package/dist/commands/apps.command.d.ts.map +1 -0
  8. package/dist/commands/apps.command.js +110 -0
  9. package/dist/commands/apps.command.js.map +1 -0
  10. package/dist/commands/components.command.d.ts +3 -0
  11. package/dist/commands/components.command.d.ts.map +1 -0
  12. package/dist/commands/components.command.js +116 -0
  13. package/dist/commands/components.command.js.map +1 -0
  14. package/dist/commands/create.command.d.ts +3 -0
  15. package/dist/commands/create.command.d.ts.map +1 -0
  16. package/dist/commands/create.command.js +19 -0
  17. package/dist/commands/create.command.js.map +1 -0
  18. package/dist/commands/dev.command.d.ts +4 -0
  19. package/dist/commands/dev.command.d.ts.map +1 -0
  20. package/dist/commands/dev.command.js +25 -0
  21. package/dist/commands/dev.command.js.map +1 -0
  22. package/dist/commands/installer.command.d.ts +3 -0
  23. package/dist/commands/installer.command.d.ts.map +1 -0
  24. package/dist/commands/installer.command.js +19 -0
  25. package/dist/commands/installer.command.js.map +1 -0
  26. package/dist/commands/license.command.d.ts +3 -0
  27. package/dist/commands/license.command.d.ts.map +1 -0
  28. package/dist/commands/license.command.js +23 -0
  29. package/dist/commands/license.command.js.map +1 -0
  30. package/dist/commands/modifications.command.d.ts +3 -0
  31. package/dist/commands/modifications.command.d.ts.map +1 -0
  32. package/dist/commands/modifications.command.js +28 -0
  33. package/dist/commands/modifications.command.js.map +1 -0
  34. package/dist/commands/setup.command.d.ts +4 -0
  35. package/dist/commands/setup.command.d.ts.map +1 -0
  36. package/dist/commands/setup.command.js +34 -0
  37. package/dist/commands/setup.command.js.map +1 -0
  38. package/dist/services/app-builder.service.d.ts +2 -0
  39. package/dist/services/app-builder.service.d.ts.map +1 -0
  40. package/dist/services/app-builder.service.js +3 -0
  41. package/dist/services/app-builder.service.js.map +1 -0
  42. package/dist/services/app.service.d.ts +74 -0
  43. package/dist/services/app.service.d.ts.map +1 -0
  44. package/dist/services/app.service.js +328 -0
  45. package/dist/services/app.service.js.map +1 -0
  46. package/dist/services/components/component.config.d.ts +11 -0
  47. package/dist/services/components/component.config.d.ts.map +1 -0
  48. package/dist/services/components/component.config.js +101 -0
  49. package/dist/services/components/component.config.js.map +1 -0
  50. package/dist/services/components/component.d.ts +12 -0
  51. package/dist/services/components/component.d.ts.map +1 -0
  52. package/dist/services/components/component.js +3 -0
  53. package/dist/services/components/component.js.map +1 -0
  54. package/dist/services/components/components.registry.d.ts +40 -0
  55. package/dist/services/components/components.registry.d.ts.map +1 -0
  56. package/dist/services/components/components.registry.js +72 -0
  57. package/dist/services/components/components.registry.js.map +1 -0
  58. package/dist/services/components/components.service.d.ts +20 -0
  59. package/dist/services/components/components.service.d.ts.map +1 -0
  60. package/dist/services/components/components.service.js +171 -0
  61. package/dist/services/components/components.service.js.map +1 -0
  62. package/dist/services/components/file.helper.d.ts +12 -0
  63. package/dist/services/components/file.helper.d.ts.map +1 -0
  64. package/dist/services/components/file.helper.js +124 -0
  65. package/dist/services/components/file.helper.js.map +1 -0
  66. package/dist/services/components/platform.utils.d.ts +72 -0
  67. package/dist/services/components/platform.utils.d.ts.map +1 -0
  68. package/dist/services/components/platform.utils.js +156 -0
  69. package/dist/services/components/platform.utils.js.map +1 -0
  70. package/dist/services/components/stores/github.store.d.ts +35 -0
  71. package/dist/services/components/stores/github.store.d.ts.map +1 -0
  72. package/dist/services/components/stores/github.store.js +157 -0
  73. package/dist/services/components/stores/github.store.js.map +1 -0
  74. package/dist/services/components/stores/local.store.d.ts +69 -0
  75. package/dist/services/components/stores/local.store.d.ts.map +1 -0
  76. package/dist/services/components/stores/local.store.js +300 -0
  77. package/dist/services/components/stores/local.store.js.map +1 -0
  78. package/dist/services/components/stores/s3.store.d.ts +98 -0
  79. package/dist/services/components/stores/s3.store.d.ts.map +1 -0
  80. package/dist/services/components/stores/s3.store.js +368 -0
  81. package/dist/services/components/stores/s3.store.js.map +1 -0
  82. package/dist/services/components/stores/store.d.ts +11 -0
  83. package/dist/services/components/stores/store.d.ts.map +1 -0
  84. package/dist/services/components/stores/store.js +3 -0
  85. package/dist/services/components/stores/store.js.map +1 -0
  86. package/dist/services/config/cli.config.d.ts +57 -0
  87. package/dist/services/config/cli.config.d.ts.map +1 -0
  88. package/dist/services/config/cli.config.js +3 -0
  89. package/dist/services/config/cli.config.js.map +1 -0
  90. package/dist/services/config/config.service.d.ts +14 -0
  91. package/dist/services/config/config.service.d.ts.map +1 -0
  92. package/dist/services/config/config.service.js +170 -0
  93. package/dist/services/config/config.service.js.map +1 -0
  94. package/dist/services/create.service.d.ts +58 -0
  95. package/dist/services/create.service.d.ts.map +1 -0
  96. package/dist/services/create.service.js +318 -0
  97. package/dist/services/create.service.js.map +1 -0
  98. package/dist/services/dev.service.d.ts +2 -0
  99. package/dist/services/dev.service.d.ts.map +1 -0
  100. package/dist/services/dev.service.js +78 -0
  101. package/dist/services/dev.service.js.map +1 -0
  102. package/dist/services/installer/electronBuilder.d.ts +2 -0
  103. package/dist/services/installer/electronBuilder.d.ts.map +1 -0
  104. package/dist/services/installer/electronBuilder.js +3 -0
  105. package/dist/services/installer/electronBuilder.js.map +1 -0
  106. package/dist/services/installer/electronForge.d.ts +2 -0
  107. package/dist/services/installer/electronForge.d.ts.map +1 -0
  108. package/dist/services/installer/electronForge.js +248 -0
  109. package/dist/services/installer/electronForge.js.map +1 -0
  110. package/dist/services/installer/installer.service.d.ts +5 -0
  111. package/dist/services/installer/installer.service.d.ts.map +1 -0
  112. package/dist/services/installer/installer.service.js +101 -0
  113. package/dist/services/installer/installer.service.js.map +1 -0
  114. package/dist/services/installer/macOS.helper.d.ts +3 -0
  115. package/dist/services/installer/macOS.helper.d.ts.map +1 -0
  116. package/dist/services/installer/macOS.helper.js +244 -0
  117. package/dist/services/installer/macOS.helper.js.map +1 -0
  118. package/dist/services/installer/prerequisites.d.ts +2 -0
  119. package/dist/services/installer/prerequisites.d.ts.map +1 -0
  120. package/dist/services/installer/prerequisites.js +73 -0
  121. package/dist/services/installer/prerequisites.js.map +1 -0
  122. package/dist/services/installer/windows.helper.d.ts +10 -0
  123. package/dist/services/installer/windows.helper.d.ts.map +1 -0
  124. package/dist/services/installer/windows.helper.js +394 -0
  125. package/dist/services/installer/windows.helper.js.map +1 -0
  126. package/dist/services/license.service.d.ts +7 -0
  127. package/dist/services/license.service.d.ts.map +1 -0
  128. package/dist/services/license.service.js +14 -0
  129. package/dist/services/license.service.js.map +1 -0
  130. package/dist/services/modifications/macOS.helper.d.ts +13 -0
  131. package/dist/services/modifications/macOS.helper.d.ts.map +1 -0
  132. package/dist/services/modifications/macOS.helper.js +274 -0
  133. package/dist/services/modifications/macOS.helper.js.map +1 -0
  134. package/dist/services/modifications/modifications.service.d.ts +2 -0
  135. package/dist/services/modifications/modifications.service.d.ts.map +1 -0
  136. package/dist/services/modifications/modifications.service.js +376 -0
  137. package/dist/services/modifications/modifications.service.js.map +1 -0
  138. package/dist/services/modifications/windows.helper.d.ts +2 -0
  139. package/dist/services/modifications/windows.helper.d.ts.map +1 -0
  140. package/dist/services/modifications/windows.helper.js +83 -0
  141. package/dist/services/modifications/windows.helper.js.map +1 -0
  142. package/dist/services/template.service.d.ts +116 -0
  143. package/dist/services/template.service.d.ts.map +1 -0
  144. package/dist/services/template.service.js +354 -0
  145. package/dist/services/template.service.js.map +1 -0
  146. package/dist/templates/auto-tests/README.md +31 -0
  147. package/dist/templates/auto-tests/playwright.config.js +19 -0
  148. package/dist/templates/auto-tests/template.json +12 -0
  149. package/dist/templates/auto-tests/tests/basic.test.js +15 -0
  150. package/dist/templates/ioconnect-desktop/.env.example +29 -0
  151. package/dist/templates/ioconnect-desktop/.github/workflows/build-installers.yml +170 -0
  152. package/dist/templates/ioconnect-desktop/LICENSE +0 -0
  153. package/dist/templates/ioconnect-desktop/README.md +0 -0
  154. package/dist/templates/ioconnect-desktop/config/mac-build/entitlements.mac.plist +44 -0
  155. package/dist/templates/ioconnect-desktop/config/win-build/template.nuspectemplate +33 -0
  156. package/dist/templates/ioconnect-desktop/forge.config.js +47 -0
  157. package/dist/templates/ioconnect-desktop/iocd.cli.config.json +45 -0
  158. package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.icns +0 -0
  159. package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.ico +0 -0
  160. package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.png +0 -0
  161. package/dist/templates/ioconnect-desktop/modifications/iocd/config/system.json.merge +3 -0
  162. package/dist/templates/ioconnect-desktop/package.json +43 -0
  163. package/dist/templates/ioconnect-desktop/template.json +7 -0
  164. package/dist/templates/launchpad/apps/launchpad/.eslintrc.json +3 -0
  165. package/dist/templates/launchpad/apps/launchpad/config/iocd.app.def.dev.json +57 -0
  166. package/dist/templates/launchpad/apps/launchpad/config/iocd.app.def.prod.json +2 -0
  167. package/dist/templates/launchpad/apps/launchpad/config/iocd.system.dev.json +3 -0
  168. package/dist/templates/launchpad/apps/launchpad/config/iocd.system.prod.json +3 -0
  169. package/dist/templates/launchpad/apps/launchpad/index.html +16 -0
  170. package/dist/templates/launchpad/apps/launchpad/iocd.app.json +32 -0
  171. package/dist/templates/launchpad/apps/launchpad/package-lock.json +2778 -0
  172. package/dist/templates/launchpad/apps/launchpad/package.json +21 -0
  173. package/dist/templates/launchpad/apps/launchpad/public/favicon.ico +0 -0
  174. package/dist/templates/launchpad/apps/launchpad/src/app/app.tsx +39 -0
  175. package/dist/templates/launchpad/apps/launchpad/src/app/constants.ts +27 -0
  176. package/dist/templates/launchpad/apps/launchpad/src/components/logo.tsx +11 -0
  177. package/dist/templates/launchpad/apps/launchpad/src/components/main-context-menu.tsx +162 -0
  178. package/dist/templates/launchpad/apps/launchpad/src/components/notifications-button.tsx +44 -0
  179. package/dist/templates/launchpad/apps/launchpad/src/main.tsx +6 -0
  180. package/dist/templates/launchpad/apps/launchpad/src/styles.css +17 -0
  181. package/dist/templates/launchpad/apps/launchpad/tsconfig.json +10 -0
  182. package/dist/templates/launchpad/apps/launchpad/vite.config.ts +13 -0
  183. package/dist/templates/launchpad/template.json +12 -0
  184. package/dist/templates/splash-screen/apps/splash-screen/README.md +119 -0
  185. package/dist/templates/splash-screen/apps/splash-screen/config/system-dev.json +9 -0
  186. package/dist/templates/splash-screen/apps/splash-screen/config/system-prod.json +8 -0
  187. package/dist/templates/splash-screen/apps/splash-screen/index.html +55 -0
  188. package/dist/templates/splash-screen/apps/splash-screen/iocd.app.json +20 -0
  189. package/dist/templates/splash-screen/apps/splash-screen/package-lock.json +1059 -0
  190. package/dist/templates/splash-screen/apps/splash-screen/package.json +17 -0
  191. package/dist/templates/splash-screen/apps/splash-screen/public/assets/fonts/PTSans-Regular.ttf +0 -0
  192. package/dist/templates/splash-screen/apps/splash-screen/public/assets/images/logo-light.svg +85 -0
  193. package/dist/templates/splash-screen/apps/splash-screen/public/assets/images/splash-bg.png +0 -0
  194. package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.css +149 -0
  195. package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.css.map +1 -0
  196. package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.scss +90 -0
  197. package/dist/templates/splash-screen/apps/splash-screen/src/main.ts +93 -0
  198. package/dist/templates/splash-screen/apps/splash-screen/src/types.ts +28 -0
  199. package/dist/templates/splash-screen/apps/splash-screen/tsconfig.json +25 -0
  200. package/dist/templates/splash-screen/apps/splash-screen/vite.config.ts +27 -0
  201. package/dist/templates/splash-screen/template.json +12 -0
  202. package/dist/templates/web-groups/apps/web-groups/README.md +15 -0
  203. package/dist/templates/web-groups/apps/web-groups/config/web-group-dev.json +13 -0
  204. package/dist/templates/web-groups/apps/web-groups/config/web-group-prod.json +12 -0
  205. package/dist/templates/web-groups/apps/web-groups/index.html +18 -0
  206. package/dist/templates/web-groups/apps/web-groups/iocd.app.json +24 -0
  207. package/dist/templates/web-groups/apps/web-groups/package.json +28 -0
  208. package/dist/templates/web-groups/apps/web-groups/public/favicon.ico +0 -0
  209. package/dist/templates/web-groups/apps/web-groups/public/logo192.png +0 -0
  210. package/dist/templates/web-groups/apps/web-groups/public/logo512.png +0 -0
  211. package/dist/templates/web-groups/apps/web-groups/public/manifest.json +25 -0
  212. package/dist/templates/web-groups/apps/web-groups/public/robots.txt +3 -0
  213. package/dist/templates/web-groups/apps/web-groups/src/App.css +38 -0
  214. package/dist/templates/web-groups/apps/web-groups/src/App.tsx +11 -0
  215. package/dist/templates/web-groups/apps/web-groups/src/index.css +13 -0
  216. package/dist/templates/web-groups/apps/web-groups/src/index.tsx +25 -0
  217. package/dist/templates/web-groups/apps/web-groups/src/logo.svg +1 -0
  218. package/dist/templates/web-groups/apps/web-groups/src/reportWebVitals.ts +15 -0
  219. package/dist/templates/web-groups/apps/web-groups/tsconfig.json +26 -0
  220. package/dist/templates/web-groups/apps/web-groups/vite.config.ts +8 -0
  221. package/dist/templates/web-groups/template.json +12 -0
  222. package/dist/templates/workspaces/apps/workspaces/README.md +15 -0
  223. package/dist/templates/workspaces/apps/workspaces/config/workspaces-dev.json +21 -0
  224. package/dist/templates/workspaces/apps/workspaces/config/workspaces-prod.json +20 -0
  225. package/dist/templates/workspaces/apps/workspaces/index.html +17 -0
  226. package/dist/templates/workspaces/apps/workspaces/iocd.app.json +24 -0
  227. package/dist/templates/workspaces/apps/workspaces/package.json +29 -0
  228. package/dist/templates/workspaces/apps/workspaces/public/favicon.ico +0 -0
  229. package/dist/templates/workspaces/apps/workspaces/public/logo192.png +0 -0
  230. package/dist/templates/workspaces/apps/workspaces/public/logo512.png +0 -0
  231. package/dist/templates/workspaces/apps/workspaces/public/manifest.json +25 -0
  232. package/dist/templates/workspaces/apps/workspaces/public/robots.txt +3 -0
  233. package/dist/templates/workspaces/apps/workspaces/src/AddWindowButton.tsx +33 -0
  234. package/dist/templates/workspaces/apps/workspaces/src/AfterTabs.tsx +27 -0
  235. package/dist/templates/workspaces/apps/workspaces/src/App.css +38 -0
  236. package/dist/templates/workspaces/apps/workspaces/src/App.tsx +103 -0
  237. package/dist/templates/workspaces/apps/workspaces/src/GroupHeaderButtons.tsx +9 -0
  238. package/dist/templates/workspaces/apps/workspaces/src/index.css +4 -0
  239. package/dist/templates/workspaces/apps/workspaces/src/index.tsx +28 -0
  240. package/dist/templates/workspaces/apps/workspaces/src/logo.svg +7 -0
  241. package/dist/templates/workspaces/apps/workspaces/src/reportWebVitals.ts +15 -0
  242. package/dist/templates/workspaces/apps/workspaces/src/setupTests.ts +5 -0
  243. package/dist/templates/workspaces/apps/workspaces/src/useAddWindowButtonVisible.tsx +30 -0
  244. package/dist/templates/workspaces/apps/workspaces/tsconfig.json +26 -0
  245. package/dist/templates/workspaces/apps/workspaces/vite.config.ts +8 -0
  246. package/dist/templates/workspaces/template.json +12 -0
  247. package/dist/tools/rcedit-x64.exe +0 -0
  248. package/dist/utils/colors.d.ts +57 -0
  249. package/dist/utils/colors.d.ts.map +1 -0
  250. package/dist/utils/colors.js +151 -0
  251. package/dist/utils/colors.js.map +1 -0
  252. package/dist/utils/deep.merge.d.ts +5 -0
  253. package/dist/utils/deep.merge.d.ts.map +1 -0
  254. package/dist/utils/deep.merge.js +27 -0
  255. package/dist/utils/deep.merge.js.map +1 -0
  256. package/dist/utils/electron.builder.config.helper.d.ts +6 -0
  257. package/dist/utils/electron.builder.config.helper.d.ts.map +1 -0
  258. package/dist/utils/electron.builder.config.helper.js +25 -0
  259. package/dist/utils/electron.builder.config.helper.js.map +1 -0
  260. package/dist/utils/ensure.iocd.exists.d.ts +2 -0
  261. package/dist/utils/ensure.iocd.exists.d.ts.map +1 -0
  262. package/dist/utils/ensure.iocd.exists.js +27 -0
  263. package/dist/utils/ensure.iocd.exists.js.map +1 -0
  264. package/dist/utils/error.handler.d.ts +30 -0
  265. package/dist/utils/error.handler.d.ts.map +1 -0
  266. package/dist/utils/error.handler.js +104 -0
  267. package/dist/utils/error.handler.js.map +1 -0
  268. package/dist/utils/file.d.ts +10 -0
  269. package/dist/utils/file.d.ts.map +1 -0
  270. package/dist/utils/file.js +40 -0
  271. package/dist/utils/file.js.map +1 -0
  272. package/dist/utils/find.package.dir.d.ts +2 -0
  273. package/dist/utils/find.package.dir.d.ts.map +1 -0
  274. package/dist/utils/find.package.dir.js +23 -0
  275. package/dist/utils/find.package.dir.js.map +1 -0
  276. package/dist/utils/logger.d.ts +19 -0
  277. package/dist/utils/logger.d.ts.map +1 -0
  278. package/dist/utils/logger.js +184 -0
  279. package/dist/utils/logger.js.map +1 -0
  280. package/dist/utils/nextSteps.d.ts +2 -0
  281. package/dist/utils/nextSteps.d.ts.map +1 -0
  282. package/dist/utils/nextSteps.js +44 -0
  283. package/dist/utils/nextSteps.js.map +1 -0
  284. package/dist/utils/pacakge.json.helper.d.ts +9 -0
  285. package/dist/utils/pacakge.json.helper.d.ts.map +1 -0
  286. package/dist/utils/pacakge.json.helper.js +71 -0
  287. package/dist/utils/pacakge.json.helper.js.map +1 -0
  288. package/dist/utils/path.d.ts +19 -0
  289. package/dist/utils/path.d.ts.map +1 -0
  290. package/dist/utils/path.js +81 -0
  291. package/dist/utils/path.js.map +1 -0
  292. package/dist/utils/version.d.ts +2 -0
  293. package/dist/utils/version.d.ts.map +1 -0
  294. package/dist/utils/version.js +16 -0
  295. package/dist/utils/version.js.map +1 -0
  296. package/package.json +69 -0
  297. package/tools/rcedit-x64.exe +0 -0
@@ -0,0 +1,354 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TemplateService = void 0;
7
+ const node_path_1 = require("node:path");
8
+ const node_fs_1 = require("node:fs");
9
+ const logger_1 = require("../utils/logger");
10
+ const error_handler_1 = require("../utils/error.handler");
11
+ const fs_extra_1 = __importDefault(require("fs-extra"));
12
+ const config_service_1 = require("./config/config.service");
13
+ const path_1 = require("../utils/path");
14
+ /**
15
+ * TemplateService handles the generation of io.Connect Desktop projects using a modular template system.
16
+ *
17
+ * This service supports two types of templates:
18
+ * - Base templates: Core project structure and essential files (e.g., ioconnect-desktop)
19
+ * - Feature templates: Optional functionality modules that extend the base template
20
+ *
21
+ * The service processes templates by:
22
+ * 1. Copying base template files to the target directory
23
+ * 2. Applying variable substitutions ({{variable}} patterns)
24
+ * 3. Conditionally applying feature templates based on user selection:
25
+ * - Validates that requested features exist as separate template directories
26
+ * - Only processes features that are explicitly selected by the user
27
+ * - Each feature template contains its own template.json with type: "feature"
28
+ * - Features are independent and can be combined in any combination
29
+ * 4. Merging feature-specific files into the project structure:
30
+ * - Feature templates overlay their files onto the base project structure
31
+ * - Files from features are copied to their corresponding paths in the target
32
+ * - Directory structures are preserved (e.g., modifications/iocd/assets/feature/)
33
+ * - No conflicts occur since features target different subdirectories
34
+ * - Variable substitution is applied to feature files just like base template files
35
+ *
36
+ * Key capabilities:
37
+ * - Template discovery and validation from filesystem
38
+ * - Variable interpolation for dynamic content generation
39
+ * - Modular feature system for extensible project setup
40
+ * - Comprehensive error handling and logging
41
+ * - Support for nested directory structures and file copying
42
+ */
43
+ class TemplateService {
44
+ logger = logger_1.Logger.getInstance();
45
+ templatesPath;
46
+ constructor() {
47
+ this.templatesPath = (0, node_path_1.join)(__dirname, '../templates');
48
+ }
49
+ /**
50
+ * Get the path to embedded templates
51
+ */
52
+ getTemplatesPath() {
53
+ return this.templatesPath;
54
+ }
55
+ /**
56
+ * List available templates
57
+ */
58
+ getAvailableTemplates() {
59
+ try {
60
+ if (!(0, node_fs_1.existsSync)(this.templatesPath)) {
61
+ this.logger.warn('Templates directory does not exist:', this.templatesPath);
62
+ return [];
63
+ }
64
+ return (0, node_fs_1.readdirSync)(this.templatesPath, { withFileTypes: true })
65
+ .filter(dirent => dirent.isDirectory())
66
+ .map(dirent => dirent.name);
67
+ }
68
+ catch (error) {
69
+ this.logger.error('Failed to list templates:', error);
70
+ throw new error_handler_1.CLIError('Failed to list available templates', {
71
+ code: error_handler_1.ErrorCode.FILE_SYSTEM_ERROR,
72
+ cause: error,
73
+ suggestions: [
74
+ 'Check if the CLI installation is complete',
75
+ 'Try reinstalling the CLI tool'
76
+ ]
77
+ });
78
+ }
79
+ }
80
+ /**
81
+ * Check if a template exists
82
+ */
83
+ templateExists(templateName) {
84
+ const templatePath = (0, node_path_1.join)(this.templatesPath, templateName);
85
+ return (0, node_fs_1.existsSync)(templatePath) && (0, node_fs_1.statSync)(templatePath).isDirectory();
86
+ }
87
+ /**
88
+ * Generate a project from a template
89
+ */
90
+ async generateProject(templateName, options) {
91
+ this.logger.info(`Generating project from template: ${templateName}`);
92
+ this.logger.debug(`Generating project with options:\n`, options);
93
+ // Validate template exists
94
+ if (!this.templateExists(templateName)) {
95
+ throw new error_handler_1.CLIError(`Template '${templateName}' not found`, {
96
+ code: error_handler_1.ErrorCode.NOT_FOUND,
97
+ suggestions: [
98
+ 'Check available templates with: iocd templates list',
99
+ 'Verify the template name is spelled correctly'
100
+ ]
101
+ });
102
+ }
103
+ // Ensure only base templates can be used for project generation
104
+ const templateInfo = this.getTemplateInfo(templateName);
105
+ if (templateInfo.type !== 'base') {
106
+ throw new error_handler_1.CLIError(`Template '${templateName}' is not a base template`, {
107
+ code: error_handler_1.ErrorCode.VALIDATION_ERROR,
108
+ suggestions: [
109
+ 'Use a base template like "ioconnect-desktop"',
110
+ 'Feature templates are applied automatically through the features option'
111
+ ]
112
+ });
113
+ }
114
+ // Check if target directory already exists
115
+ if ((0, node_fs_1.existsSync)(options.targetDirectory)) {
116
+ throw new error_handler_1.CLIError(`Directory '${options.targetDirectory}' already exists`, {
117
+ code: error_handler_1.ErrorCode.FILE_SYSTEM_ERROR,
118
+ suggestions: [
119
+ 'Choose a different project name',
120
+ 'Remove the existing directory',
121
+ 'Use a different target location'
122
+ ]
123
+ });
124
+ }
125
+ const templatePath = (0, node_path_1.join)(this.templatesPath, templateName);
126
+ try {
127
+ // Create target directory
128
+ (0, node_fs_1.mkdirSync)(options.targetDirectory, { recursive: true });
129
+ this.logger.debug(`Created target directory: ${options.targetDirectory}`);
130
+ // Prepare template variables
131
+ const variables = this.prepareTemplateVariables(options);
132
+ // Copy base template files with variable replacement
133
+ await this.copyTemplateFiles(templatePath, options.targetDirectory, variables);
134
+ // add components configuration to package.json
135
+ await this.updateComponentsConfig(options.targetDirectory, options.initialComponents);
136
+ // Process template application files if selected
137
+ if (options.templateApplications && options.templateApplications.length > 0) {
138
+ await this.processApplicationsTemplates(options.targetDirectory, variables, options.templateApplications);
139
+ }
140
+ this.logger.info(`Project generated successfully at: ${options.targetDirectory}`);
141
+ }
142
+ catch (error) {
143
+ this.logger.error('Failed to generate project:', error);
144
+ throw new error_handler_1.CLIError('Failed to generate project from template', {
145
+ code: error_handler_1.ErrorCode.FILE_SYSTEM_ERROR,
146
+ cause: error,
147
+ suggestions: [
148
+ 'Check write permissions for the target directory',
149
+ 'Ensure sufficient disk space is available',
150
+ 'Try running with --verbose for more details'
151
+ ]
152
+ });
153
+ }
154
+ }
155
+ /** Add a new template application to an already created seed project */
156
+ async addTemplateApplication(appName) {
157
+ this.logger.info(`Adding template application: ${appName}`);
158
+ const config = config_service_1.ConfigManager.config;
159
+ // Implementation goes here
160
+ const variables = this.prepareTemplateVariables({
161
+ productSlug: config.productSlug,
162
+ productName: config.productName,
163
+ company: config.company,
164
+ copyright: config.copyright,
165
+ version: config.version,
166
+ folderName: config.productSlug,
167
+ targetDirectory: path_1.PathUtils.getRootDir(),
168
+ templateApplications: [appName],
169
+ initialComponents: []
170
+ });
171
+ await this.processApplicationsTemplates('./', variables, [appName]);
172
+ this.logger.info(`Template application ${appName} added successfully`);
173
+ }
174
+ /** Adds initialComponents to the iocd.cli.config.json -> components.list object in the target directory */
175
+ updateComponentsConfig(targetDirectory, initialComponents) {
176
+ const configPath = (0, node_path_1.join)(targetDirectory, 'iocd.cli.config.json');
177
+ this.logger.debug(`Updating components configuration in ${configPath} to include:`, initialComponents);
178
+ if (!(0, node_fs_1.existsSync)(configPath)) {
179
+ this.logger.warn(`iocd.cli.config.json not found in target directory, skipping components configuration`);
180
+ return;
181
+ }
182
+ const configContent = (0, node_fs_1.readFileSync)(configPath, 'utf-8');
183
+ const config = JSON.parse(configContent);
184
+ // Ensure the components structure exists
185
+ if (!config.components) {
186
+ config.components = {};
187
+ }
188
+ if (!config.components.list) {
189
+ config.components.list = {};
190
+ }
191
+ // Add initial components, avoiding duplicates
192
+ for (const component of initialComponents) {
193
+ config.components.list[component] = "latest";
194
+ }
195
+ // write back the updated config
196
+ (0, node_fs_1.writeFileSync)(configPath, JSON.stringify(config, null, 2), 'utf-8');
197
+ this.logger.debug(`Updated components configuration in iocd.cli.config.json`);
198
+ }
199
+ /**
200
+ * Prepare template variables for replacement
201
+ */
202
+ prepareTemplateVariables(options) {
203
+ return [
204
+ {
205
+ key: '{{PRODUCT_NAME}}',
206
+ value: options.productName,
207
+ description: 'The product name for the application'
208
+ },
209
+ {
210
+ key: '{{FOLDER_NAME}}',
211
+ value: options.folderName,
212
+ description: 'The folder name for the project'
213
+ },
214
+ {
215
+ key: '{{PRODUCT_SLUG}}',
216
+ value: this.generatePackageName(options.productSlug),
217
+ description: 'NPM-compatible package name'
218
+ },
219
+ {
220
+ key: '{{FEATURES}}',
221
+ value: JSON.stringify(options.templateApplications || []),
222
+ description: 'Selected features array'
223
+ },
224
+ {
225
+ key: '{{YEAR}}',
226
+ value: new Date().getFullYear().toString(),
227
+ description: 'Current year'
228
+ }
229
+ ];
230
+ }
231
+ /**
232
+ * Generate NPM-compatible package name from product name
233
+ */
234
+ generatePackageName(productName) {
235
+ return productName
236
+ .toLowerCase()
237
+ .replace(/[^a-z0-9-]/g, '-')
238
+ .replace(/-+/g, '-')
239
+ .replace(/^-|-$/g, '');
240
+ }
241
+ /**
242
+ * Recursively copy template files with variable replacement
243
+ */
244
+ async copyTemplateFiles(sourcePath, targetPath, variables) {
245
+ const items = (0, node_fs_1.readdirSync)(sourcePath, { withFileTypes: true });
246
+ for (const item of items) {
247
+ const sourceItemPath = (0, node_path_1.join)(sourcePath, item.name);
248
+ const targetItemPath = (0, node_path_1.join)(targetPath, item.name);
249
+ // Skip template.json files - they are metadata for the template system
250
+ if (item.isFile() && item.name === 'template.json') {
251
+ continue;
252
+ }
253
+ if (item.isDirectory()) {
254
+ // Create directory and recurse
255
+ (0, node_fs_1.mkdirSync)(targetItemPath, { recursive: true });
256
+ await this.copyTemplateFiles(sourceItemPath, targetItemPath, variables);
257
+ }
258
+ else if (item.isFile()) {
259
+ // the logic here is to check the extension and only replace known text-based extensions
260
+ // the rest should be copied as-is (e.g. images, binaries), otherwise they may get corrupted
261
+ // the check is a bit complicated because of the .json.merge and .json.merge-<<suffix>> files
262
+ const ext = (0, node_path_1.extname)(sourceItemPath);
263
+ const allowedExtensions = ['.env', '.json', '.merge'];
264
+ const isAllowedExtension = allowedExtensions.some(e => ext.startsWith(e) || ext === e);
265
+ if (ext && isAllowedExtension) {
266
+ await this.copyFileWithReplacement(sourceItemPath, targetItemPath, variables);
267
+ }
268
+ else {
269
+ await this.copyFileNoReplacement(sourceItemPath, targetItemPath);
270
+ }
271
+ }
272
+ }
273
+ }
274
+ /**
275
+ * Copy a single file with variable replacement
276
+ */
277
+ async copyFileWithReplacement(sourcePath, targetPath, variables) {
278
+ const sourceContent = (0, node_fs_1.readFileSync)(sourcePath, 'utf-8');
279
+ // Replace template variables
280
+ let targetContent = sourceContent;
281
+ for (const variable of variables) {
282
+ const regex = new RegExp(this.escapeRegExp(variable.key), 'g');
283
+ targetContent = targetContent.replace(regex, variable.value);
284
+ }
285
+ (0, node_fs_1.writeFileSync)(targetPath, targetContent, 'utf-8');
286
+ this.logger.debug(`Copied and processed: ${(0, node_path_1.relative)(process.cwd(), targetPath)}`);
287
+ }
288
+ copyFileNoReplacement(source, destination) {
289
+ fs_extra_1.default.copyFile(source, destination);
290
+ }
291
+ /**
292
+ * Process feature-specific templates
293
+ */
294
+ async processApplicationsTemplates(targetPath, variables, applications) {
295
+ for (const application of applications) {
296
+ const featureTemplatePath = (0, node_path_1.join)(this.templatesPath, application);
297
+ if (!(0, node_fs_1.existsSync)(featureTemplatePath)) {
298
+ this.logger.warn(`Application template '${application}' not found in templates directory`);
299
+ continue;
300
+ }
301
+ // Verify it's a application template
302
+ const templateInfo = this.getTemplateInfo(application);
303
+ if (templateInfo.type !== 'application') {
304
+ this.logger.warn(`Template '${application}' is not a application template, skipping`);
305
+ continue;
306
+ }
307
+ this.logger.debug(`Processing application template: ${application}`);
308
+ await this.copyTemplateFiles(featureTemplatePath, targetPath, variables);
309
+ }
310
+ }
311
+ /**
312
+ * Escape special regex characters
313
+ */
314
+ escapeRegExp(string) {
315
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
316
+ }
317
+ /**
318
+ * Get template information
319
+ */
320
+ getTemplateInfo(templateName) {
321
+ const templatePath = (0, node_path_1.join)(this.templatesPath, templateName);
322
+ const templateInfoPath = (0, node_path_1.join)(templatePath, 'template.json');
323
+ if ((0, node_fs_1.existsSync)(templateInfoPath)) {
324
+ try {
325
+ return JSON.parse((0, node_fs_1.readFileSync)(templateInfoPath, 'utf-8'));
326
+ }
327
+ catch (error) {
328
+ this.logger.warn(`Failed to parse template.json for ${templateName}:`, error);
329
+ }
330
+ }
331
+ return {
332
+ name: templateName,
333
+ description: `${templateName} template`,
334
+ version: '1.0.0',
335
+ type: 'base' // Default fallback
336
+ };
337
+ }
338
+ /**
339
+ * Get available application templates with their metadata
340
+ */
341
+ getAvailableApplicationTemplates() {
342
+ const allTemplates = this.getAvailableTemplates();
343
+ const applicationTemplates = [];
344
+ for (const templateName of allTemplates) {
345
+ const templateInfo = this.getTemplateInfo(templateName);
346
+ if (templateInfo.type === 'application') {
347
+ applicationTemplates.push(templateInfo);
348
+ }
349
+ }
350
+ return applicationTemplates;
351
+ }
352
+ }
353
+ exports.TemplateService = TemplateService;
354
+ //# sourceMappingURL=template.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../src/services/template.service.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoD;AACpD,qCAOiB;AACjB,4CAAyC;AACzC,0DAA6D;AAC7D,wDAA0B;AAC1B,4DAAwD;AACxD,wCAA0C;AAiC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,eAAe;IAElB,MAAM,GAAG,eAAM,CAAC,WAAW,EAAE,CAAC;IAC9B,aAAa,CAAS;IAE9B;QACE,IAAI,CAAC,aAAa,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,qBAAqB;QAC1B,IAAI,CAAC;YACH,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC5E,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,IAAA,qBAAW,EAAC,IAAI,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBAC5D,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;iBACtC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YACtD,MAAM,IAAI,wBAAQ,CAAC,oCAAoC,EA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abilities to your io.Connect Desktop project.
4
+
5
+ ## Included Files
6
+
7
+ - `tests/basic.test.js` - Basic test structure using Playwright
8
+ - `playwright.config.js` - Playwright configuration file
9
+
10
+ ## Setup Instructions
11
+
12
+ After applying this template, you'll need to:
13
+
14
+ 1. Install Playwright dependencies:
15
+ ```bash
16
+ npm install @playwright/test
17
+ ```
18
+
19
+ 2. Install browsers:
20
+ ```bash
21
+ npx playwright install
22
+ ```
23
+
24
+ 3. Run tests:
25
+ ```bash
26
+ npx playwright test
27
+ ```
28
+
29
+ ## Test Structure
30
+
31
+ The template provides a basic test structure that you can extend based on your application's specific testing needs.
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ testDir: './tests',
3
+ timeout: 30000,
4
+ expect: {
5
+ timeout: 5000
6
+ },
7
+ use: {
8
+ browserName: 'chromium',
9
+ headless: false,
10
+ viewport: { width: 1280, height: 720 },
11
+ ignoreHTTPSErrors: true,
12
+ },
13
+ projects: [
14
+ {
15
+ name: 'chromium',
16
+ use: { browserName: 'chromium' },
17
+ },
18
+ ],
19
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "auto-tests",
3
+ "displayName": "Auto Tests",
4
+ "description": "Adds automated testing framework and test templates to io.Connect Desktop project",
5
+ "version": "1.0.0",
6
+ "type": "application",
7
+ "setupUI": {
8
+ "text": "Do you want to have auto-tests template?",
9
+ "separate": true,
10
+ "selected": true
11
+ }
12
+ }
@@ -0,0 +1,15 @@
1
+ const { test, expect } = require('@playwright/test');
2
+
3
+ test.describe('io.Connect Desktop Basic Tests', () => {
4
+ test('should launch application', async ({ page }) => {
5
+ // TODO: Implement application launch test
6
+ // This is a placeholder test structure
7
+ expect(true).toBe(true);
8
+ });
9
+
10
+ test('should handle window operations', async ({ page }) => {
11
+ // TODO: Implement window operations test
12
+ // This is a placeholder test structure
13
+ expect(true).toBe(true);
14
+ });
15
+ });
@@ -0,0 +1,29 @@
1
+ ###
2
+ # Windows Code Signing Options
3
+ ###
4
+ # PFX Code Signing Options, WIN_CODE_SIGNING_TYPE must be set to 'pfx'
5
+ WIN_PFX_PATH=
6
+ WIN_PFX_PASS=
7
+
8
+ # WinCert Code Signing Options, WIN_CODE_SIGNING_TYPE must be set to 'wincert'
9
+ WIN_CERT_SUBJECT=
10
+
11
+ # S/MIME Code Signing Options, WIN_CODE_SIGNING_TYPE must be set to 'smime'
12
+ WIN_SMIME_CERTIFICATE_PATH=
13
+ WIN_SMIME_CERTIFICATE_PASSWORD=
14
+
15
+ # Custom Code Signing Options, WIN_CODE_SIGNING_TYPE must be set to 'custom'
16
+ WIN_CUSTOM_CODE_SIGNING=
17
+
18
+ # Timestamping server URL (optional, defaults to DigiCert)
19
+ TSA_URL=http://timestamp.digicert.com
20
+
21
+ # Sign all binaries (exe, dll) for better SmartScreen reputation (optional, defaults to false)
22
+ SIGN_ALL_BINARIES=true
23
+
24
+ ###
25
+ # MacOS Notarization Options
26
+ ###
27
+ MAC_NOTARIZATION_APPLE_ID=
28
+ MAC_NOTARIZATION_APPLE_ID_PASSWORD=
29
+ MAC_NOTARIZATION_APPLE_TEAM_ID=
@@ -0,0 +1,170 @@
1
+ # Desktop Application Installer Build
2
+ name: Build Installers
3
+
4
+ on:
5
+ push:
6
+ branches: [ main, master, develop ]
7
+ tags: [ 'v*.*.*' ]
8
+ pull_request:
9
+ branches: [ main, master ]
10
+ workflow_dispatch:
11
+ inputs:
12
+ version:
13
+ description: 'Version to build (optional)'
14
+ required: false
15
+ default: ''
16
+
17
+ env:
18
+ NODE_VERSION: '18'
19
+
20
+ jobs:
21
+ build-windows:
22
+ runs-on: windows-latest
23
+ timeout-minutes: 30
24
+
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Setup Node.js ${{ env.NODE_VERSION }}
30
+ uses: actions/setup-node@v4
31
+ with:
32
+ node-version: ${{ env.NODE_VERSION }}
33
+ cache: 'npm'
34
+
35
+ - name: Install dependencies
36
+ run: npm ci
37
+
38
+ - name: Prepare build environment
39
+ run: |
40
+ npm run setup
41
+
42
+ - name: Build Windows installer
43
+ run: npm run make-installer
44
+ env:
45
+ # Code signing environment variables (configure in repository secrets)
46
+ WIN_PFX_PATH: ${{ secrets.WIN_PFX_PATH }}
47
+ WIN_PFX_PASS: ${{ secrets.WIN_PFX_PASS }}
48
+ WIN_CERT_SUBJECT: ${{ secrets.WIN_CERT_SUBJECT }}
49
+ WIN_SMIME_CERTIFICATE_PATH: ${{ secrets.WIN_SMIME_CERTIFICATE_PATH }}
50
+ WIN_SMIME_CERTIFICATE_PASSWORD: ${{ secrets.WIN_SMIME_CERTIFICATE_PASSWORD }}
51
+
52
+ - name: List build artifacts
53
+ run: |
54
+ Write-Host "Build artifacts in dist folder:"
55
+ if (Test-Path "dist") {
56
+ Get-ChildItem -Recurse dist | ForEach-Object { Write-Host $_.FullName }
57
+ } else {
58
+ Write-Host "No dist folder found"
59
+ }
60
+ shell: pwsh
61
+
62
+ - name: Upload Windows installer
63
+ uses: actions/upload-artifact@v4
64
+ with:
65
+ name: windows-installer
66
+ path: |
67
+ dist/**/*.exe
68
+ dist/**/*.msi
69
+ dist/**/*.zip
70
+ if-no-files-found: error
71
+
72
+
73
+ build-macos:
74
+ runs-on: macos-latest
75
+ timeout-minutes: 30
76
+
77
+ steps:
78
+ - name: Checkout code
79
+ uses: actions/checkout@v4
80
+
81
+ - name: Setup Node.js ${{ env.NODE_VERSION }}
82
+ uses: actions/setup-node@v4
83
+ with:
84
+ node-version: ${{ env.NODE_VERSION }}
85
+ cache: 'npm'
86
+
87
+ - name: Install dependencies
88
+ run: npm ci
89
+
90
+ - name: Prepare build environment
91
+ run: |
92
+ npm run setup
93
+
94
+ - name: Import Code-Signing Certificate (if available)
95
+ if: ${{ secrets.MAC_CERT_P12_BASE64 != '' }}
96
+ uses: apple-actions/import-codesign-certs@v2
97
+ with:
98
+ p12-file-base64: ${{ secrets.MAC_CERT_P12_BASE64 }}
99
+ p12-password: ${{ secrets.MAC_CERT_P12_PASSWORD }}
100
+
101
+ - name: Build macOS installer
102
+ run: npm run make-installer
103
+ env:
104
+ # Code signing and notarization environment variables (configure in repository secrets)
105
+ APPLE_ID: ${{ secrets.APPLE_ID }}
106
+ APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
107
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
108
+ MAC_CERT_NAME: ${{ secrets.MAC_CERT_NAME }}
109
+ OSX_NOTARIZE: ${{ secrets.OSX_NOTARIZE }}
110
+
111
+ - name: List build artifacts
112
+ run: |
113
+ echo "Build artifacts in dist folder:"
114
+ if [ -d "dist" ]; then
115
+ find dist -type f -name "*.dmg" -o -name "*.pkg" -o -name "*.zip" | head -20
116
+ else
117
+ echo "No dist folder found"
118
+ fi
119
+
120
+ - name: Upload macOS installer
121
+ uses: actions/upload-artifact@v4
122
+ with:
123
+ name: macos-installer
124
+ path: |
125
+ dist/**/*.dmg
126
+ dist/**/*.pkg
127
+ dist/**/*.zip
128
+ if-no-files-found: error
129
+ retention-days: 30
130
+
131
+ # Create GitHub release when a version tag is pushed
132
+ create-release:
133
+ if: startsWith(github.ref, 'refs/tags/v')
134
+ needs: [build-windows, build-macos]
135
+ runs-on: ubuntu-latest
136
+
137
+ steps:
138
+ - name: Checkout code
139
+ uses: actions/checkout@v4
140
+
141
+ - name: Download Windows installer
142
+ uses: actions/download-artifact@v4
143
+ with:
144
+ name: windows-installer
145
+ path: ./installers/windows/
146
+
147
+ - name: Download macOS installer
148
+ uses: actions/download-artifact@v4
149
+ with:
150
+ name: macos-installer
151
+ path: ./installers/macos/
152
+
153
+ - name: List all downloaded files
154
+ run: |
155
+ echo "Windows installers:"
156
+ find ./installers/windows/ -type f 2>/dev/null || echo "No Windows files"
157
+ echo "macOS installers:"
158
+ find ./installers/macos/ -type f 2>/dev/null || echo "No macOS files"
159
+
160
+ - name: Create GitHub Release
161
+ uses: softprops/action-gh-release@v1
162
+ with:
163
+ files: |
164
+ ./installers/windows/*
165
+ ./installers/macos/*
166
+ generate_release_notes: true
167
+ draft: false
168
+ prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') || contains(github.ref, 'rc') }}
169
+ env:
170
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File without changes
File without changes