Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cli/appmanager/refactoring-commands #2450

Merged

Conversation

eikeland
Copy link
Contributor

Why

Refactoring of publish commands and helpers.

Copy link

changeset-bot bot commented Sep 12, 2024

⚠️ No Changeset found

Latest commit: 015bf18

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added 🐞 bug Something isn't working 👨🏻‍🍳 cookbooks 💾 CLI fusion framework CLI 📚 documentation Improvements or additions to documentation 🚀 feature New feature or request labels Sep 12, 2024
@eikeland eikeland force-pushed the feat/cli/appmanager/refractoring-commands branch from f450dbc to 34c5f67 Compare September 12, 2024 11:41
@eikeland eikeland self-assigned this Sep 12, 2024
@eikeland eikeland marked this pull request as ready for review September 12, 2024 12:11
@eikeland eikeland requested review from odinr and a team as code owners September 12, 2024 12:11
Copy link
Contributor

github-actions bot commented Sep 12, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 0.39% 1633 / 412061
🔵 Statements 0.39% 1633 / 412061
🔵 Functions 23.17% 209 / 902
🔵 Branches 36.1% 374 / 1036
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
cookbooks/app-react/app.config.ts 0% 0% 0% 0% 1-12
packages/cli/src/bin/create-dev-serve.ts 0% 0% 0% 0% 1, 7, 9-10, 12, 14-16, 18-21, 23-29, 31, 41-42, 44, 46-47, 49-53, 55, 58-59, 61-63, 65, 67-128, 130-131, 133-137, 139, 141, 143, 145-148, 150, 152-163
packages/cli/src/bin/create-export-config.ts 0% 0% 0% 0% 1-4, 6-7, 16, 20-21, 23, 30-31, 33, 35-36, 38-42, 44-46, 48-63, 65-66, 68-78, 80-82, 84-85, 87-88, 90-95, 97-98, 100-108, 110-116, 118-119, 121-133, 135-142, 144-145, 147
packages/cli/src/bin/publish-application.ts 0% 0% 0% 0% 1-4, 12, 15, 17, 21-22, 24, 26-27, 29-30, 32-33, 35-40, 42-43, 45-55, 57-63, 65, 67-68, 70-73, 75-78, 80, 82-86, 88-95, 97, 99, 101-109, 111-112, 114-121, 123-132, 134-138
packages/cli/src/bin/tag-application.ts 0% 0% 0% 0% 1-5, 8-11, 13, 18-19, 21, 23-26, 28-30, 32-33, 35-36, 38-43, 45-46, 48-58, 60-66, 68-78, 80-92
packages/cli/src/bin/upload-application.ts 0% 0% 0% 0% 1-5, 8, 12-13, 15, 17-18, 20-21, 23-24, 26-31, 33-35, 37-39, 41-48, 50-56, 58-62, 64-67, 69, 71, 73-83
packages/cli/src/bin/utils/getEndpointUrl.ts 0% 0% 0% 0% 1, 3, 10-17, 19-22, 24-26, 28-35, 37-39, 41-45, 47-49, 51-52, 54-56
packages/cli/src/bin/utils/index.ts 0% 0% 0% 0% 1
packages/cli/src/bin/utils/isAppRegistered.ts 0% 0% 0% 0% 1, 6-12, 14-18, 20-24, 26-27
packages/cli/src/bin/utils/publishAppConfig.ts 0% 0% 0% 0% 1, 3, 9-18, 20-28, 30-31
packages/cli/src/bin/utils/requireToken.ts 0% 0% 0% 0% 1, 3-10
packages/cli/src/bin/utils/tagAppBundle.ts 0% 0% 0% 0% 1, 6-15, 17-21, 23-27, 29-30
packages/cli/src/bin/utils/uploadAppBundle.ts 0% 0% 0% 0% 1, 3, 8-12, 14-18, 20-27, 29-33, 35-37, 39-43, 45-47, 49-53, 55-56
packages/cli/src/lib/app-manifest.ts 0% 0% 0% 0% 1-2, 4, 13, 15, 40-41, 43, 60-61, 63-66, 68-79, 81, 89-97, 99-101, 103, 106-108, 110-120, 122-138, 140-146, 148-164, 166-183
packages/modules/http/src/module.ts 25% 100% 0% 25% 67-76, 78-90, 97-101, 115-122
Generated in workflow #7625

@eikeland eikeland force-pushed the feat/cli/appmanager/refractoring-commands branch from 1049a48 to 1a48540 Compare September 16, 2024 14:00
process.env.FUSION_CLI_ENV = fusionEnv;

const requestService = await fetch(
`https://discovery.ci.fusion-dev.net/service-registry/environments/${fusionEnv}/services/apps`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use as doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a todo for now. we need to get it out as alpha and it works. can fix it before beta release.

Copy link
Collaborator

@odinr odinr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix url to disco 🕺

@asbjornhaland
Copy link
Contributor

missing changeset.

@eikeland
Copy link
Contributor Author

missing changeset.

Its not a release towards main.

Comment on lines +29 to +55
if (requestBundle.status === 401 || requestBundle.status === 403) {
throw new Error(
`This is not allowed for this role on this app. HTTP message: ${requestBundle.statusText}`,
);
}

if (requestBundle.status === 404) {
throw new Error(`This app do not exist. HTTP message: ${requestBundle.statusText}`);
}

if (requestBundle.status === 409) {
throw new Error(
`This version is already published. HTTP message: ${requestBundle.statusText}`,
);
}

if (requestBundle.status === 410) {
throw new Error(`This app is deleted. HTTP message: ${requestBundle.statusText}`);
}

if (!requestBundle.ok) {
throw new Error(
`Failed to publish bundle. HTTP status ${requestBundle.status}, ${requestBundle.statusText}`,
);
}

return await requestBundle.json();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider switch statement instead.

@eikeland eikeland merged commit 17c4eed into feat/cli/appmanager/publish Sep 17, 2024
8 checks passed
@eikeland eikeland deleted the feat/cli/appmanager/refractoring-commands branch September 17, 2024 10:12
odinr pushed a commit that referenced this pull request Sep 23, 2024
* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy
eikeland added a commit that referenced this pull request Sep 30, 2024
* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy
eikeland added a commit that referenced this pull request Oct 2, 2024
* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy
odinr added a commit that referenced this pull request Oct 2, 2024
* Chore/deps/update/fusion wc person (#2493)

* chore(person-resolver): updating fusion-wc-person to fix issue with controlled component usage

* docs: changeset

* feat(cli): command for publish app

* fix(http): reverting changes to http module

* feat(cli): command 'app publish' to publish app with app api

* feat(cli): new app commands for upload, tag and publish

* feat(cookbook-app-react): new config type for cli app publishing

* chore(cookbooks): updating app config to latest type

* docs: changeset

* fix(cli): removing commented console.log

* fix(cli): fixing lint warning

* chore(cli): console message when uploading new app version

* chore(cli): app publishing support environments

* fix(cli): renaming versin parameter for main cli

* fix(cli): renaming variable

* fix(cli): lint warning in upload-application

* fix(cli): comment in upload-application

* fix(cli): getEndpointUrl resolves api from service discovery

* feat(apps-service): cookbook app-react adjustd for new apps service

* feat(module-app): module-apps using the new apps-proxy, cli using the updated apps module

* fix(cli): options for config --env is no longer required

* feat(module-app): appmanifest is now instance of ApplicationManifest

* fix(legacy): mapping legacy apploader to new api

* fix: lockfile

* feat(app-react): new hook for useMyApps for getting a users apps

* docs: chanegset

* chore(cors): adding cors module to cli dev-serve

* chore(module-app): handle setting app key

* chore(config): adapting cookbooks config til new app api scheme

* fix(cli): appConfigurators setClient in type

* fix(cli): improves commands help text

* docs(cli): ads command and authentication documentation to README

* docs(cli): updated README

* docs(cli): add examples in README

* fix(cli): use correct path to resources

* docs(cli): improving documentation structure in vue-press

* fix(app): setting app api version and exposing baseUri in app configurator

* fix(cli): app config now supports using tags

* docs(cli): example for github-workflow to publish with app service

* chore(cookbook-app-react): removing publish script from package.json

* fix(cli): adding dev comments

* fix(cli: using ApplicationManifest in app-package command

* docs: comments and changeset

* chore(app): update app configurator to support filtering app manifests by current user

* docs: changeset cookbooks

* fix(cookbooks): adjusting app config and manifest to breaking changes in cookbooks

* docs(cli): vuepress cli commands options in markdown table

* docs(cli): changing config to new syntax in vuepress

* chore(vuepress): simplifying github workflow for publishing app

* chore(cli): renaming variable tagd to tagged

* fix(cli): creating export manifest defaults increateManifestFromPackage

* fix(cli): createManifestFromPackage proper check for type module

* fix(react-app): removing hook useMyApps since removed from provider

* fix(module-app): remove early return in logic

* fix(modules-app): set api version in client query

* fix(module-app): enableAppModule async callback

* feat(cli): create plugin for handling application api calls (#2448)

- generate manifest, config and source code when local app
- proxy app-service calls when app miss-match

* feat(cli): create plugin for serving index.html from external public directory (#2449)

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.

- Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
- Transformed the HTML using Vite's `transformIndexHtml` method.
- Applied appropriate content headers and additional configured headers before sending the response.

* feat(cli): Rewrite dev-portal (#2462)

* feat(cli): add proxyRequestLogger to log proxy requests in the CLI

* fix(cli): set entryPoint in loadAppManifest based on environment mode

* feat(cli): rewrite CLI to use standard vite config.

- removed custom proxy servers
- added plugin for external portal
- added plugin for app-proxy
- added httpClient for app-proxy
- fixed app manifest

TODO: rework app manifest template

* fix(app): update AppConfigurator and ApplicationManifest for improved type handling and async support

* refactor(cli): remove unused imports and clean up Vite config

* build: update lock file

* feat(cookbooks): add a portal poc app

* Feat/cli/appmanager/refactoring-commands (#2450)

* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy

* fix(cookbook-poc-portal): package as private to not releae to npm

* Renaming getCommisSha to resolveCommitSha

* docs: temporary changeset

* fix(cli): re-adding is-mergable-object as dependency

* fix(cli): make sure export manifest uses js or mjs based on package type

* Feat(module-app): Adjusted module to the new app service API. (#2470)

* feat(module-app): Align manifest with new app service

- Updated zod to version 3.23.8
- Added zod to package.json dependencies
- Removed unused import from index.ts
- Removed unused import from types.ts
- Updated flows.ts to use payload.appKey instead of payload.key
- Updated actions.ts to use AppManifest instead of ApplicationManifest
- Added application.schema.ts to validate application manifest
- Added changeset slimy-buses-give.md

* refactor: Update modules to reflect new manifest

* style: fix lint

* Refactor(app): Update AppBuildManifest and AppManifest types (#2472)

* Refactor(cli): Improve build process and manifest generation

- Refactored build-application.ts to improve the build process.
- Updated create-export-manifest.js to generate the build manifest.
- Renamed getCommisSha to resolveCommitSha in app-package.ts.
- Updated load-app-config.ts to provide more informative console output.
- Updated config.ts to handle unsupported file types.
- Updated vite-config.ts to handle undefined config.
- Updated spinner.ts to attach and detach console output.
- Updated app-config.ts to handle void return type in AppConfigFn.
- Updated bundle-application.ts to use createBuildManifest instead of createExportManifest.
- Updated load-manifest.ts to generate the manifest with command and mode information.

* Refactor(cookbook-app-react): Update app.config and app.manifest.config

- Update app.config.ts to remove unused imports and adjust the endpoints URL.
- Update app.manifest.config.ts to set the appKey to 'app-react' when serving.

* Refactor(app): Update AppBuildManifest and AppManifest types

* refactor(cookbook): Remove unused app configuration files

* doc: update changesets

* refactor(cli): Update publish option default value to 'current'

* docs: update changeset

* Refactor(types): Update imports and exports in types.ts

* doc: updated docs

* docs(cli): documenting major cli changes and vue-press docs

* fix(AppManifest): adding missing types for AppManifest in module-app

* fix(app-module): adding allowedExtensions in build manifest

* fix(module-app): correcting name of categories in AppManifest

* fix(app-module): removed allowed extensions in zod ApiApplicationBuildSchema

* fix(cli): merge of manifest

* fix(app-proxy): simplify app proxy

* fix(module-app): update interfaces and schemas for api calls

* fix(cli): use correct app key when running dev-server

* fix(app-module): merging fixes

* fix(cli): remove doubble import of deepmerge

* fix(module-app): adding category to ApiApplicationSchema

* style: fix lint

* refactor(cli): emit error on failed bundle upload

* refactor(cli): Update import paths for app-proxy and external-public plugins

* doc(cli): Add README for the app proxy plugin

* refactor(cli): Add middleware to serve static assets from specified path

- remove altering of `publicDir`
- add middleware for handling static assets from provided path
- ensure that middleware does not hijack source assets
- ensure static asset middleware does not process `index.html`

* refactor(cli): Update external-public plugin

- check public dir for asset
- allow filtering

* doc(cli): Add External Public Plugin documentation

* build: update lock

* feat(cli): Add App Asset Export Plugin (#2479)

* feat(cli): Add app assets export plugin

create a plugin which will extract application assets and inject loader for import the correct asset when imported threw proxy

* feat(cli): Include StandardIncludeAssetExtensions in generated base manifest

* feat(cli): Include AppAssetExportPlugin in ViteConfig

When building an application, the `AppAssetExportPlugin` is now added to the `ViteConfig` and configured to include `manifest.build.allowedExtensions`.

* refactor(cli): Improve asset resolution and error handling in AppAssetExportPlugin

- resolve should check if the asset exists before filtering

* feat(cookbook-app-react-assets): Add Asset cookbook

Create a cookbook for testing the asset plugin

* refactor(app): rename `baseUri` to `assetUri` to make more sense

* refactor(configurator): Update ServiceDiscoveryConfigurator

If the discoveryClient is already configured, skip the fallback configuration

* refactor(cookbook-poc-portal): Update configuration of service discovery

* docs(changeset): setting minor for fusion-framewoerk-react

* fix(cli): adding correct entryPoint when building and serving

* docs: changeset for externalPlugin for vite

* docs(cli): vue-press adding command app manifest

* docs(vue-press): cli corrects typo in README

* fix(cli): env as required option to publish config, display error response in console

* fix(cli): using node fetch in cli

* fix(cli): remove dead code

* fix(cli): setting node-fetch agent to allow certificate error

* fix(cli): defineAppManifest returns Partial AppManifest

* fix(cli): removing https agent in node-fetch

* docs(cli): defineAppManifest example

* refactor(cli): export plugins

* fix(cli): resolving code review issues

* docs: changeset

---------

Co-authored-by: Odin Thomas Rochmann <odin.rochmann@gmail.com>
odinr added a commit that referenced this pull request Oct 2, 2024
* Chore/deps/update/fusion wc person (#2493)

* chore(person-resolver): updating fusion-wc-person to fix issue with controlled component usage

* docs: changeset

* feat(cli): command for publish app

* fix(http): reverting changes to http module

* feat(cli): command 'app publish' to publish app with app api

* feat(cli): new app commands for upload, tag and publish

* feat(cookbook-app-react): new config type for cli app publishing

* chore(cookbooks): updating app config to latest type

* docs: changeset

* fix(cli): removing commented console.log

* fix(cli): fixing lint warning

* chore(cli): console message when uploading new app version

* chore(cli): app publishing support environments

* fix(cli): renaming versin parameter for main cli

* fix(cli): renaming variable

* fix(cli): lint warning in upload-application

* fix(cli): comment in upload-application

* fix(cli): getEndpointUrl resolves api from service discovery

* feat(apps-service): cookbook app-react adjustd for new apps service

* feat(module-app): module-apps using the new apps-proxy, cli using the updated apps module

* fix(cli): options for config --env is no longer required

* feat(module-app): appmanifest is now instance of ApplicationManifest

* fix(legacy): mapping legacy apploader to new api

* fix: lockfile

* feat(app-react): new hook for useMyApps for getting a users apps

* docs: chanegset

* chore(cors): adding cors module to cli dev-serve

* chore(module-app): handle setting app key

* chore(config): adapting cookbooks config til new app api scheme

* fix(cli): appConfigurators setClient in type

* fix(cli): improves commands help text

* docs(cli): ads command and authentication documentation to README

* docs(cli): updated README

* docs(cli): add examples in README

* fix(cli): use correct path to resources

* docs(cli): improving documentation structure in vue-press

* fix(app): setting app api version and exposing baseUri in app configurator

* fix(cli): app config now supports using tags

* docs(cli): example for github-workflow to publish with app service

* chore(cookbook-app-react): removing publish script from package.json

* fix(cli): adding dev comments

* fix(cli: using ApplicationManifest in app-package command

* docs: comments and changeset

* chore(app): update app configurator to support filtering app manifests by current user

* docs: changeset cookbooks

* fix(cookbooks): adjusting app config and manifest to breaking changes in cookbooks

* docs(cli): vuepress cli commands options in markdown table

* docs(cli): changing config to new syntax in vuepress

* chore(vuepress): simplifying github workflow for publishing app

* chore(cli): renaming variable tagd to tagged

* fix(cli): creating export manifest defaults increateManifestFromPackage

* fix(cli): createManifestFromPackage proper check for type module

* fix(react-app): removing hook useMyApps since removed from provider

* fix(module-app): remove early return in logic

* fix(modules-app): set api version in client query

* fix(module-app): enableAppModule async callback

* feat(cli): create plugin for handling application api calls (#2448)

- generate manifest, config and source code when local app
- proxy app-service calls when app miss-match

* feat(cli): create plugin for serving index.html from external public directory (#2449)

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.

- Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
- Transformed the HTML using Vite's `transformIndexHtml` method.
- Applied appropriate content headers and additional configured headers before sending the response.

* feat(cli): Rewrite dev-portal (#2462)

* feat(cli): add proxyRequestLogger to log proxy requests in the CLI

* fix(cli): set entryPoint in loadAppManifest based on environment mode

* feat(cli): rewrite CLI to use standard vite config.

- removed custom proxy servers
- added plugin for external portal
- added plugin for app-proxy
- added httpClient for app-proxy
- fixed app manifest

TODO: rework app manifest template

* fix(app): update AppConfigurator and ApplicationManifest for improved type handling and async support

* refactor(cli): remove unused imports and clean up Vite config

* build: update lock file

* feat(cookbooks): add a portal poc app

* Feat/cli/appmanager/refactoring-commands (#2450)

* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy

* fix(cookbook-poc-portal): package as private to not releae to npm

* Renaming getCommisSha to resolveCommitSha

* docs: temporary changeset

* fix(cli): re-adding is-mergable-object as dependency

* fix(cli): make sure export manifest uses js or mjs based on package type

* Feat(module-app): Adjusted module to the new app service API. (#2470)

* feat(module-app): Align manifest with new app service

- Updated zod to version 3.23.8
- Added zod to package.json dependencies
- Removed unused import from index.ts
- Removed unused import from types.ts
- Updated flows.ts to use payload.appKey instead of payload.key
- Updated actions.ts to use AppManifest instead of ApplicationManifest
- Added application.schema.ts to validate application manifest
- Added changeset slimy-buses-give.md

* refactor: Update modules to reflect new manifest

* style: fix lint

* Refactor(app): Update AppBuildManifest and AppManifest types (#2472)

* Refactor(cli): Improve build process and manifest generation

- Refactored build-application.ts to improve the build process.
- Updated create-export-manifest.js to generate the build manifest.
- Renamed getCommisSha to resolveCommitSha in app-package.ts.
- Updated load-app-config.ts to provide more informative console output.
- Updated config.ts to handle unsupported file types.
- Updated vite-config.ts to handle undefined config.
- Updated spinner.ts to attach and detach console output.
- Updated app-config.ts to handle void return type in AppConfigFn.
- Updated bundle-application.ts to use createBuildManifest instead of createExportManifest.
- Updated load-manifest.ts to generate the manifest with command and mode information.

* Refactor(cookbook-app-react): Update app.config and app.manifest.config

- Update app.config.ts to remove unused imports and adjust the endpoints URL.
- Update app.manifest.config.ts to set the appKey to 'app-react' when serving.

* Refactor(app): Update AppBuildManifest and AppManifest types

* refactor(cookbook): Remove unused app configuration files

* doc: update changesets

* refactor(cli): Update publish option default value to 'current'

* docs: update changeset

* Refactor(types): Update imports and exports in types.ts

* doc: updated docs

* docs(cli): documenting major cli changes and vue-press docs

* fix(AppManifest): adding missing types for AppManifest in module-app

* fix(app-module): adding allowedExtensions in build manifest

* fix(module-app): correcting name of categories in AppManifest

* fix(app-module): removed allowed extensions in zod ApiApplicationBuildSchema

* fix(cli): merge of manifest

* fix(app-proxy): simplify app proxy

* fix(module-app): update interfaces and schemas for api calls

* fix(cli): use correct app key when running dev-server

* fix(app-module): merging fixes

* fix(cli): remove doubble import of deepmerge

* fix(module-app): adding category to ApiApplicationSchema

* style: fix lint

* refactor(cli): emit error on failed bundle upload

* refactor(cli): Update import paths for app-proxy and external-public plugins

* doc(cli): Add README for the app proxy plugin

* refactor(cli): Add middleware to serve static assets from specified path

- remove altering of `publicDir`
- add middleware for handling static assets from provided path
- ensure that middleware does not hijack source assets
- ensure static asset middleware does not process `index.html`

* refactor(cli): Update external-public plugin

- check public dir for asset
- allow filtering

* doc(cli): Add External Public Plugin documentation

* build: update lock

* feat(cli): Add App Asset Export Plugin (#2479)

* feat(cli): Add app assets export plugin

create a plugin which will extract application assets and inject loader for import the correct asset when imported threw proxy

* feat(cli): Include StandardIncludeAssetExtensions in generated base manifest

* feat(cli): Include AppAssetExportPlugin in ViteConfig

When building an application, the `AppAssetExportPlugin` is now added to the `ViteConfig` and configured to include `manifest.build.allowedExtensions`.

* refactor(cli): Improve asset resolution and error handling in AppAssetExportPlugin

- resolve should check if the asset exists before filtering

* feat(cookbook-app-react-assets): Add Asset cookbook

Create a cookbook for testing the asset plugin

* refactor(app): rename `baseUri` to `assetUri` to make more sense

* refactor(configurator): Update ServiceDiscoveryConfigurator

If the discoveryClient is already configured, skip the fallback configuration

* refactor(cookbook-poc-portal): Update configuration of service discovery

* docs(changeset): setting minor for fusion-framewoerk-react

* fix(cli): adding correct entryPoint when building and serving

* docs: changeset for externalPlugin for vite

* docs(cli): vue-press adding command app manifest

* docs(vue-press): cli corrects typo in README

* fix(cli): env as required option to publish config, display error response in console

* fix(cli): using node fetch in cli

* fix(cli): remove dead code

* fix(cli): setting node-fetch agent to allow certificate error

* fix(cli): defineAppManifest returns Partial AppManifest

* fix(cli): removing https agent in node-fetch

* docs(cli): defineAppManifest example

* refactor(cli): export plugins

* fix(cli): resolving code review issues

* docs: changeset

---------

Co-authored-by: Odin Thomas Rochmann <odin.rochmann@gmail.com>
odinr added a commit that referenced this pull request Oct 14, 2024
* Chore/deps/update/fusion wc person (#2493)

* chore(person-resolver): updating fusion-wc-person to fix issue with controlled component usage

* docs: changeset

* feat(cli): command for publish app

* fix(http): reverting changes to http module

* feat(cli): command 'app publish' to publish app with app api

* feat(cli): new app commands for upload, tag and publish

* feat(cookbook-app-react): new config type for cli app publishing

* chore(cookbooks): updating app config to latest type

* docs: changeset

* fix(cli): removing commented console.log

* fix(cli): fixing lint warning

* chore(cli): console message when uploading new app version

* chore(cli): app publishing support environments

* fix(cli): renaming versin parameter for main cli

* fix(cli): renaming variable

* fix(cli): lint warning in upload-application

* fix(cli): comment in upload-application

* fix(cli): getEndpointUrl resolves api from service discovery

* feat(apps-service): cookbook app-react adjustd for new apps service

* feat(module-app): module-apps using the new apps-proxy, cli using the updated apps module

* fix(cli): options for config --env is no longer required

* feat(module-app): appmanifest is now instance of ApplicationManifest

* fix(legacy): mapping legacy apploader to new api

* fix: lockfile

* feat(app-react): new hook for useMyApps for getting a users apps

* docs: chanegset

* chore(cors): adding cors module to cli dev-serve

* chore(module-app): handle setting app key

* chore(config): adapting cookbooks config til new app api scheme

* fix(cli): appConfigurators setClient in type

* fix(cli): improves commands help text

* docs(cli): ads command and authentication documentation to README

* docs(cli): updated README

* docs(cli): add examples in README

* fix(cli): use correct path to resources

* docs(cli): improving documentation structure in vue-press

* fix(app): setting app api version and exposing baseUri in app configurator

* fix(cli): app config now supports using tags

* docs(cli): example for github-workflow to publish with app service

* chore(cookbook-app-react): removing publish script from package.json

* fix(cli): adding dev comments

* fix(cli: using ApplicationManifest in app-package command

* docs: comments and changeset

* chore(app): update app configurator to support filtering app manifests by current user

* docs: changeset cookbooks

* fix(cookbooks): adjusting app config and manifest to breaking changes in cookbooks

* docs(cli): vuepress cli commands options in markdown table

* docs(cli): changing config to new syntax in vuepress

* chore(vuepress): simplifying github workflow for publishing app

* chore(cli): renaming variable tagd to tagged

* fix(cli): creating export manifest defaults increateManifestFromPackage

* fix(cli): createManifestFromPackage proper check for type module

* fix(react-app): removing hook useMyApps since removed from provider

* fix(module-app): remove early return in logic

* fix(modules-app): set api version in client query

* fix(module-app): enableAppModule async callback

* feat(cli): create plugin for handling application api calls (#2448)

- generate manifest, config and source code when local app
- proxy app-service calls when app miss-match

* feat(cli): create plugin for serving index.html from external public directory (#2449)

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.

- Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
- Transformed the HTML using Vite's `transformIndexHtml` method.
- Applied appropriate content headers and additional configured headers before sending the response.

* feat(cli): Rewrite dev-portal (#2462)

* feat(cli): add proxyRequestLogger to log proxy requests in the CLI

* fix(cli): set entryPoint in loadAppManifest based on environment mode

* feat(cli): rewrite CLI to use standard vite config.

- removed custom proxy servers
- added plugin for external portal
- added plugin for app-proxy
- added httpClient for app-proxy
- fixed app manifest

TODO: rework app manifest template

* fix(app): update AppConfigurator and ApplicationManifest for improved type handling and async support

* refactor(cli): remove unused imports and clean up Vite config

* build: update lock file

* feat(cookbooks): add a portal poc app

* Feat/cli/appmanager/refactoring-commands (#2450)

* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy

* fix(cookbook-poc-portal): package as private to not releae to npm

* Renaming getCommisSha to resolveCommitSha

* docs: temporary changeset

* fix(cli): re-adding is-mergable-object as dependency

* fix(cli): make sure export manifest uses js or mjs based on package type

* Feat(module-app): Adjusted module to the new app service API. (#2470)

* feat(module-app): Align manifest with new app service

- Updated zod to version 3.23.8
- Added zod to package.json dependencies
- Removed unused import from index.ts
- Removed unused import from types.ts
- Updated flows.ts to use payload.appKey instead of payload.key
- Updated actions.ts to use AppManifest instead of ApplicationManifest
- Added application.schema.ts to validate application manifest
- Added changeset slimy-buses-give.md

* refactor: Update modules to reflect new manifest

* style: fix lint

* Refactor(app): Update AppBuildManifest and AppManifest types (#2472)

* Refactor(cli): Improve build process and manifest generation

- Refactored build-application.ts to improve the build process.
- Updated create-export-manifest.js to generate the build manifest.
- Renamed getCommisSha to resolveCommitSha in app-package.ts.
- Updated load-app-config.ts to provide more informative console output.
- Updated config.ts to handle unsupported file types.
- Updated vite-config.ts to handle undefined config.
- Updated spinner.ts to attach and detach console output.
- Updated app-config.ts to handle void return type in AppConfigFn.
- Updated bundle-application.ts to use createBuildManifest instead of createExportManifest.
- Updated load-manifest.ts to generate the manifest with command and mode information.

* Refactor(cookbook-app-react): Update app.config and app.manifest.config

- Update app.config.ts to remove unused imports and adjust the endpoints URL.
- Update app.manifest.config.ts to set the appKey to 'app-react' when serving.

* Refactor(app): Update AppBuildManifest and AppManifest types

* refactor(cookbook): Remove unused app configuration files

* doc: update changesets

* refactor(cli): Update publish option default value to 'current'

* docs: update changeset

* Refactor(types): Update imports and exports in types.ts

* doc: updated docs

* docs(cli): documenting major cli changes and vue-press docs

* fix(AppManifest): adding missing types for AppManifest in module-app

* fix(app-module): adding allowedExtensions in build manifest

* fix(module-app): correcting name of categories in AppManifest

* fix(app-module): removed allowed extensions in zod ApiApplicationBuildSchema

* fix(cli): merge of manifest

* fix(app-proxy): simplify app proxy

* fix(module-app): update interfaces and schemas for api calls

* fix(cli): use correct app key when running dev-server

* fix(app-module): merging fixes

* fix(cli): remove doubble import of deepmerge

* fix(module-app): adding category to ApiApplicationSchema

* style: fix lint

* refactor(cli): emit error on failed bundle upload

* refactor(cli): Update import paths for app-proxy and external-public plugins

* doc(cli): Add README for the app proxy plugin

* refactor(cli): Add middleware to serve static assets from specified path

- remove altering of `publicDir`
- add middleware for handling static assets from provided path
- ensure that middleware does not hijack source assets
- ensure static asset middleware does not process `index.html`

* refactor(cli): Update external-public plugin

- check public dir for asset
- allow filtering

* doc(cli): Add External Public Plugin documentation

* build: update lock

* feat(cli): Add App Asset Export Plugin (#2479)

* feat(cli): Add app assets export plugin

create a plugin which will extract application assets and inject loader for import the correct asset when imported threw proxy

* feat(cli): Include StandardIncludeAssetExtensions in generated base manifest

* feat(cli): Include AppAssetExportPlugin in ViteConfig

When building an application, the `AppAssetExportPlugin` is now added to the `ViteConfig` and configured to include `manifest.build.allowedExtensions`.

* refactor(cli): Improve asset resolution and error handling in AppAssetExportPlugin

- resolve should check if the asset exists before filtering

* feat(cookbook-app-react-assets): Add Asset cookbook

Create a cookbook for testing the asset plugin

* refactor(app): rename `baseUri` to `assetUri` to make more sense

* refactor(configurator): Update ServiceDiscoveryConfigurator

If the discoveryClient is already configured, skip the fallback configuration

* refactor(cookbook-poc-portal): Update configuration of service discovery

* docs(changeset): setting minor for fusion-framewoerk-react

* fix(cli): adding correct entryPoint when building and serving

* docs: changeset for externalPlugin for vite

* docs(cli): vue-press adding command app manifest

* docs(vue-press): cli corrects typo in README

* fix(cli): env as required option to publish config, display error response in console

* fix(cli): using node fetch in cli

* fix(cli): remove dead code

* fix(cli): setting node-fetch agent to allow certificate error

* fix(cli): defineAppManifest returns Partial AppManifest

* fix(cli): removing https agent in node-fetch

* docs(cli): defineAppManifest example

* refactor(cli): export plugins

* fix(cli): resolving code review issues

* docs: changeset

---------

Co-authored-by: Odin Thomas Rochmann <odin.rochmann@gmail.com>
odinr added a commit that referenced this pull request Oct 15, 2024
* Feat/cli/appmanager/publish (#2178)

* Chore/deps/update/fusion wc person (#2493)

* chore(person-resolver): updating fusion-wc-person to fix issue with controlled component usage

* docs: changeset

* feat(cli): command for publish app

* fix(http): reverting changes to http module

* feat(cli): command 'app publish' to publish app with app api

* feat(cli): new app commands for upload, tag and publish

* feat(cookbook-app-react): new config type for cli app publishing

* chore(cookbooks): updating app config to latest type

* docs: changeset

* fix(cli): removing commented console.log

* fix(cli): fixing lint warning

* chore(cli): console message when uploading new app version

* chore(cli): app publishing support environments

* fix(cli): renaming versin parameter for main cli

* fix(cli): renaming variable

* fix(cli): lint warning in upload-application

* fix(cli): comment in upload-application

* fix(cli): getEndpointUrl resolves api from service discovery

* feat(apps-service): cookbook app-react adjustd for new apps service

* feat(module-app): module-apps using the new apps-proxy, cli using the updated apps module

* fix(cli): options for config --env is no longer required

* feat(module-app): appmanifest is now instance of ApplicationManifest

* fix(legacy): mapping legacy apploader to new api

* fix: lockfile

* feat(app-react): new hook for useMyApps for getting a users apps

* docs: chanegset

* chore(cors): adding cors module to cli dev-serve

* chore(module-app): handle setting app key

* chore(config): adapting cookbooks config til new app api scheme

* fix(cli): appConfigurators setClient in type

* fix(cli): improves commands help text

* docs(cli): ads command and authentication documentation to README

* docs(cli): updated README

* docs(cli): add examples in README

* fix(cli): use correct path to resources

* docs(cli): improving documentation structure in vue-press

* fix(app): setting app api version and exposing baseUri in app configurator

* fix(cli): app config now supports using tags

* docs(cli): example for github-workflow to publish with app service

* chore(cookbook-app-react): removing publish script from package.json

* fix(cli): adding dev comments

* fix(cli: using ApplicationManifest in app-package command

* docs: comments and changeset

* chore(app): update app configurator to support filtering app manifests by current user

* docs: changeset cookbooks

* fix(cookbooks): adjusting app config and manifest to breaking changes in cookbooks

* docs(cli): vuepress cli commands options in markdown table

* docs(cli): changing config to new syntax in vuepress

* chore(vuepress): simplifying github workflow for publishing app

* chore(cli): renaming variable tagd to tagged

* fix(cli): creating export manifest defaults increateManifestFromPackage

* fix(cli): createManifestFromPackage proper check for type module

* fix(react-app): removing hook useMyApps since removed from provider

* fix(module-app): remove early return in logic

* fix(modules-app): set api version in client query

* fix(module-app): enableAppModule async callback

* feat(cli): create plugin for handling application api calls (#2448)

- generate manifest, config and source code when local app
- proxy app-service calls when app miss-match

* feat(cli): create plugin for serving index.html from external public directory (#2449)

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.

- Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
- Transformed the HTML using Vite's `transformIndexHtml` method.
- Applied appropriate content headers and additional configured headers before sending the response.

* feat(cli): Rewrite dev-portal (#2462)

* feat(cli): add proxyRequestLogger to log proxy requests in the CLI

* fix(cli): set entryPoint in loadAppManifest based on environment mode

* feat(cli): rewrite CLI to use standard vite config.

- removed custom proxy servers
- added plugin for external portal
- added plugin for app-proxy
- added httpClient for app-proxy
- fixed app manifest

TODO: rework app manifest template

* fix(app): update AppConfigurator and ApplicationManifest for improved type handling and async support

* refactor(cli): remove unused imports and clean up Vite config

* build: update lock file

* feat(cookbooks): add a portal poc app

* Feat/cli/appmanager/refactoring-commands (#2450)

* fix(cli): improving docs and types

* feat(cli): refactoring and error handling in commands using apps-service

* fix: lint fixes

* fix(cli): todo in getEndpointUrl, and not using default import in dev-proxy

* fix(cookbook-poc-portal): package as private to not releae to npm

* Renaming getCommisSha to resolveCommitSha

* docs: temporary changeset

* fix(cli): re-adding is-mergable-object as dependency

* fix(cli): make sure export manifest uses js or mjs based on package type

* Feat(module-app): Adjusted module to the new app service API. (#2470)

* feat(module-app): Align manifest with new app service

- Updated zod to version 3.23.8
- Added zod to package.json dependencies
- Removed unused import from index.ts
- Removed unused import from types.ts
- Updated flows.ts to use payload.appKey instead of payload.key
- Updated actions.ts to use AppManifest instead of ApplicationManifest
- Added application.schema.ts to validate application manifest
- Added changeset slimy-buses-give.md

* refactor: Update modules to reflect new manifest

* style: fix lint

* Refactor(app): Update AppBuildManifest and AppManifest types (#2472)

* Refactor(cli): Improve build process and manifest generation

- Refactored build-application.ts to improve the build process.
- Updated create-export-manifest.js to generate the build manifest.
- Renamed getCommisSha to resolveCommitSha in app-package.ts.
- Updated load-app-config.ts to provide more informative console output.
- Updated config.ts to handle unsupported file types.
- Updated vite-config.ts to handle undefined config.
- Updated spinner.ts to attach and detach console output.
- Updated app-config.ts to handle void return type in AppConfigFn.
- Updated bundle-application.ts to use createBuildManifest instead of createExportManifest.
- Updated load-manifest.ts to generate the manifest with command and mode information.

* Refactor(cookbook-app-react): Update app.config and app.manifest.config

- Update app.config.ts to remove unused imports and adjust the endpoints URL.
- Update app.manifest.config.ts to set the appKey to 'app-react' when serving.

* Refactor(app): Update AppBuildManifest and AppManifest types

* refactor(cookbook): Remove unused app configuration files

* doc: update changesets

* refactor(cli): Update publish option default value to 'current'

* docs: update changeset

* Refactor(types): Update imports and exports in types.ts

* doc: updated docs

* docs(cli): documenting major cli changes and vue-press docs

* fix(AppManifest): adding missing types for AppManifest in module-app

* fix(app-module): adding allowedExtensions in build manifest

* fix(module-app): correcting name of categories in AppManifest

* fix(app-module): removed allowed extensions in zod ApiApplicationBuildSchema

* fix(cli): merge of manifest

* fix(app-proxy): simplify app proxy

* fix(module-app): update interfaces and schemas for api calls

* fix(cli): use correct app key when running dev-server

* fix(app-module): merging fixes

* fix(cli): remove doubble import of deepmerge

* fix(module-app): adding category to ApiApplicationSchema

* style: fix lint

* refactor(cli): emit error on failed bundle upload

* refactor(cli): Update import paths for app-proxy and external-public plugins

* doc(cli): Add README for the app proxy plugin

* refactor(cli): Add middleware to serve static assets from specified path

- remove altering of `publicDir`
- add middleware for handling static assets from provided path
- ensure that middleware does not hijack source assets
- ensure static asset middleware does not process `index.html`

* refactor(cli): Update external-public plugin

- check public dir for asset
- allow filtering

* doc(cli): Add External Public Plugin documentation

* build: update lock

* feat(cli): Add App Asset Export Plugin (#2479)

* feat(cli): Add app assets export plugin

create a plugin which will extract application assets and inject loader for import the correct asset when imported threw proxy

* feat(cli): Include StandardIncludeAssetExtensions in generated base manifest

* feat(cli): Include AppAssetExportPlugin in ViteConfig

When building an application, the `AppAssetExportPlugin` is now added to the `ViteConfig` and configured to include `manifest.build.allowedExtensions`.

* refactor(cli): Improve asset resolution and error handling in AppAssetExportPlugin

- resolve should check if the asset exists before filtering

* feat(cookbook-app-react-assets): Add Asset cookbook

Create a cookbook for testing the asset plugin

* refactor(app): rename `baseUri` to `assetUri` to make more sense

* refactor(configurator): Update ServiceDiscoveryConfigurator

If the discoveryClient is already configured, skip the fallback configuration

* refactor(cookbook-poc-portal): Update configuration of service discovery

* docs(changeset): setting minor for fusion-framewoerk-react

* fix(cli): adding correct entryPoint when building and serving

* docs: changeset for externalPlugin for vite

* docs(cli): vue-press adding command app manifest

* docs(vue-press): cli corrects typo in README

* fix(cli): env as required option to publish config, display error response in console

* fix(cli): using node fetch in cli

* fix(cli): remove dead code

* fix(cli): setting node-fetch agent to allow certificate error

* fix(cli): defineAppManifest returns Partial AppManifest

* fix(cli): removing https agent in node-fetch

* docs(cli): defineAppManifest example

* refactor(cli): export plugins

* fix(cli): resolving code review issues

* docs: changeset

---------

Co-authored-by: Odin Thomas Rochmann <odin.rochmann@gmail.com>

* fix(cli): app-proxy-plugin changin order of execution for paths (#2498)

* Fix/cli/appmanifest/app key (#2502)

* fix(cli): log response on isAppRegistered

* fix(cli): better spinner mesage

* fix(cli): using node fetch in is AppRegistered (#2505)

* fix(cli): better error handling of isAppRegistered (#2507)

* feat(app): Convert config to instance so that implementation of behavior is abstracted (#2508)

* feat(app): Convert config to instance so that implementation of behavior is abstracted

- create manifest for config validation
- create class for transpiling of config
- update cli to use the VO type of config

NOTE: direct access of endpoints if now deprecated!

BREAKING CHANGES: `endpoints` will be deprecate in future, applications should use `getEndpoint`

* refactor(app): Refactor AppConfig class to improve endpoint handling

* Feat/cli/upload config (#2506)

* feat(cli): added new command for upload-config

* docs: changeset for the new command upload-config

* fix(cli): eslint issues

* fix(cli): better error handling in isAppRegistered

* fix(cli): to many input params for isAppREgistered in  upload-export-config

* fix(cli): throwing error if app is not registrered

* fix(cli): error message when app is deleted

* refactor(cli): rework cli to support import without type module in package.json (#2509)

* refactor(cli): Remove "type" module from package.json

* fix/packages/modules (#2510)

* fix/packages/modules

* docs: changeset

* empty commit

* fix(cli): adding ApiConfigSchema zod type to zli (#2511)

* Revert "fix/packages/modules (#2510)"

This reverts commit 663bed8.

* Revert "refactor(cli): Remove "type" module from package.json"

This reverts commit 43b4cac.

* fix(cli): adding ApiConfigSchema zod type

* Revert "refactor(cli): rework cli to support import without type module in package.json (#2509)"

This reverts commit e2f0f5f.

* Delete packages/cli/TODO.md

---------

Co-authored-by: Øyvind Eikeland <43904393+eikeland@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 💾 CLI fusion framework CLI 👨🏻‍🍳 cookbooks 📚 documentation Improvements or additions to documentation 🚀 feature New feature or request 🧬 Modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants