@equinor/fusion-framework-cli 11.0.0-next.15 → 11.0.0-next.16

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 (212) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/bin/build/bin.mjs +1 -0
  3. package/bin/build/cli.mjs +7 -0
  4. package/bin/build/create-auth-client-Ds0jZb_X.js +1 -0
  5. package/bin/build/index-DZEz5jYv.js +1 -0
  6. package/bin/cli.mjs +1 -1
  7. package/dist/esm/lib/app/app-config.js.map +1 -1
  8. package/dist/esm/lib/app/app-manifest.js.map +1 -1
  9. package/dist/esm/lib/app/app-package.js +1 -1
  10. package/dist/esm/lib/app/app-package.js.map +1 -1
  11. package/dist/esm/lib/app/merge-app-config.js +11 -5
  12. package/dist/esm/lib/app/merge-app-config.js.map +1 -1
  13. package/dist/esm/lib/app/merge-app-manifest.js +2 -2
  14. package/dist/esm/lib/app/merge-app-manifest.js.map +1 -1
  15. package/dist/esm/lib/index.js +3 -1
  16. package/dist/esm/lib/index.js.map +1 -1
  17. package/dist/esm/lib/merge-dev-server-config.js +2 -20
  18. package/dist/esm/lib/merge-dev-server-config.js.map +1 -1
  19. package/dist/esm/lib/portal/create-portal-manifest.js.map +1 -1
  20. package/dist/esm/lib/portal/load-portal-manifest.js +2 -2
  21. package/dist/esm/lib/portal/load-portal-manifest.js.map +1 -1
  22. package/dist/esm/lib/portal/load-portal-schema.js.map +1 -1
  23. package/dist/esm/lib/utils/index.js +1 -0
  24. package/dist/esm/lib/utils/index.js.map +1 -1
  25. package/dist/esm/lib/utils/resolve-annotations.js +2 -2
  26. package/dist/esm/lib/utils/resolve-annotations.js.map +1 -1
  27. package/dist/esm/lib/utils/resolve-devops-annotations.js +2 -2
  28. package/dist/esm/lib/utils/resolve-devops-annotations.js.map +1 -1
  29. package/dist/esm/lib/utils/resolve-git-commit-sha.js +1 -0
  30. package/dist/esm/lib/utils/resolve-git-commit-sha.js.map +1 -1
  31. package/dist/esm/lib/utils/resolve-github-annotations.js +2 -2
  32. package/dist/esm/lib/utils/resolve-github-annotations.js.map +1 -1
  33. package/dist/esm/version.js +1 -1
  34. package/dist/types/bin/app-build.d.ts +2 -2
  35. package/dist/types/bin/app-check.d.ts +2 -2
  36. package/dist/types/bin/app-config-publish.d.ts +2 -2
  37. package/dist/types/bin/app-config.d.ts +3 -3
  38. package/dist/types/bin/app-dev.d.ts +1 -1
  39. package/dist/types/bin/app-manifest.d.ts +3 -3
  40. package/dist/types/bin/app-pack.d.ts +1 -1
  41. package/dist/types/bin/app-tag.d.ts +2 -2
  42. package/dist/types/bin/app-upload.d.ts +2 -2
  43. package/dist/types/bin/helpers/load-vite-config.d.ts +1 -2
  44. package/dist/types/bin/helpers/resolve-app-config.d.ts +3 -3
  45. package/dist/types/bin/helpers/resolve-app-manifest.d.ts +3 -3
  46. package/dist/types/bin/helpers/resolve-portal-config.d.ts +3 -3
  47. package/dist/types/bin/helpers/resolve-portal-manifest.d.ts +3 -4
  48. package/dist/types/bin/helpers/resolve-project-package.d.ts +2 -2
  49. package/dist/types/bin/index.d.ts +9 -0
  50. package/dist/types/bin/pack.d.ts +1 -1
  51. package/dist/types/bin/portal-build.d.ts +5 -5
  52. package/dist/types/bin/portal-config-publish.d.ts +2 -2
  53. package/dist/types/bin/portal-config.d.ts +4 -4
  54. package/dist/types/bin/portal-dev.d.ts +2 -2
  55. package/dist/types/bin/portal-manifest.d.ts +4 -4
  56. package/dist/types/bin/portal-pack.d.ts +3 -3
  57. package/dist/types/bin/portal-tag.d.ts +2 -2
  58. package/dist/types/bin/portal-upload.d.ts +2 -2
  59. package/dist/types/bin/utils/create-dev-server.d.ts +1 -1
  60. package/dist/types/cli/main.d.ts +0 -20
  61. package/dist/types/cli/options/env.d.ts +1 -2
  62. package/dist/types/lib/app/app-config.d.ts +2 -2
  63. package/dist/types/lib/app/app-manifest.d.ts +1 -1
  64. package/dist/types/lib/app/merge-app-config.d.ts +1 -1
  65. package/dist/types/lib/app/merge-app-manifest.d.ts +1 -1
  66. package/dist/types/lib/index.d.ts +3 -2
  67. package/dist/types/lib/legacy.d.ts +1 -1
  68. package/dist/types/lib/merge-dev-server-config.d.ts +1 -1
  69. package/dist/types/lib/portal/create-portal-manifest.d.ts +1 -1
  70. package/dist/types/lib/portal/load-portal-manifest.d.ts +1 -1
  71. package/dist/types/lib/portal/load-portal-schema.d.ts +1 -1
  72. package/dist/types/lib/portal/portal-config.d.ts +1 -1
  73. package/dist/types/lib/portal/portal-manifest.schema.d.ts +6 -6
  74. package/dist/types/lib/utils/index.d.ts +1 -0
  75. package/dist/types/lib/utils/resolve-devops-annotations.d.ts +2 -2
  76. package/dist/types/lib/utils/resolve-git-commit-sha.d.ts +1 -0
  77. package/dist/types/lib/utils/resolve-github-annotations.d.ts +2 -2
  78. package/dist/types/version.d.ts +1 -1
  79. package/package.json +45 -23
  80. package/bin/build/bin.js +0 -28
  81. package/bin/build/cli.js +0 -10099
  82. package/bin/build/create-auth-client-CUsaZifS.js +0 -1415
  83. package/bin/build/portal-config-publish-8-d0BD44.js +0 -29623
  84. package/dist/esm/bin/app-build.js +0 -34
  85. package/dist/esm/bin/app-build.js.map +0 -1
  86. package/dist/esm/bin/app-check.js +0 -63
  87. package/dist/esm/bin/app-check.js.map +0 -1
  88. package/dist/esm/bin/app-config-publish.js +0 -89
  89. package/dist/esm/bin/app-config-publish.js.map +0 -1
  90. package/dist/esm/bin/app-config.js +0 -48
  91. package/dist/esm/bin/app-config.js.map +0 -1
  92. package/dist/esm/bin/app-dev.js +0 -102
  93. package/dist/esm/bin/app-dev.js.map +0 -1
  94. package/dist/esm/bin/app-manifest.js +0 -38
  95. package/dist/esm/bin/app-manifest.js.map +0 -1
  96. package/dist/esm/bin/app-pack.js +0 -51
  97. package/dist/esm/bin/app-pack.js.map +0 -1
  98. package/dist/esm/bin/app-tag.js +0 -89
  99. package/dist/esm/bin/app-tag.js.map +0 -1
  100. package/dist/esm/bin/app-upload.js +0 -109
  101. package/dist/esm/bin/app-upload.js.map +0 -1
  102. package/dist/esm/bin/helpers/load-bundle-metadata.js +0 -32
  103. package/dist/esm/bin/helpers/load-bundle-metadata.js.map +0 -1
  104. package/dist/esm/bin/helpers/load-vite-config.js +0 -55
  105. package/dist/esm/bin/helpers/load-vite-config.js.map +0 -1
  106. package/dist/esm/bin/helpers/resolve-app-config.js +0 -46
  107. package/dist/esm/bin/helpers/resolve-app-config.js.map +0 -1
  108. package/dist/esm/bin/helpers/resolve-app-manifest.js +0 -55
  109. package/dist/esm/bin/helpers/resolve-app-manifest.js.map +0 -1
  110. package/dist/esm/bin/helpers/resolve-portal-config.js +0 -46
  111. package/dist/esm/bin/helpers/resolve-portal-config.js.map +0 -1
  112. package/dist/esm/bin/helpers/resolve-portal-manifest.js +0 -55
  113. package/dist/esm/bin/helpers/resolve-portal-manifest.js.map +0 -1
  114. package/dist/esm/bin/helpers/resolve-project-package.js +0 -32
  115. package/dist/esm/bin/helpers/resolve-project-package.js.map +0 -1
  116. package/dist/esm/bin/index.js +0 -12
  117. package/dist/esm/bin/index.js.map +0 -1
  118. package/dist/esm/bin/pack.js +0 -70
  119. package/dist/esm/bin/pack.js.map +0 -1
  120. package/dist/esm/bin/portal-build.js +0 -40
  121. package/dist/esm/bin/portal-build.js.map +0 -1
  122. package/dist/esm/bin/portal-config-publish.js +0 -74
  123. package/dist/esm/bin/portal-config-publish.js.map +0 -1
  124. package/dist/esm/bin/portal-config.js +0 -48
  125. package/dist/esm/bin/portal-config.js.map +0 -1
  126. package/dist/esm/bin/portal-dev.js +0 -61
  127. package/dist/esm/bin/portal-dev.js.map +0 -1
  128. package/dist/esm/bin/portal-manifest.js +0 -38
  129. package/dist/esm/bin/portal-manifest.js.map +0 -1
  130. package/dist/esm/bin/portal-pack.js +0 -60
  131. package/dist/esm/bin/portal-pack.js.map +0 -1
  132. package/dist/esm/bin/portal-tag.js +0 -96
  133. package/dist/esm/bin/portal-tag.js.map +0 -1
  134. package/dist/esm/bin/portal-upload.js +0 -99
  135. package/dist/esm/bin/portal-upload.js.map +0 -1
  136. package/dist/esm/bin/utils/ConsoleLogger.js +0 -112
  137. package/dist/esm/bin/utils/ConsoleLogger.js.map +0 -1
  138. package/dist/esm/bin/utils/create-dev-server.js +0 -171
  139. package/dist/esm/bin/utils/create-dev-server.js.map +0 -1
  140. package/dist/esm/bin/utils/format.js +0 -47
  141. package/dist/esm/bin/utils/format.js.map +0 -1
  142. package/dist/esm/bin/utils/index.js +0 -5
  143. package/dist/esm/bin/utils/index.js.map +0 -1
  144. package/dist/esm/bin/utils/spinner.js +0 -142
  145. package/dist/esm/bin/utils/spinner.js.map +0 -1
  146. package/dist/esm/cli/commands/app/alias.js +0 -42
  147. package/dist/esm/cli/commands/app/alias.js.map +0 -1
  148. package/dist/esm/cli/commands/app/build.js +0 -53
  149. package/dist/esm/cli/commands/app/build.js.map +0 -1
  150. package/dist/esm/cli/commands/app/check.js +0 -57
  151. package/dist/esm/cli/commands/app/check.js.map +0 -1
  152. package/dist/esm/cli/commands/app/config.js +0 -103
  153. package/dist/esm/cli/commands/app/config.js.map +0 -1
  154. package/dist/esm/cli/commands/app/dev.js +0 -67
  155. package/dist/esm/cli/commands/app/dev.js.map +0 -1
  156. package/dist/esm/cli/commands/app/index.js +0 -42
  157. package/dist/esm/cli/commands/app/index.js.map +0 -1
  158. package/dist/esm/cli/commands/app/manifest.js +0 -82
  159. package/dist/esm/cli/commands/app/manifest.js.map +0 -1
  160. package/dist/esm/cli/commands/app/pack.js +0 -71
  161. package/dist/esm/cli/commands/app/pack.js.map +0 -1
  162. package/dist/esm/cli/commands/app/publish.js +0 -130
  163. package/dist/esm/cli/commands/app/publish.js.map +0 -1
  164. package/dist/esm/cli/commands/app/tag.js +0 -113
  165. package/dist/esm/cli/commands/app/tag.js.map +0 -1
  166. package/dist/esm/cli/commands/app/upload.js +0 -85
  167. package/dist/esm/cli/commands/app/upload.js.map +0 -1
  168. package/dist/esm/cli/commands/auth/index.js +0 -22
  169. package/dist/esm/cli/commands/auth/index.js.map +0 -1
  170. package/dist/esm/cli/commands/auth/login.js +0 -72
  171. package/dist/esm/cli/commands/auth/login.js.map +0 -1
  172. package/dist/esm/cli/commands/auth/logout.js +0 -58
  173. package/dist/esm/cli/commands/auth/logout.js.map +0 -1
  174. package/dist/esm/cli/commands/auth/token.js +0 -78
  175. package/dist/esm/cli/commands/auth/token.js.map +0 -1
  176. package/dist/esm/cli/commands/disco/index.js +0 -6
  177. package/dist/esm/cli/commands/disco/index.js.map +0 -1
  178. package/dist/esm/cli/commands/disco/resolve.js +0 -58
  179. package/dist/esm/cli/commands/disco/resolve.js.map +0 -1
  180. package/dist/esm/cli/commands/index.js +0 -11
  181. package/dist/esm/cli/commands/index.js.map +0 -1
  182. package/dist/esm/cli/commands/portal/build.js +0 -27
  183. package/dist/esm/cli/commands/portal/build.js.map +0 -1
  184. package/dist/esm/cli/commands/portal/config.js +0 -101
  185. package/dist/esm/cli/commands/portal/config.js.map +0 -1
  186. package/dist/esm/cli/commands/portal/dev.js +0 -27
  187. package/dist/esm/cli/commands/portal/dev.js.map +0 -1
  188. package/dist/esm/cli/commands/portal/index.js +0 -23
  189. package/dist/esm/cli/commands/portal/index.js.map +0 -1
  190. package/dist/esm/cli/commands/portal/manifest.js +0 -48
  191. package/dist/esm/cli/commands/portal/manifest.js.map +0 -1
  192. package/dist/esm/cli/commands/portal/pack.js +0 -40
  193. package/dist/esm/cli/commands/portal/pack.js.map +0 -1
  194. package/dist/esm/cli/commands/portal/publish.js +0 -76
  195. package/dist/esm/cli/commands/portal/publish.js.map +0 -1
  196. package/dist/esm/cli/commands/portal/schema.js +0 -70
  197. package/dist/esm/cli/commands/portal/schema.js.map +0 -1
  198. package/dist/esm/cli/commands/portal/tag.js +0 -73
  199. package/dist/esm/cli/commands/portal/tag.js.map +0 -1
  200. package/dist/esm/cli/commands/portal/upload.js +0 -41
  201. package/dist/esm/cli/commands/portal/upload.js.map +0 -1
  202. package/dist/esm/cli/main.js +0 -52
  203. package/dist/esm/cli/main.js.map +0 -1
  204. package/dist/esm/cli/options/auth.js +0 -96
  205. package/dist/esm/cli/options/auth.js.map +0 -1
  206. package/dist/esm/cli/options/env.js +0 -30
  207. package/dist/esm/cli/options/env.js.map +0 -1
  208. package/dist/esm/lib/framework.node.js +0 -104
  209. package/dist/esm/lib/framework.node.js.map +0 -1
  210. package/dist/esm/version.js.map +0 -1
  211. package/dist/tsconfig.tsbuildinfo +0 -1
  212. /package/dist/types/{lib → bin}/framework.node.d.ts +0 -0
@@ -1,109 +0,0 @@
1
- import chalk from 'chalk';
2
- import AdmZip from 'adm-zip';
3
- import { loadMetadata } from './helpers/load-bundle-metadata.js';
4
- /**
5
- * Uploads an application bundle to the app service for publishing or updating an app.
6
- *
7
- * This function loads the bundle, resolves the app key (from argument or metadata),
8
- * reads the bundle content, and uploads it to the app service. Handles and logs errors
9
- * for common failure scenarios, including HTTP status codes and bundle reading issues.
10
- *
11
- * @param opt - Options for bundle file, app key, framework, and logger.
12
- * @returns The response from the app service, or an empty object if the response cannot be parsed.
13
- * @throws If bundle reading or upload fails, or if the app service returns an error status.
14
- * @public
15
- */
16
- export const uploadApplication = async (opt) => {
17
- const { log, framework } = opt;
18
- // Load the bundle from file or use the provided AdmZip instance
19
- const bundle = typeof opt.fileOrBundle === 'string' ? new AdmZip(opt.fileOrBundle) : opt.fileOrBundle;
20
- // Resolve the application key from argument or bundle metadata
21
- const { name } = opt.appKey
22
- ? { name: opt.appKey }
23
- : await loadMetadata(bundle).catch((error) => {
24
- log?.error('Failed to resolve manifest:', error);
25
- process.exit(1);
26
- });
27
- // Read the bundle content as a buffer
28
- const content = await bundle.toBufferPromise().catch((error) => {
29
- log?.error('Failed to read bundle content:', error);
30
- process.exit(1);
31
- });
32
- try {
33
- // Create a client for the 'apps' service
34
- const appClient = await framework.serviceDiscovery.createClient('apps');
35
- // Subscribe to outgoing requests for logging and debugging
36
- appClient.request$.subscribe((request) => {
37
- log?.info('🌎', 'Executing request to:', request.uri);
38
- log?.debug('Request:', request);
39
- });
40
- // Upload the bundle as a zip file to the app service
41
- const response = await appClient.fetch(`/bundles/apps/${name}`, {
42
- method: 'POST',
43
- body: new Blob([content], {
44
- type: 'application/zip',
45
- }),
46
- headers: {
47
- 'Content-Type': 'application/zip',
48
- },
49
- });
50
- // Handle non-OK responses with detailed error logging
51
- if (!response.ok) {
52
- try {
53
- const { error } = await response.json();
54
- log?.debug('Error:', error);
55
- if (error.message) {
56
- log?.warn(chalk.red(`🤯 error: ${error.code}\n`), chalk.yellowBright(error.message), '\n');
57
- }
58
- }
59
- catch (e) {
60
- log?.debug('Error:', response.statusText);
61
- }
62
- // Handle specific HTTP status codes for user-friendly error messages
63
- if (response.status === 409) {
64
- log?.fail(`🤬 - ${response.status} - `, 'Version is already published, please generate a new release');
65
- process.exit(1);
66
- }
67
- if (response.status === 410) {
68
- log?.fail(`🤬 - ${response.status} - `, 'Application is removed from Fusion app store, please check Application Admin');
69
- process.exit(1);
70
- }
71
- if (response.status === 404) {
72
- log?.fail(`🤬 - ${response.status} - `, 'Application not found, please add your application in App Admin before publishing');
73
- process.exit(1);
74
- }
75
- if (response.status === 401 || response.status === 403) {
76
- log?.fail(`🤬 - ${response.status} - `, 'This is not allowed for this role on this app');
77
- process.exit(1);
78
- }
79
- if (response.status === 500) {
80
- log?.fail(`🤬 - ${response.status} - `, 'Internal server error, please try again later or contact support');
81
- process.exit(1);
82
- }
83
- // Throw for any other error status
84
- throw new Error(`Failed to upload bundle. HTTP status ${response.status}, ${response.statusText}`);
85
- }
86
- // Log and return the successful response
87
- log?.succeed('Successfully uploaded application bundle');
88
- log?.debug('Response:', response);
89
- try {
90
- const result = await response.json();
91
- return {
92
- name,
93
- version: result.version,
94
- };
95
- }
96
- catch (error) {
97
- throw new Error(`Failed to parse response from app service: ${error instanceof Error ? error.message : error}`);
98
- }
99
- }
100
- catch (error) {
101
- // Log and exit on any error during upload
102
- log?.fail('🙅‍♂️', 'Failed to upload application bundle');
103
- log?.error(error);
104
- process.exit(1);
105
- }
106
- };
107
- // Export as default for compatibility with import patterns
108
- export default uploadApplication;
109
- //# sourceMappingURL=app-upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-upload.js","sourceRoot":"","sources":["../../../src/bin/app-upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AA0BjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,GAA6B,EAI5B,EAAE;IACH,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC;IAE/B,gEAAgE;IAChE,MAAM,MAAM,GACV,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;IAEzF,+DAA+D;IAC/D,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM;QACzB,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;QACtB,CAAC,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACzC,GAAG,EAAE,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IAEP,sCAAsC;IACtC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7D,GAAG,EAAE,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACl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CAAyC;QACzC,GAAG,EAAE,OAAO,CAAC,0CAA0C,CAAC,CAAC;QACzD,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAO,QAAQ,CAAC,IAAI,EAAmC,CAAC;YACvE,OAAO;gBACL,IAAI;gBACJ,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,8CAA8C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAC/F,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0CAA0C;QAC1C,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,qCAAqC,CAAC,CAAC;QAC1D,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,2DAA2D;AAC3D,eAAe,iBAAiB,CAAC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Loads the metadata from a bundle zip file.
3
- * @param bundle - The AdmZip instance representing the bundle.
4
- * @returns A promise resolving to an object containing name and version.
5
- * @throws If metadata.json is missing or cannot be parsed.
6
- */
7
- export const loadMetadata = (bundle) => {
8
- // Attempt to retrieve the metadata.json entry from the zip bundle
9
- const metadataEntry = bundle.getEntry('metadata.json');
10
- if (!metadataEntry) {
11
- // If not found, throw an error
12
- throw new Error('Metadata file not found in bundle');
13
- }
14
- // Read the metadata entry asynchronously
15
- return new Promise((resolve, reject) => {
16
- metadataEntry.getDataAsync((data, err) => {
17
- if (err) {
18
- // Reject if reading the file fails
19
- return reject(new Error('Failed to read metadata file', { cause: err }));
20
- }
21
- try {
22
- // Parse the metadata as JSON and resolve
23
- return resolve(JSON.parse(String(data)));
24
- }
25
- catch (error) {
26
- // Reject if parsing fails
27
- reject(new Error('Failed to parse metadata file', { cause: error }));
28
- }
29
- });
30
- });
31
- };
32
- //# sourceMappingURL=load-bundle-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-bundle-metadata.js","sourceRoot":"","sources":["../../../../src/bin/helpers/load-bundle-metadata.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAA2B,EAAE;IACtE,kEAAkE;IAClE,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+BAA+B;QAC/B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,yCAAyC;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACvC,IAAI,GAAG,EAAE,CAAC;gBACR,mCAAmC;gBACnC,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,8BAA8B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;YAC3E,CAAC;YACD,IAAI,CAAC;gBACH,yCAAyC;gBACzC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,0BAA0B;gBAC1B,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACvE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import { loadConfigFromFile, mergeConfig } from 'vite';
2
- import { basename, dirname, extname } from 'node:path';
3
- import { resolveEntryPoint } from '../../lib/utils';
4
- /**
5
- * Loads and merges the Vite configuration for a given package and environment.
6
- * Throws errors if the output directory is invalid (root or src).
7
- *
8
- * @param env - The runtime environment (mode, etc).
9
- * @param pkg - The resolved package information.
10
- * @returns The merged Vite UserConfig object.
11
- */
12
- export const loadViteConfig = async (env, pkg) => {
13
- const { packageJson, root } = pkg;
14
- // Load local Vite config file if present
15
- const { config: localViteConfig } = (await loadConfigFromFile(env)) ?? {};
16
- // Determine output file and entrypoint
17
- const outFile = packageJson.main ?? packageJson.module ?? './dist/bundle.js';
18
- const entrypoint = resolveEntryPoint(root);
19
- // Prevent output directory from being the project root
20
- if (dirname(outFile) === root) {
21
- throw new Error('outDir cannot be root, please specify package.main or package.module in package.json');
22
- }
23
- // Prevent output directory from being the src directory
24
- if (dirname(outFile) === 'src') {
25
- throw new Error('outDir cannot be src, please specify package.main or package.module in package.json');
26
- }
27
- // Prevent output directory from being the current working directory
28
- if (dirname(outFile) === process.cwd()) {
29
- throw new Error('outDir cannot be the current working directory, please specify package.main or package.module in package.json');
30
- }
31
- // Merge default and local Vite configs
32
- return mergeConfig({
33
- root: root,
34
- define: {
35
- // Set environment variables for the build
36
- 'process.env.NODE_ENV': JSON.stringify(env.mode),
37
- 'process.env.NODE_DEBUG': env.mode !== 'production',
38
- // todo - remove in future update
39
- 'process.env.FUSION_LOG_LEVEL': env.mode === 'production' ? 1 : 3,
40
- },
41
- build: {
42
- outDir: dirname(outFile),
43
- lib: {
44
- entry: entrypoint,
45
- fileName: basename(outFile, extname(outFile)),
46
- formats: ['es'],
47
- },
48
- emptyOutDir: true,
49
- },
50
- // @todo - custom logger
51
- }, localViteConfig ?? {});
52
- };
53
- // Export as default for convenience
54
- export default loadViteConfig;
55
- //# sourceMappingURL=load-vite-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-vite-config.js","sourceRoot":"","sources":["../../../../src/bin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,GAAG,CAAC,IAAI,CAAC;YAChD,wBAAwB,EAAE,GAAG,CAAC,IAAI,KAAK,YAAY;YACnD,iCAAiC;YACjC,8BAA8B,EAAE,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAClE;QACD,KAAK,EAAE;YACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC;YACxB,GAAG,EAAE;gBACH,KAAK,EAAE,UAAU;gBACjB,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC7C,OAAO,EAAE,CAAC,IAAI,CAAC;aAChB;YACD,WAAW,EAAE,IAAI;SAClB;QACD,wBAAwB;KACJ,EACtB,eAAe,IAAI,EAAE,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,oCAAoC;AACpC,eAAe,cAAc,CAAC"}
@@ -1,46 +0,0 @@
1
- import { FileNotFoundError } from '@equinor/fusion-imports';
2
- import { chalk, formatPath } from '../utils/format.js';
3
- import { loadAppConfig } from '../../lib/app';
4
- /**
5
- * Resolves the application configuration based on the provided runtime environment and options.
6
- * Handles logging, error reporting, and fallback to built-in config if no local config is found.
7
- *
8
- * @param env - The runtime environment containing the command and mode information.
9
- * @param options - Optional parameters:
10
- * - config: Path to a specific configuration file.
11
- * - log: Logger utility for progress and status messages.
12
- * @returns A promise resolving to the loaded application configuration.
13
- * @throws If the application configuration cannot be resolved.
14
- */
15
- export const resolveAppConfig = async (env, options) => {
16
- const { log } = options;
17
- try {
18
- // Start logging the config creation process
19
- log?.start('create application configuration');
20
- log?.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
21
- // Attempt to load the application config (from file if specified)
22
- const result = await loadAppConfig(env, { file: options?.config });
23
- // Log success and show the config file path
24
- log?.succeed('⚙️ generated config from ', formatPath(result.path, { relative: true }));
25
- return result.config;
26
- }
27
- catch (err) {
28
- // Handle missing config file error
29
- if (err instanceof FileNotFoundError) {
30
- if (options.config) {
31
- // Warn if a specific config file was requested but not found
32
- log?.warn(`failed to load config file ${formatPath(options.config)}, please check the path.`);
33
- }
34
- else {
35
- // Fallback to built-in config if no local config is present
36
- log?.succeed(chalk.dim('⚙️ no local application config applied, using built-in'));
37
- return { environment: {} };
38
- }
39
- }
40
- // Log failure and debug information for other errors
41
- log?.fail('failed to resolve application config');
42
- log?.debug(err);
43
- throw err;
44
- }
45
- };
46
- //# sourceMappingURL=resolve-app-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-app-config.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-app-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAqB,MAAM,eAAe,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,GAAe,EACf,OAAwD,EACjC,EAAE;IACzB,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,IAAI,CAAC;QACH,4CAA4C;QAC5C,GAAG,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC/C,GAAG,EAAE,IAAI,CACP,0BAA0B,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CACpG,CAAC;QACF,kEAAkE;QAClE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,4CAA4C;QAC5C,GAAG,EAAE,OAAO,CAAC,2BAA2B,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,mCAAmC;QACnC,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,6DAA6D;gBAC7D,GAAG,EAAE,IAAI,CACP,8BAA8B,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,0BAA0B,CACnF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,4DAA4D;gBAC5D,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC,CAAC;gBAClF,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,qDAAqD;QACrD,GAAG,EAAE,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAClD,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAChB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import { FileNotFoundError } from '@equinor/fusion-imports';
2
- import { loadAppManifest, createAppManifestFromPackage } from '../../lib/app';
3
- import { chalk, formatPath } from '../utils/format.js';
4
- /**
5
- * Resolves the application manifest for a given package and environment.
6
- * Attempts to load a manifest file if specified, otherwise falls back to generating a manifest from package.json.
7
- * Handles logging for progress, success, and error states.
8
- *
9
- * @param env - The runtime environment context.
10
- * @param pkg - The resolved package information.
11
- * @param options - Optional logger and manifest path.
12
- * @returns The resolved application manifest object.
13
- * @throws If the manifest file is explicitly requested but not found, or if another error occurs.
14
- */
15
- export const resolveAppManifest = async (env, pkg, options) => {
16
- // Generate a base manifest from the package.json as a fallback/default.
17
- const baseManifest = createAppManifestFromPackage(env, pkg.packageJson);
18
- try {
19
- // Attempt to load the manifest file, if provided.
20
- options?.log?.start('loading application package...');
21
- const { manifest, path } = await loadAppManifest(env, {
22
- base: baseManifest,
23
- file: options?.manifestPath,
24
- });
25
- if (!manifest.build) {
26
- throw new Error(`Application manifest for ${manifest.appKey} does not contain build information, please check the manifest file.`);
27
- }
28
- if (env.command === 'serve') {
29
- // Only set assetPath when not building for production
30
- // This helps with local development and preview environments
31
- manifest.build.assetPath = `/bundles/apps/${manifest.appKey}/${manifest.build.version}`;
32
- }
33
- // Successfully loaded manifest from file.
34
- options?.log?.succeed('generated manifest from', formatPath(path, { relative: true }));
35
- return manifest;
36
- }
37
- catch (err) {
38
- // Handle missing manifest file scenario.
39
- if (err instanceof FileNotFoundError) {
40
- if (options?.manifestPath) {
41
- // Manifest file was explicitly requested but not found.
42
- const error = new Error(`Failed to load manifest file ${formatPath(options.manifestPath)}, please check the path.`, { cause: err });
43
- options?.log?.fail(error.message);
44
- throw error;
45
- }
46
- // No manifest file specified; fallback to base manifest.
47
- options?.log?.succeed(chalk.dim('no local manifest config applied, using default generated from package'));
48
- return baseManifest;
49
- }
50
- // Unexpected error occurred during manifest resolution.
51
- options?.log?.fail(`failed to resolve application manifest ${options?.manifestPath ? formatPath(options?.manifestPath) : ''}`);
52
- throw err;
53
- }
54
- };
55
- //# sourceMappingURL=resolve-app-manifest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-app-manifest.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-app-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAG9E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,GAAe,EACf,GAAoB,EACpB,OAGC,EACD,EAAE;IACF,wEAAwE;IACxE,MAAM,YAAY,GAAG,4BAA4B,CAAC,GA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D,yDAAyD;YACzD,OAAO,EAAE,GAAG,EAAE,OAAO,CACnB,KAAK,CAAC,GAAG,CAAC,wEAAwE,CAAC,CACpF,CAAC;YACF,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,wDAAwD;QACxD,OAAO,EAAE,GAAG,EAAE,IAAI,CAChB,0CACE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAC9D,EAAE,CACH,CAAC;QACF,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
@@ -1,46 +0,0 @@
1
- import { FileNotFoundError } from '@equinor/fusion-imports';
2
- import { chalk, formatPath } from '../utils/format.js';
3
- import { loadPortalConfig } from '../../lib/portal';
4
- /**
5
- * Resolves the portal configuration based on the provided runtime environment and options.
6
- * Handles logging, error reporting, and fallback to built-in config if no local config is found.
7
- *
8
- * @param env - The runtime environment containing the command and mode information.
9
- * @param options - Optional parameters:
10
- * - config: Path to a specific configuration file.
11
- * - log: Logger utility for progress and status messages.
12
- * @returns A promise resolving to the loaded portal configuration.
13
- * @throws If the portal configuration cannot be resolved.
14
- */
15
- export const resolvePortalConfig = async (env, options) => {
16
- const { log } = options;
17
- try {
18
- // Start logging the config creation process
19
- log?.start('create portal configuration');
20
- log?.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
21
- // Attempt to load the portal config (from file if specified)
22
- const result = await loadPortalConfig(env, { file: options?.config });
23
- // Log success and show the config file path
24
- log?.succeed('⚙️ generated config from ', formatPath(result.path, { relative: true }));
25
- return result.config;
26
- }
27
- catch (err) {
28
- // Handle missing config file error
29
- if (err instanceof FileNotFoundError) {
30
- if (options.config) {
31
- // Warn if a specific config file was requested but not found
32
- log?.warn(`failed to load config file ${formatPath(options.config)}, please check the path.`);
33
- }
34
- else {
35
- // Fallback to built-in config if no local config is present
36
- log?.succeed(chalk.dim('⚙️ no local portal config applied, using built-in'));
37
- return {};
38
- }
39
- }
40
- // Log failure and debug information for other errors
41
- log?.fail('failed to resolve portal config');
42
- log?.debug(err);
43
- throw err;
44
- }
45
- };
46
- //# sourceMappingURL=resolve-portal-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-portal-config.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-portal-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,GAAe,EACf,OAAwD,EAC5C,EAAE;IACd,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,IAAI,CAAC;QACH,4CAA4C;QAC5C,GAAG,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC1C,GAAG,EAAE,IAAI,CACP,0BAA0B,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CACpG,CAAC;QACF,6DAA6D;QAC7D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAI,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACzE,4CAA4C;QAC5C,GAAG,EAAE,OAAO,CAAC,2BAA2B,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,mCAAmC;QACnC,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,6DAA6D;gBAC7D,GAAG,EAAE,IAAI,CACP,8BAA8B,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,0BAA0B,CACnF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,4DAA4D;gBAC5D,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC,CAAC;gBAC7E,OAAO,EAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,qDAAqD;QACrD,GAAG,EAAE,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC7C,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAChB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import { FileNotFoundError } from '@equinor/fusion-imports';
2
- import { chalk, formatPath } from '../utils/format.js';
3
- import { createPortalManifestFromPackage, loadPortalManifest, } from '../../lib/portal';
4
- /**
5
- * Resolves the portal manifest for a given runtime environment and package.
6
- *
7
- * This function attempts to load a portal manifest, optionally merging it with a base manifest
8
- * generated from the provided package's package.json. If a manifest file is not found and a
9
- * manifest path was specified, an error is thrown. Otherwise, it falls back to the base manifest.
10
- * Logging is performed at various stages if a logger is provided.
11
- *
12
- * @typeParam T - The shape of the portal manifest, extending Partial<PortalManifest>.
13
- * @param env - The runtime environment context.
14
- * @param pkg - The resolved package containing package.json metadata.
15
- * @param options - Optional parameters.
16
- * @param options.log - Optional logger for progress and error reporting.
17
- * @param options.manifestPath - Optional path to a specific manifest file.
18
- * @param options.base - Optional base manifest to merge with the loaded manifest.
19
- * @returns A promise that resolves to the loaded or generated portal manifest.
20
- * @throws {Error} If the manifest file is not found at the specified path or if another error occurs during loading.
21
- */
22
- export const resolvePortalManifest = async (env, pkg, options) => {
23
- // Generate a base manifest from the package.json as a fallback/default
24
- const baseManifest = createPortalManifestFromPackage(env, pkg.packageJson);
25
- try {
26
- // Log the start of the manifest loading process, if logger is provided
27
- options?.log?.start('loading manifest...');
28
- // Attempt to load the portal manifest, merging with the base manifest
29
- const importResult = await loadPortalManifest(env, { base: baseManifest });
30
- // Log success with the path of the loaded/generated manifest
31
- options?.log?.succeed('generated manifest from', formatPath(importResult.path, { relative: true }));
32
- // Return the loaded or generated manifest
33
- return importResult.manifest;
34
- }
35
- catch (err) {
36
- // Handle the case where the manifest file is not found
37
- if (err instanceof FileNotFoundError) {
38
- // If a specific manifest path was requested, treat as an error
39
- if (options?.manifestPath) {
40
- const error = new Error(`Failed to load manifest file ${formatPath(options.manifestPath)}, please check the path.`, { cause: err });
41
- // Log the failure and rethrow the error
42
- options?.log?.fail(error.message);
43
- throw error;
44
- }
45
- // If no manifest path was specified, fall back to the base manifest and log this outcome
46
- options?.log?.succeed(chalk.dim('no local manifest config applied, using default generated from package'));
47
- return baseManifest;
48
- }
49
- // Log any other errors encountered during manifest resolution
50
- options?.log?.fail(`failed to resolve application manifest ${options?.manifestPath ? formatPath(options?.manifestPath) : ''}`);
51
- // Rethrow the error for upstream handling
52
- throw err;
53
- }
54
- };
55
- //# sourceMappingURL=resolve-portal-manifest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-portal-manifest.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-portal-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,GAAe,EACf,GAAoB,EACpB,OAIC,EACD,EAAE;IACF,uEAAuE;IACvE,MAAM,YAAY,GAAG,+BAA+B,CAAC,GAAG,EAAE,GAAG,CAAC,W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C;AACH,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { chalk } from '../utils/format.js';
2
- import { resolvePackage } from '../../lib/utils';
3
- /**
4
- * Resolves the application package by fetching its metadata and logging relevant information.
5
- *
6
- * This function uses a logger to provide feedback during the resolution process.
7
- * It retrieves the package's packageJson and root directory, logs the results, and handles errors gracefully.
8
- *
9
- * @param log - Logger instance for progress and status updates.
10
- * @returns A promise that resolves to the package information, including its packageJson and root directory.
11
- * @throws Will throw an error if the package resolution fails.
12
- */
13
- export async function resolveProjectPackage(log) {
14
- // Start the logging for package resolution
15
- log?.start('resolve project package');
16
- try {
17
- // Attempt to resolve the package (find package.json and root)
18
- const pkg = await resolvePackage();
19
- // Log success with package name and version
20
- log?.succeed('📦', chalk.yellowBright([pkg.packageJson.name, pkg.packageJson.version].join('@')));
21
- // Log the root directory of the package
22
- log?.info('🏠', chalk.blueBright(pkg.root));
23
- return pkg;
24
- }
25
- catch (error) {
26
- // Log failure if package resolution fails
27
- log?.fail('☠️', 'failed to resolve project package');
28
- throw error;
29
- }
30
- }
31
- export default resolveProjectPackage;
32
- //# sourceMappingURL=resolve-project-package.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-project-package.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-project-package.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAA0B;IACpE,2CAA2C;IAC3C,GAAG,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACtC,IAAI,CAAC;QACH,8DAA8D;QAC9D,MAAM,GAAG,GAAG,MAAM,cAAc,EAAE,CAAC;QACnC,4CAA4C;QAC5C,GAAG,EAAE,OAAO,CACV,IAAI,EACJ,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAC9E,CAAC;QACF,wCAAwC;QACxC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0CAA0C;QAC1C,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;QACrD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,12 +0,0 @@
1
- export { buildApplication } from './app-build.js';
2
- export { bundleApp } from './app-pack.js';
3
- export { generateApplicationConfig } from './app-config.js';
4
- export { publishAppConfig } from './app-config-publish.js';
5
- export { startAppDevServer } from './app-dev.js';
6
- export { buildPortal } from './portal-build.js';
7
- export { bundlePortal } from './portal-pack.js';
8
- export { loadPortalManifest } from './portal-manifest.js';
9
- export { generatePortalConfig } from './portal-config.js';
10
- export { publishPortalConfig } from './portal-config-publish.js';
11
- export { pack } from './pack.js';
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
@@ -1,70 +0,0 @@
1
- import AdmZip from 'adm-zip';
2
- import { dirname, resolve } from 'node:path';
3
- import { mkdir, stat } from 'node:fs/promises';
4
- import { formatByteSize, formatPath, chalk } from './utils';
5
- import { fileExistsSync } from '../lib/utils';
6
- /* Files to add to zip package */
7
- const addFiles = ['package.json', 'LICENSE.md', 'README.md', 'CHANGELOG.md'];
8
- /**
9
- * Packages an application build directory and additional files into a zip archive.
10
- *
11
- * This function validates the build directory, adds build output and standard files (e.g., package.json, README.md),
12
- * and optionally writes the archive to disk. It supports adding extra content and provides detailed logging.
13
- *
14
- * @param pkg - The resolved package info from package.json.
15
- * @param options - Packaging options including build directory, archive path, logger, and extra content.
16
- * @returns The AdmZip instance representing the created archive.
17
- * @throws If the build directory does not exist or writing the archive fails.
18
- * @public
19
- */
20
- export const pack = async (pkg, options) => {
21
- const { archive, log } = options ?? {};
22
- // Resolve the path to the package root and build directory
23
- const pkgPath = dirname(pkg.path);
24
- const buildDir = options?.buildDir ?? 'dist';
25
- const buildDirPath = resolve(pkgPath, buildDir);
26
- // Ensure the build directory exists and is a directory
27
- if (!(await stat(buildDirPath)).isDirectory()) {
28
- throw new Error(`Build directory ${buildDir} does not exist`);
29
- }
30
- log?.log(chalk.bold('Starting to pack bundle'));
31
- // Create a new zip archive
32
- const bundle = new AdmZip();
33
- // Add the build directory to the archive under its own folder
34
- bundle.addLocalFolder(buildDirPath, buildDir);
35
- // Add any additional content provided in options
36
- if (options?.content) {
37
- for (const [name, data] of Object.entries(options.content)) {
38
- bundle.addFile(name, Buffer.from(data));
39
- log?.info('📄', formatPath(name, { relative: true }));
40
- }
41
- }
42
- log?.info('📂', formatPath(buildDirPath, { relative: true }));
43
- // Add standard files and any files listed in package.json 'files' array
44
- for (const file of addFiles.concat(pkg.packageJson.files ?? [])) {
45
- const filePath = resolve(pkgPath, file);
46
- const fileDir = dirname(filePath.replace(pkgPath, ''));
47
- if (fileExistsSync(filePath)) {
48
- bundle.addLocalFile(filePath, fileDir);
49
- log?.info('📄', formatPath(filePath, { relative: true }));
50
- }
51
- else {
52
- log?.warn(chalk.dim('📄', formatPath(filePath, { relative: true })));
53
- }
54
- }
55
- // If an archive path is provided, write the zip file to disk
56
- if (archive) {
57
- // Ensure the output directory exists
58
- if (!fileExistsSync(dirname(archive))) {
59
- await mkdir(dirname(archive), { recursive: true });
60
- }
61
- log?.start('compressing content');
62
- await bundle.writeZipPromise(archive);
63
- log?.succeed('📚', formatPath(archive, { relative: true }), formatByteSize(archive));
64
- }
65
- // Return the AdmZip instance for further use or testing
66
- return bundle;
67
- };
68
- // Export as default for compatibility with import patterns
69
- export default pack;
70
- //# sourceMappingURL=pack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack.js","sourceRoot":"","sources":["../../../src/bin/pack.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAI7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAsB,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,iCAAiC;AACjC,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAsB7E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,GAAgB,EAAE,OAAiB,EAAmB,EAAE;IACjF,MAAM,EAAE,OAA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AEF,2DAA2D;AAC3D,eAAe,IAAI,CAAC"}
@@ -1,40 +0,0 @@
1
- import { build as viteBuild } from 'vite';
2
- import { chalk } from './utils';
3
- import { loadViteConfig } from './helpers/load-vite-config.js';
4
- import { loadPortalManifest } from './portal-manifest.js';
5
- /**
6
- * Builds a portal application using Vite.
7
- *
8
- * This function loads the portal manifest, applies Vite configuration, and runs the Vite build process.
9
- * It provides detailed logging for each step and returns the package info, manifest, and output directory.
10
- *
11
- * @param opt - Build options including environment, manifest path, and logger.
12
- * @returns An object containing the package info, manifest, and output directory.
13
- * @throws If the build process fails or configuration is invalid.
14
- * @public
15
- */
16
- export const buildPortal = async (opt) => {
17
- const { log } = opt ?? {};
18
- // Log the start of the portal build process
19
- log?.log(chalk.bold('Starting to build portal'));
20
- // Load the portal manifest, package info, and environment variables
21
- const { manifest, pkg, env } = await loadPortalManifest({ log, manifest: opt?.manifest });
22
- log?.start('loading vite config...');
23
- // Load local Vite configuration for the build
24
- const viteConfig = await loadViteConfig(env, pkg);
25
- log?.succeed('vite config applied');
26
- log?.debug('vite config:', viteConfig);
27
- log?.start('🤞🏻', 'building portal...');
28
- // Capture native console output during the build
29
- log?.startNativeConsoleCapture();
30
- await viteBuild(viteConfig);
31
- log?.stopNativeConsoleCapture();
32
- log?.succeed('build completed 😘');
33
- // Output directory for the built portal
34
- const outDir = viteConfig.build.outDir;
35
- // Return the package info, manifest, and output directory for further use
36
- return { pkg, manifest, outDir };
37
- };
38
- // Export as default for compatibility with import patterns
39
- export default buildPortal;
40
- //# sourceMappingURL=portal-build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"portal-build.js","sourceRoot":"","sources":["../../../src/bin/portal-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,EAAsB,KAAK,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,O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