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):enable widget development with fusion cli #1854

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

Noggling
Copy link
Collaborator

@Noggling Noggling commented Feb 15, 2024

Why

Expanding the Fusion CLI introduces the capability to create widgets, enhancing development server configuration via dev.config.ts.

The development configuration empowers users to tailor the underlying Express server.

import { createDevConfig } from '@equinor/fusion-framework-cli';
import httpProxy from "http-proxy"

const proxy = httpProxy.createProxyServer();

const targetServer = 'http://example.com'; 

export default createDevConfig(() => ({
    express: (app)=>{
          app.all('*', (req, res) => {
            proxy.web(req, res, { target: targetServer });
          });
          
          // Error handling for proxy
          proxy.on('error', (err, req, res) => {
            console.error('Proxy Error:', err);
            res.status(500).send('Proxy Error');
          });
          
},
}));
import { createDevConfig } from '@equinor/fusion-framework-cli';

export default createDevConfig(() => ({
    widgets: [
        {
            entryPoint: '/src/index.ts',
            assetPath: '../widget-react-test/',
            name: 'widget1',
        },
        {
            entryPoint: '/src/index.ts',
            assetPath: '../widget-react-test2/',
            name: 'widget2',
        },
    ],
}));

Additionally, a helper for widget development has been incorporated. The entry point can be configured to both compiled and source code. If set to source, developers gain the ability to utilize hot module replacements/auto-reload during development.

Additionally, three cookbooks have been included, showcasing an application and two widgets to illustrate the widget and its functionalities.

closes:

Check off the following:

  • Confirm that I checked changes to branch which I am merging into.

    • I have validated included files
    • My code does not generate new linting warnings
    • My PR is not a duplicate, check existing pr`s
  • Confirm that the I have completed the self-review checklist.

  • Confirm that my changes meet our code of conduct.

Copy link

changeset-bot bot commented Feb 15, 2024

🦋 Changeset detected

Latest commit: acdcb9b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@equinor/fusion-framework-cookbook-widget-react-test2 Major
@equinor/fusion-framework-cookbook-widget-react-test Major
@equinor/fusion-framework-cookbook-app-react-widget Major
@equinor/fusion-framework-cli Major
@equinor/fusion-framework-module-widget Patch
@equinor/fusion-framework-react-widget Patch
@equinor/fusion-framework-react-app Patch
@equinor/fusion-framework-react Patch
@equinor/fusion-framework-cookbook-app-react-context Patch
@equinor/fusion-framework-cookbook-app-react-feature-flag Patch
@equinor/fusion-framework-widget Patch
@equinor/fusion-framework-legacy-interopt Patch
@equinor/fusion-framework-react-components-bookmark Patch
@equinor/fusion-framework-react-components-people-provider Patch
@equinor/fusion-framework-react-module-bookmark Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added 🐞 bug Something isn't working 👨🏻‍🍳 cookbooks 👾 React 💾 CLI fusion framework CLI 📚 documentation Improvements or additions to documentation 🚀 feature New feature or request 🚧 chore maintaines work, (update deps, workflos ...) 🧬 Modules labels Feb 15, 2024
@Noggling Noggling changed the title Feat/widget cli feat(CLI):enable widget development with fusion cli Feb 16, 2024
@kjellhaaland
Copy link

@Noggling i see that this PR is a draft, is there anything that needs to be done before its ready for a stable release?
Depend on this in order to finish the work on 3D/Echo Widget in equinor/cc-components#887.

@Noggling
Copy link
Collaborator Author

This is all up to @odinr to deside on how he wants it. this has only been preview enabling us to develop widgets in with applicaions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🚧 chore maintaines work, (update deps, workflos ...) 💾 CLI fusion framework CLI 👨🏻‍🍳 cookbooks 📚 documentation Improvements or additions to documentation 🚀 feature New feature or request 🧬 Modules 👾 React
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants