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

add support for workspaces #86

Merged
merged 28 commits into from
Feb 19, 2020
Merged

add support for workspaces #86

merged 28 commits into from
Feb 19, 2020

Conversation

nataly87s
Copy link
Contributor

@nataly87s nataly87s commented Dec 30, 2019

#85

@nataly87s nataly87s marked this pull request as ready for review January 2, 2020 09:24
client/cli/lib/build.ts Outdated Show resolved Hide resolved
client/cli/lib/publish.ts Outdated Show resolved Hide resolved
client/cli/lib/utils.ts Outdated Show resolved Hide resolved

app
.route('/:component')
.all((req, res, next) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this check can be skipped if you create the routes in a forEach loop on the index...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also adds the component to the request

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw that but if you work in the closure of a foreach you get the component's name from the parameters so you don't need to add the name...

index.forEach(nameOfComponents => app.route(/nameOfComponents).get((req, res) => {
      res.setHeader('Access-Control-Expose-Headers', 'ETag');
      const component = nameOfComponent;
      res.sendFile(resolve(process.cwd(), component.dir, 'dist', component.main));
    }));

Removes validation code... Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then you don't get the logger warning if you're trying to get a non existing component

client/cli/lib/start.ts Outdated Show resolved Hide resolved

console.warn(`failed getting component ${name} from dev server`, err);

if (!devMode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How can I get to this code path with !devMode?

Copy link
Contributor

Choose a reason for hiding this comment

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

So the approach here is that if I have devMode === false I'm in global dev mode... mode... and so I should treat all components in dev mode? I would prefer to be more explicit... how about returning from the provider some property that says devModeOverride or globalDevMode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you're in global dev mode, you get a dev client from the provider.
if the component is explicitly using dev mode we won't try getting the component from remote server and render the fallback
if the component is not explicitly using dev mode we try getting the component from remote server, and if that fails too render fallback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also added - if you explicitly set devMode: false on a component, it will not use global devMode

client/react/lib/index.tsx Outdated Show resolved Hide resolved
@eladav
Copy link
Contributor

eladav commented Jan 13, 2020

I know there are a lot of comments but this is a huge (and awesome) new capability!
There are quite a few changes, feel free to tell me that I'm talking nonsense...

@nataly87s nataly87s force-pushed the workspaces branch 2 times, most recently from d8c0fd0 to 2bcbc10 Compare January 16, 2020 20:33
@robotnoises
Copy link

Just a general comment but this looks awesome and we are very much looking forward to using this enhancement in Soluto Nashville! 💯

@nataly87s
Copy link
Contributor Author

@eladav I added support for config files per package when using workspaces

@nataly87s
Copy link
Contributor Author

@eladav @EladBezalel what's up? any comments? requests? something?

@@ -0,0 +1,65 @@
import { resolve } from 'path';
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

interval?: number;
urlOverride?: string;
}

export class DynamicoDevClient extends DynamicoClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure I understand why is there a need to remove the inheritance here? wouldn't it work just the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the api is different so inheritance doesn't make sense.
You said you used inheritance because you didn't want to duplicate code/logic, and I accomplished that by just using the regular client internally

Copy link
Contributor

@eladav eladav left a comment

Choose a reason for hiding this comment

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

This is a good change (and also you improved other parts of the code)... Talk to us when you want to start using this and we'll support you. I'm not sure I understand the reason to remove the inheritance in from DevClient but we can refactor this at a later time. as soon as you'll merge we'll publish this version.

@nataly87s
Copy link
Contributor Author

@eladav @EladBezalel I don't have permissions to merge

@eladav eladav merged commit 2f53221 into OS-Guild:master Feb 19, 2020
@nataly87s nataly87s deleted the workspaces branch February 19, 2020 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants