@equinor/fusion-framework-cli 9.12.14 → 10.0.0-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237

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 (88) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/README.md +31 -9
  3. package/dist/bin/bundle-application.js +3 -2
  4. package/dist/bin/bundle-application.js.map +1 -1
  5. package/dist/bin/create-dev-serve.js +84 -113
  6. package/dist/bin/create-dev-serve.js.map +1 -1
  7. package/dist/bin/create-export-config.js +68 -6
  8. package/dist/bin/create-export-config.js.map +1 -1
  9. package/dist/bin/create-export-manifest.js +3 -4
  10. package/dist/bin/create-export-manifest.js.map +1 -1
  11. package/dist/bin/dev-portal/config.js +6 -2
  12. package/dist/bin/dev-portal/config.js.map +1 -1
  13. package/dist/bin/main.app.js +42 -1
  14. package/dist/bin/main.app.js.map +1 -1
  15. package/dist/bin/main.js +2 -3
  16. package/dist/bin/main.js.map +1 -1
  17. package/dist/bin/plugins/app-proxy.js +137 -0
  18. package/dist/bin/plugins/app-proxy.js.map +1 -0
  19. package/dist/bin/plugins/external-public.js +67 -0
  20. package/dist/bin/plugins/external-public.js.map +1 -0
  21. package/dist/bin/public/assets/{index-D2ohTVV3.js → index-BF2-imeq.js} +407 -407
  22. package/dist/bin/public/index.html +1 -1
  23. package/dist/bin/publish-application.js +102 -0
  24. package/dist/bin/publish-application.js.map +1 -0
  25. package/dist/bin/tag-application.js +80 -0
  26. package/dist/bin/tag-application.js.map +1 -0
  27. package/dist/bin/upload-application.js +69 -0
  28. package/dist/bin/upload-application.js.map +1 -0
  29. package/dist/bin/utils/{execute-commant.js → execute-command.js} +1 -1
  30. package/dist/bin/utils/{execute-commant.js.map → execute-command.js.map} +1 -1
  31. package/dist/bin/utils/format.js +1 -1
  32. package/dist/bin/utils/format.js.map +1 -1
  33. package/dist/bin/utils/getEndpointUrl.js +49 -0
  34. package/dist/bin/utils/getEndpointUrl.js.map +1 -0
  35. package/dist/bin/utils/index.js +14 -0
  36. package/dist/bin/utils/index.js.map +1 -0
  37. package/dist/bin/utils/isAppRegistered.js +30 -0
  38. package/dist/bin/utils/isAppRegistered.js.map +1 -0
  39. package/dist/bin/utils/load-manifest.js +7 -3
  40. package/dist/bin/utils/load-manifest.js.map +1 -1
  41. package/dist/bin/utils/proxy-request-logger.js +34 -0
  42. package/dist/bin/utils/proxy-request-logger.js.map +1 -0
  43. package/dist/bin/utils/publishAppConfig.js +34 -0
  44. package/dist/bin/utils/publishAppConfig.js.map +1 -0
  45. package/dist/bin/utils/requireToken.js +10 -0
  46. package/dist/bin/utils/requireToken.js.map +1 -0
  47. package/dist/bin/utils/tagAppBundle.js +33 -0
  48. package/dist/bin/utils/tagAppBundle.js.map +1 -0
  49. package/dist/bin/utils/uploadAppBundle.js +52 -0
  50. package/dist/bin/utils/uploadAppBundle.js.map +1 -0
  51. package/dist/lib/app-config.js.map +1 -1
  52. package/dist/lib/app-manifest.js +35 -11
  53. package/dist/lib/app-manifest.js.map +1 -1
  54. package/dist/lib/app-package.js +55 -6
  55. package/dist/lib/app-package.js.map +1 -1
  56. package/dist/lib/index.js +1 -1
  57. package/dist/lib/index.js.map +1 -1
  58. package/dist/lib/vite-config.js +1 -3
  59. package/dist/lib/vite-config.js.map +1 -1
  60. package/dist/types/bin/create-export-config.d.ts +6 -2
  61. package/dist/types/bin/create-export-manifest.d.ts +1 -8
  62. package/dist/types/bin/plugins/app-proxy.d.ts +70 -0
  63. package/dist/types/bin/plugins/external-public.d.ts +22 -0
  64. package/dist/types/bin/publish-application.d.ts +6 -0
  65. package/dist/types/bin/tag-application.d.ts +12 -0
  66. package/dist/types/bin/upload-application.d.ts +6 -0
  67. package/dist/types/bin/utils/getEndpointUrl.d.ts +10 -0
  68. package/dist/types/bin/utils/index.d.ts +14 -0
  69. package/dist/types/bin/utils/isAppRegistered.d.ts +7 -0
  70. package/dist/types/bin/utils/load-app-config.d.ts +1 -1
  71. package/dist/types/bin/utils/load-manifest.d.ts +2 -1
  72. package/dist/types/bin/utils/proxy-request-logger.d.ts +15 -0
  73. package/dist/types/bin/utils/publishAppConfig.d.ts +9 -0
  74. package/dist/types/bin/utils/requireToken.d.ts +4 -0
  75. package/dist/types/bin/utils/tagAppBundle.d.ts +7 -0
  76. package/dist/types/bin/utils/uploadAppBundle.d.ts +7 -0
  77. package/dist/types/lib/app-config.d.ts +1 -6
  78. package/dist/types/lib/app-manifest.d.ts +16 -20
  79. package/dist/types/lib/app-package.d.ts +35 -4
  80. package/dist/types/lib/index.d.ts +2 -2
  81. package/package.json +26 -31
  82. package/dist/bin/dev-proxy.js +0 -82
  83. package/dist/bin/dev-proxy.js.map +0 -1
  84. package/dist/index.js +0 -13
  85. package/dist/index.js.map +0 -1
  86. package/dist/types/bin/dev-proxy.d.ts +0 -27
  87. package/dist/types/index.d.ts +0 -4
  88. /package/dist/types/bin/utils/{execute-commant.d.ts → execute-command.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,149 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237
4
+
5
+ ### Major Changes
6
+
7
+ - [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`9debd8c`](https://github.com/equinor/fusion-framework/commit/9debd8ccd73d30d6249d3b50a3b62aa3d658beb4) Thanks [@eikeland](https://github.com/eikeland)! - # App management
8
+
9
+ Adding new commands for app management, `publish`, `upload` and `tag`.
10
+
11
+ Introduces new parameters to the `config` command for publishing the app config to a build version.
12
+
13
+ ## breaking changes
14
+
15
+ - This introduces braking changes to the `AppManifest` type. Apps-service is now returning instance of `ApplicationManifest` class.
16
+ - The app-config endpoints is now an object containing url and scopes, where name is the object key:
17
+
18
+ ```ts
19
+ environment: {
20
+ scope: 'foobar',
21
+ },
22
+ endpoints: {
23
+ api: {
24
+ url: 'https://foo.bars'
25
+ scopes: ['foobar']
26
+ },
27
+ },
28
+ ```
29
+
30
+ ### Minor Changes
31
+
32
+ - [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`8cb1d2a`](https://github.com/equinor/fusion-framework/commit/8cb1d2a40812986bfb0351dfb83ce6783d3f5a23) Thanks [@eikeland](https://github.com/eikeland)! - **@equinor/fusion-framework-cli:**
33
+
34
+ Create a plugin `externalPublicPlugin` to fix the issue with serving the `index.html` file from the specified external public directory. Vite mode `spa` will not serve the `index.html` file from the specified external public directory.
35
+
36
+ - Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
37
+ - Transformed the HTML using Vite's `transformIndexHtml` method.
38
+ - Applied appropriate content headers and additional configured headers before sending the response.
39
+
40
+ ```typescript
41
+ const viteConfig = {
42
+ roo
43
+ plugins: [
44
+ // path wich contains the index.html file
45
+ externalPublicPlugin('./my-portal'),
46
+ ],
47
+ };
48
+
49
+ const viteConfig = defineConfig({
50
+ // vite configuration
51
+ root: './src', // this where vite will look for the index.html file
52
+ plugins: [
53
+ // path which contains the index.html file
54
+ externalPublicPlugin('./my-portal'),
55
+ ],
56
+ });
57
+ ```
58
+
59
+ - [#2459](https://github.com/equinor/fusion-framework/pull/2459) [`15152e4`](https://github.com/equinor/fusion-framework/commit/15152e413c054a5f57af93211a470c98c7696caa) Thanks [@odinr](https://github.com/odinr)! - **@equinor/fusion-framework-cli**
60
+
61
+ Updated the CLI to use the new service discovery API.
62
+
63
+ > [!NOTE]
64
+ > This is a quick fix until the new major version of the CLI is released.
65
+
66
+ - Updated the `baseUri` to use a more specific URL path for service discovery.
67
+ - Changed from `new URL(import.meta.url).origin` to `String(new URL('/_discovery/environments/current', import.meta.url))`.
68
+ - Changed parsing of service discovery response to match new API format.
69
+
70
+ - [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`8fbdf00`](https://github.com/equinor/fusion-framework/commit/8fbdf000b6d8ed725ab21a7df2207d46fd904454) Thanks [@eikeland](https://github.com/eikeland)! - **@equinor/fusion-framework-cli**
71
+
72
+ The `appProxyPlugin` is a Vite plugin designed to proxy requests to a Fusion app backend.
73
+ It sets up proxy rules for API and bundle requests and serves the app configuration and manifest based on the app key and version.
74
+
75
+ Key Features:
76
+
77
+ 1. Proxy Configuration:
78
+
79
+ - Proxies API calls to the Fusion apps backend.
80
+ - Proxies bundle requests to the Fusion apps backend.
81
+ - Uses a base path `proxyPath` for proxying.
82
+ - Captures and reuses authorization tokens for asset requests.
83
+
84
+ 2. **App Configuration and Manifest**:
85
+
86
+ - Serves the app configuration if the request matches the current app and version.
87
+ - Serves the app manifest if the request matches the current app.
88
+
89
+ 3. **Middleware Setup**:
90
+ - Sets up middleware to handle requests for app configuration, manifest, and local bundles.
91
+
92
+ This plugin is used by the CLI for local development, but design as exportable for custom CLI to consume applications from other API`s
93
+
94
+ example configuration:
95
+
96
+ ```typescript
97
+ const viteConfig = defineConfig({
98
+ // vite configuration
99
+ plugins: [
100
+ appProxyPlugin({
101
+ proxy: {
102
+ path: '/app-proxy',
103
+ target: 'https://fusion-s-apps-ci.azurewebsites.net/',
104
+ // optional callback when matched request is proxied
105
+ onProxyReq: (proxyReq, req, res) => {
106
+ proxyReq.on('response', (res) => {
107
+ console.log(res.statusCode);
108
+ });
109
+ },
110
+ },
111
+ // optional, but required for serving local app configuration, manifest and resources
112
+ app: {
113
+ key: 'my-app',
114
+ version: '1.0.0',
115
+ generateConfig: async () => ({}),
116
+ generateManifest: async () => ({}),
117
+ },
118
+ }),
119
+ ],
120
+ });
121
+ ```
122
+
123
+ example usage:
124
+
125
+ ```typescript
126
+ // Example API calls
127
+ fetch('/app-proxy/apps/my-app/builds/1.0.0/config'); // local
128
+ fetch('/app-proxy/apps/my-app/builds/0.0.9/config'); // proxy
129
+ fetch('/app-proxy/apps/other-app/builds/1.0.0/config'); // proxy
130
+
131
+ // Example asset calls
132
+ fetch('/app-proxy/bundles/my-app/builds/1.0.0/index.js'); // local
133
+ fetch('/app-proxy/bundles/my-app/builds/0.0.9/index.js'); // proxy
134
+ ```
135
+
136
+ ### Patch Changes
137
+
138
+ - [#2462](https://github.com/equinor/fusion-framework/pull/2462) [`7f06955`](https://github.com/equinor/fusion-framework/commit/7f06955a641031bb11edddafe4bdd3d49c8d568b) Thanks [@odinr](https://github.com/odinr)! - **@equinor/fusion-framework-cli**
139
+
140
+ Introduced `proxyRequestLogger` to log proxy requests in the CLI.
141
+
142
+ - Show the request URL and method in the console when a proxy request is made.
143
+ - Show proxy response status code
144
+
145
+ - [#2458](https://github.com/equinor/fusion-framework/pull/2458) [`202cf10`](https://github.com/equinor/fusion-framework/commit/202cf10ae434d6432c8b57c2867b182223c19212) Thanks [@odinr](https://github.com/odinr)! - changed service discover url to match #c776845e753acf4a0bceda1c59d31e5939c44c31
146
+
3
147
  ## 9.12.14
4
148
 
5
149
  ### Patch Changes
package/README.md CHANGED
@@ -1,20 +1,42 @@
1
1
  ---
2
- title: usion Framework CLI
2
+ title: Fusion Framework CLI
3
3
  ---
4
4
 
5
- Node CLI utility for working with Fusion Applications
5
+ ### fusion-framework-cli
6
6
 
7
- ### [App](docs/app.md)
7
+ The cli, named `fusion-framework-cli`, containt tooling for running and managing your application in the terminal or in your package scripts.
8
8
 
9
- see [Configuration](docs/app-configuration.md)
9
+ The fusion-famework-cli should be installed as a devDependency.
10
10
 
11
- - tooling for [Vitest](https://vitest.dev/) - 🚀 coming soon
12
- - tooling for proxy configuration - 🚀 coming soon
11
+ ```sh
12
+ pnpm add -D @equinor/fusion-framework-cli
13
+ ```
13
14
 
14
- ### Widget
15
+ You can always use the option `-h or --help or help` to get help for the CLI and its commands.
16
+
17
+ Example:
18
+
19
+ ```sh
20
+ fusion-framework-cli help
21
+ ```
22
+
23
+ ### App Commands
24
+
25
+ See [App Commands](/cli/docs/commands.md)
26
+
27
+ ### Configuration
28
+
29
+ See [Configuration](/cli/docs/configuration.md)
30
+
31
+ ### Tooling
32
+
33
+ - tooling for [Vitest](https://vitest.dev/) - 🚀 coming soon
34
+ - tooling for proxy configuration - 🚀 coming soon
35
+
36
+ ### Widget
15
37
 
16
38
  Tooling for developing widgets - 🚀 coming soon
17
39
 
18
- ### Portal
40
+ ### Portal
19
41
 
20
- Tooling for developing portals - 🚀 coming
42
+ Tooling for developing portals - 🚀 coming
@@ -32,7 +32,8 @@ export const bundleApplication = (options) => __awaiter(void 0, void 0, void 0,
32
32
  spinner.info(`added ./package.json`);
33
33
  bundle.addLocalFolder(outDir);
34
34
  spinner.info(`added ./${outDir}`);
35
- const licenseFile = resolve(pkg.path, 'LICENSE.md');
35
+ const appDir = dirname(pkg.path);
36
+ const licenseFile = resolve(appDir, 'LICENSE.md');
36
37
  if (fileExistsSync(licenseFile)) {
37
38
  bundle.addLocalFile(licenseFile);
38
39
  spinner.info(`added ${licenseFile}`);
@@ -40,7 +41,7 @@ export const bundleApplication = (options) => __awaiter(void 0, void 0, void 0,
40
41
  else {
41
42
  spinner.warn(`missing ${licenseFile}`);
42
43
  }
43
- const readmeFile = resolve(pkg.path, 'README.md');
44
+ const readmeFile = resolve(appDir, 'README.md');
44
45
  if (fileExistsSync(readmeFile)) {
45
46
  bundle.addLocalFile(readmeFile);
46
47
  spinner.info(`added ${readmeFile}`);
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-application.js","sourceRoot":"","sources":["../../src/bin/bundle-application.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,E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7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { join } from 'node:path';
11
- import { readFileSync } from 'node:fs';
10
+ import { createServer, defineConfig, mergeConfig, } from 'vite';
12
11
  import { assert } from 'node:console';
13
- import { createServer } from 'vite';
14
- import ViteRestart from 'vite-plugin-restart';
12
+ import { join, relative } from 'node:path';
15
13
  import portFinder from 'portfinder';
16
- import { createDevProxy } from './dev-proxy.js';
14
+ import ViteRestart from 'vite-plugin-restart';
15
+ import { appProxyPlugin } from './plugins/app-proxy.js';
16
+ import { externalPublicPlugin } from './plugins/external-public.js';
17
+ import { supportedExt } from '../lib/utils/config.js';
18
+ import { manifestConfigFilename } from '../lib/app-manifest.js';
19
+ import { appConfigFilename } from '../lib/app-config.js';
20
+ import { resolveAppKey } from '../lib/app-package.js';
17
21
  import { loadAppConfig } from './utils/load-app-config.js';
18
22
  import { loadViteConfig } from './utils/load-vite-config.js';
19
- import { loadAppManifest } from './utils/load-manifest.js';
23
+ import { loadPackage } from './utils/load-package.js';
20
24
  import { Spinner } from './utils/spinner.js';
21
25
  import { chalk, formatPath } from './utils/format.js';
22
- import { supportedExt } from '../lib/utils/config.js';
23
- import { createManifest, manifestConfigFilename } from '../lib/app-manifest.js';
24
- import { appConfigFilename, createAppConfig } from '../lib/app-config.js';
25
- import { loadPackage } from './utils/load-package.js';
26
- import { rateLimit } from 'express-rate-limit';
26
+ import { loadAppManifest } from './utils/load-manifest.js';
27
+ import { proxyRequestLogger } from './utils/proxy-request-logger.js';
27
28
  export const createDevServer = (options) => __awaiter(void 0, void 0, void 0, function* () {
28
- var _a;
29
- const { configSourceFiles, library, portal, port, devPortalPath } = options;
29
+ var _a, _b, _c, _d;
30
+ const { configSourceFiles, library, port, devPortalPath } = options;
30
31
  const spinner = Spinner.Global({ prefixText: chalk.dim('dev-server') });
31
32
  const pkg = yield loadPackage();
32
- spinner.info(`using portal 🔌${formatPath(portal)} as proxy target`);
33
+ const appKey = resolveAppKey(pkg.packageJson);
33
34
  const env = {
34
35
  command: 'serve',
35
36
  mode: (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'development',
@@ -39,114 +40,84 @@ export const createDevServer = (options) => __awaiter(void 0, void 0, void 0, fu
39
40
  * Load application manifest
40
41
  * Application might have overridden the `appKey`
41
42
  */
42
- const manifest = yield loadAppManifest(env, pkg, { file: configSourceFiles.manifest });
43
- const { key: appKey } = manifest.manifest;
44
43
  spinner.info(`resolved application key ${chalk.magenta(appKey)}`);
45
- const { viteConfig, path: viteConfigPath } = yield loadViteConfig(env, {
44
+ const { viteConfig: baseViteConfig, path: viteConfigPath } = yield loadViteConfig(env, {
46
45
  file: configSourceFiles.vite,
47
46
  });
47
+ /**
48
+ * Defines the configuration for the development server.
49
+ */
50
+ const devServerConfig = defineConfig({
51
+ publicDir: devPortalPath,
52
+ appType: 'custom',
53
+ server: {
54
+ open: `/apps/${appKey}`,
55
+ port: port !== null && port !== void 0 ? port : (yield portFinder.getPortPromise({ port: 3000 })),
56
+ },
57
+ plugins: [
58
+ // Serve the dev portal as static files
59
+ externalPublicPlugin(devPortalPath),
60
+ // Proxy requests to the app server
61
+ appProxyPlugin({
62
+ proxy: {
63
+ path: '/apps-proxy',
64
+ target: 'https://fusion-s-apps-ci.azurewebsites.net/',
65
+ onProxyReq: proxyRequestLogger,
66
+ },
67
+ app: {
68
+ key: appKey,
69
+ version: String(pkg.packageJson.version),
70
+ generateConfig: () => __awaiter(void 0, void 0, void 0, function* () {
71
+ const { config } = yield loadAppConfig(env, pkg, {
72
+ file: configSourceFiles.app,
73
+ });
74
+ return config;
75
+ }),
76
+ generateManifest: () => __awaiter(void 0, void 0, void 0, function* () {
77
+ const { manifest } = yield loadAppManifest(env, pkg, {
78
+ file: configSourceFiles.manifest,
79
+ });
80
+ const assetPath = `bundles/apps/${appKey}/${pkg.packageJson.version}`;
81
+ // TODO: @eikeland we need to fix this
82
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
83
+ // @ts-ignore
84
+ return {
85
+ appKey,
86
+ build: Object.assign(Object.assign({}, manifest), { assetPath, configUrl: `${assetPath}/config` }),
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
+ };
89
+ }),
90
+ },
91
+ }),
92
+ // Restart the server when config changes or the dev portal source is updated
93
+ ViteRestart({
94
+ restart: [
95
+ 'package.json',
96
+ viteConfigPath,
97
+ join(relative(process.cwd(), devPortalPath), '/**/*'),
98
+ ].filter((x) => !!x),
99
+ /** reload the CLI when config changes, note change to APP-KEY need restart */
100
+ reload: [
101
+ ...supportedExt.map((ext) => [appConfigFilename, ext].join('')),
102
+ ...supportedExt.map((ext) => [manifestConfigFilename, ext].join('')),
103
+ ],
104
+ }),
105
+ ],
106
+ });
107
+ // Merge the base Vite config with the dev server config
108
+ const viteConfig = mergeConfig(devServerConfig, baseViteConfig);
48
109
  /** Add library/framework plugins */
49
110
  if (library === 'react') {
50
111
  const reactPlugin = yield import('@vitejs/plugin-react');
51
112
  viteConfig.plugins.push(reactPlugin.default());
52
113
  }
53
- viteConfig.plugins.push(ViteRestart({
54
- restart: ['package.json', viteConfigPath].filter((x) => !!x),
55
- /** reload the CLI when config changes, note change to APP-KEY need restart */
56
- reload: [
57
- ...supportedExt.map((ext) => [appConfigFilename, ext].join('')),
58
- ...supportedExt.map((ext) => [manifestConfigFilename, ext].join('')),
59
- ],
60
- }));
114
+ assert((_b = viteConfig.build) === null || _b === void 0 ? void 0 : _b.lib, 'expected vite build to have library defined');
115
+ const { entry } = viteConfig.build.lib;
116
+ spinner.info('💾 application entrypoint', formatPath(String(entry), { relative: true }));
117
+ spinner.info('resolving cli internal assets from', formatPath(String(viteConfig.publicDir), { relative: true }));
61
118
  const vite = yield createServer(Object.assign(Object.assign({}, env), viteConfig));
62
- assert(vite.config.build.lib, 'expected vite build to have library defined');
63
- const { entry } = vite.config.build.lib;
64
- spinner.info('💾 application entrypoint', formatPath(String(entry)));
65
- spinner.info('resolving cli internal assets from ', formatPath(devPortalPath));
66
- /** add proxy handlers */
67
- const server = createDevProxy({
68
- onConfigResponse: (slug, message, data) => __awaiter(void 0, void 0, void 0, function* () {
69
- if (slug.appKey === appKey) {
70
- if (message.statusCode === 404) {
71
- const { config: response, path } = yield loadAppConfig(env, pkg, {
72
- file: configSourceFiles.app,
73
- });
74
- return { response, path, statusCode: 200 };
75
- }
76
- else if (data) {
77
- const { config: response, path } = yield createAppConfig(env, data, {
78
- file: configSourceFiles.app,
79
- });
80
- path && spinner.info('created config from ', formatPath(path));
81
- return { response, path };
82
- }
83
- }
84
- }),
85
- onManifestResponse: (slug, message, data) => __awaiter(void 0, void 0, void 0, function* () {
86
- if (slug.appKey === appKey) {
87
- if (message.statusCode === 404) {
88
- const { manifest: response, path } = yield loadAppManifest(env, pkg, {
89
- file: configSourceFiles.manifest,
90
- });
91
- response.entry = `/${entry}`;
92
- return { response, path, statusCode: 200 };
93
- }
94
- else if (data) {
95
- const { manifest: response, path } = yield createManifest(env, data, {
96
- file: configSourceFiles.manifest,
97
- });
98
- response.entry = `/${entry}`;
99
- path && spinner.info('created manifest from ', formatPath(path));
100
- return { response, path };
101
- }
102
- }
103
- }),
104
- onManifestListResponse: (slug, message, data) => __awaiter(void 0, void 0, void 0, function* () {
105
- var _a;
106
- // TODO: Verify if we should always only return current app or all apps from API + current app.
107
- if (!data) {
108
- const { manifest, path } = yield loadAppManifest(env, pkg, {
109
- file: configSourceFiles.manifest,
110
- });
111
- manifest.entry = `/${entry}`;
112
- return { response: [manifest], path };
113
- }
114
- let path;
115
- const atIndex = (_a = data === null || data === void 0 ? void 0 : data.findIndex((manifest) => manifest.key === appKey)) !== null && _a !== void 0 ? _a : -1;
116
- // If existing app, we need to change the entry-point.
117
- if (atIndex > -1) {
118
- data[atIndex].entry = `/${entry}`;
119
- }
120
- else {
121
- const { manifest, path: manifestPath } = yield loadAppManifest(env, pkg, {
122
- file: configSourceFiles.manifest,
123
- });
124
- manifest.entry = `/${entry}`;
125
- path = manifestPath;
126
- data.push(manifest);
127
- }
128
- return { response: data, path };
129
- }),
130
- }, {
131
- target: portal,
132
- staticAssets: [{ path: devPortalPath }],
133
- });
134
- /** connect dev server to Vite */
135
- server.use(vite.middlewares);
136
- /** redirect all request that miss to index.html, SPA logic */
137
- server.use('*', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
138
- // TODO add check if file request
139
- const htmlRaw = readFileSync(join(devPortalPath + '/index.html'), 'utf-8');
140
- const html = yield vite.transformIndexHtml(req.url, htmlRaw);
141
- res.send(html);
142
- }), rateLimit({
143
- max: 10,
144
- }));
145
- /** use provided port or resolve available */
146
- const serverPort = port !== null && port !== void 0 ? port : (yield portFinder.getPortPromise({ port: 3000 }));
147
119
  spinner.start('🚀 start server');
148
- server.listen(serverPort);
149
- spinner.succeed();
150
- spinner.succeed('🔗', chalk.underline.green(new URL(`/apps/${appKey}`, `http://localhost:${serverPort}`).href));
120
+ yield vite.listen();
121
+ spinner.succeed('🔗', chalk.underline.green(new URL(`/apps/${appKey}`, (_d = (_c = vite.resolvedUrls) === null || _c === void 0 ? void 0 : _c.local[0]) !== null && _d !== void 0 ? _d : `https://localhost:/${vite.config.server.port}`).href));
151
122
  });
152
123
  //# sourceMappingURL=create-dev-serve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-dev-serve.js","sourceRoot":"","sources":["../../src/bin/create-dev-serve.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAkB,YAAY,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAE9C,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,C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AC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEzF,OAAO,CAAC,IAAI,CACR,oCAAoC,EACpC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC/D,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,YAAY,iCAAM,GAAG,GAAK,UAAU,EAAG,CAAC;IAE3D,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACjC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,OAAO,CACX,IAAI,EACJ,KAAK,CAAC,SAAS,CAAC,KAAK,CACjB,IAAI,GAAG,CACH,SAAS,MAAM,EAAE,EACjB,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,KAAK,CAAC,CAAC,CAAC,mCAAI,sBAAsB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CACjF,CAAC,IAAI,CACT,CACJ,CAAC;AACN,CAAC,CAAA,CAAC"}
@@ -10,22 +10,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import nodeFs from 'node:fs';
11
11
  import { writeFile } from 'node:fs/promises';
12
12
  import { dirname } from 'node:path';
13
+ import semverValid from 'semver/functions/valid.js';
13
14
  import { chalk, formatPath } from './utils/format.js';
14
15
  import { Spinner } from './utils/spinner.js';
15
- import { loadPackage } from './utils/load-package.js';
16
- import { loadAppConfig } from './utils/load-app-config.js';
16
+ import { getEndpointUrl, loadAppConfig, loadPackage, isAppRegistered, requireToken, publishAppConfig, } from './utils/index.js';
17
+ import { resolveAppKey } from '../lib/app-package.js';
18
+ import { exit } from 'node:process';
17
19
  export const createExportConfig = (options) => __awaiter(void 0, void 0, void 0, function* () {
18
20
  var _a;
19
- const { command = 'build', outputFile } = options !== null && options !== void 0 ? options : {};
21
+ const { command = 'build', outputFile, configFile, publish, env, service } = options;
20
22
  const spinner = Spinner.Global({ prefixText: chalk.dim('config') });
21
23
  const pkg = yield loadPackage();
22
- const env = {
24
+ const appKey = resolveAppKey(pkg.packageJson);
25
+ const appEnv = {
23
26
  command,
24
27
  mode: (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'development',
25
28
  root: pkg.root,
26
29
  };
27
- const { config } = yield loadAppConfig(env, pkg, {
28
- file: options === null || options === void 0 ? void 0 : options.configFile,
30
+ const { config } = yield loadAppConfig(appEnv, pkg, {
31
+ file: configFile,
29
32
  });
30
33
  if (outputFile) {
31
34
  spinner.start(`outputting config to ${formatPath(outputFile)}`);
@@ -45,6 +48,65 @@ export const createExportConfig = (options) => __awaiter(void 0, void 0, void 0,
45
48
  else {
46
49
  console.log(config);
47
50
  }
51
+ if (publish) {
52
+ spinner.info('Preparing to publishing config');
53
+ /* Make sure version is valid */
54
+ const version = publish === 'current' ? pkg.packageJson.version : publish;
55
+ if (!version || (!semverValid(version) && !['latest', 'preview'].includes(version))) {
56
+ spinner.fail('🙅‍♂️', 'Can not publish config to invalid version', chalk.redBright(version), '');
57
+ exit(1);
58
+ }
59
+ /** make sure user has a valid token */
60
+ try {
61
+ spinner.info('Validating FUSION_TOKEN');
62
+ // make sure token exist
63
+ requireToken();
64
+ // call service discovery with token, will throw error if failed
65
+ yield getEndpointUrl('apps', env, '');
66
+ spinner.succeed('Found valid FUSION_TOKEN');
67
+ }
68
+ catch (e) {
69
+ const err = e;
70
+ spinner.fail(chalk.bgRed(err.message));
71
+ exit(1);
72
+ }
73
+ try {
74
+ spinner.info('Verifying that App is registered');
75
+ const state = { endpoint: '' };
76
+ try {
77
+ state.endpoint = yield getEndpointUrl(`apps/${appKey}`, env, service);
78
+ }
79
+ catch (e) {
80
+ const err = e;
81
+ throw new Error(`Could not get endpoint from service discovery while verifying app. service-discovery status: ${err.message}`);
82
+ }
83
+ yield isAppRegistered(state.endpoint, appKey);
84
+ spinner.succeed(`${appKey} is registered`);
85
+ }
86
+ catch (e) {
87
+ const err = e;
88
+ spinner.fail('🙅‍♂️', chalk.bgRed(err.message));
89
+ exit(1);
90
+ }
91
+ try {
92
+ spinner.info(`Publishing config to "${appKey}@${version}"`);
93
+ const state = { endpoint: '' };
94
+ try {
95
+ state.endpoint = yield getEndpointUrl(`apps/${appKey}/builds/${version}/config`, env, service);
96
+ }
97
+ catch (e) {
98
+ const err = e;
99
+ throw new Error(`Could not get endpoint from service discovery while publishig config. service-discovery status: ${err.message}`);
100
+ }
101
+ yield publishAppConfig(state.endpoint, appKey, config);
102
+ spinner.succeed('✅', 'Published config to version', chalk.yellowBright(version));
103
+ }
104
+ catch (e) {
105
+ const err = e;
106
+ spinner.fail('🙅‍♂️', chalk.bgRed(err.message));
107
+ exit(1);
108
+ }
109
+ }
48
110
  return config;
49
111
  });
50
112
  export default createExportConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"create-export-config.js","sourceRoot":"","sources":["../../src/bin/create-export-config.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAO,OAIxC,EAAE,EAAE;;IACD,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IAExD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,C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AC;QAED,IAAI,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,IAAI,OAAO,GAAG,CAAC,CAAC;YAE5D,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACD,KAAK,CAAC,QAAQ,GAAG,MAAM,cAAc,CACjC,QAAQ,MAAM,WAAW,OAAO,SAAS,EACzC,GAAG,EACH,OAAO,CACV,CAAC;YACN,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,MAAM,GAAG,GAAG,CAAU,CAAC;gBACvB,MAAM,IAAI,KAAK,CACX,mGAAmG,GAAG,CAAC,OAAO,EAAE,CACnH,CAAC;YACN,CAAC;YAED,MAAM,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACvD,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,6BAA6B,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,GAAG,GAAG,CAAU,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -36,7 +36,6 @@ export const createExportManifest = (options) => __awaiter(void 0, void 0, void
36
36
  const { manifest } = yield loadAppManifest(env, pkg, {
37
37
  file: options === null || options === void 0 ? void 0 : options.configFile,
38
38
  });
39
- const manifestExport = Object.assign(Object.assign({}, manifest), { version: normalizeVersion(manifest.version) });
40
39
  if (outputFile) {
41
40
  spinner.start(`outputting manifest to ${formatPath(outputFile)}`);
42
41
  try {
@@ -44,7 +43,7 @@ export const createExportManifest = (options) => __awaiter(void 0, void 0, void
44
43
  if (!nodeFs.existsSync(dirname(outputFile))) {
45
44
  nodeFs.mkdirSync(dir, { recursive: true });
46
45
  }
47
- yield writeFile(outputFile, JSON.stringify(manifestExport));
46
+ yield writeFile(outputFile, JSON.stringify(manifest));
48
47
  spinner.succeed();
49
48
  }
50
49
  catch (err) {
@@ -53,9 +52,9 @@ export const createExportManifest = (options) => __awaiter(void 0, void 0, void
53
52
  }
54
53
  }
55
54
  else {
56
- console.log(manifestExport);
55
+ console.log(manifest);
57
56
  }
58
- return manifestExport;
57
+ return manifest;
59
58
  });
60
59
  export default createExportManifest;
61
60
  //# sourceMappingURL=create-export-manifest.js.map