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

Remove proxy exports 🙌 #42

Merged
merged 10 commits into from
Sep 12, 2018
Merged

Remove proxy exports 🙌 #42

merged 10 commits into from
Sep 12, 2018

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Sep 12, 2018

NOTE: the #40 should be merged first

Since we have almost migrated the imports in our codebase, we can remove the proxy-exports workarounds in the next release.

I also re-arranged a bit some other parts:

  • materials is a top level folder and only contains *.mod.css files
  • images is now a top level folder
  • constraints and spacings have been moved to src/components
  • messages are now scoped as a import { i18n } from '@commercetools-frontend/ui-kit; export

@dferber90
Copy link
Contributor

dferber90 commented Sep 12, 2018

Thanks for this! Should we also tacke the Icons here?

@emmenko
Copy link
Member Author

emmenko commented Sep 12, 2018

I'd prefer to do it separately. We can however provide the named export Icons already so that the migration is easier. Then remove the top level icon exports in a next major release.

WDYT?

@emmenko
Copy link
Member Author

emmenko commented Sep 12, 2018

image

.npmignore Outdated
@@ -0,0 +1 @@
*.story.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? If both, .npmignore and .gitignore are present, then it will use only the .npmignore! So this change undoes the exclusion done by .gitignore

In simpler terms, npm prefers the .npmignore file if it is there, but will fall back to the .gitignore file. So if both are present, it will use the .npmignore file.

Source: https://stackoverflow.com/a/24942436

This also means that we would be exposing any sensitive files excluded from .gitignore as we'd be bundling them into the package as mentioned in For the love of god, don’t use .npmignore whose title I found pretty funny.

I'd use the files field instead, which we seem to be using as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good point. I just wanted to ignore stories to be published as well

Copy link
Contributor

Choose a reason for hiding this comment

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

I’m not even sure it works at the moment because of npm/npm#11669. I’m on the phone now so I could not verify.

.npmignore Outdated
@@ -0,0 +1 @@
*.story.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we no longer publishing from dist by copying the package.json over or why did you feel that we need this? The stories shouldn't end up there in any case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we don't need to "publish from dist" anymore. It's just that we have some *.story.js files in the materials folder and I thought it would be good to not publish those

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explaining. I googled a bit and this seems like the best option after all.

@dferber90
Copy link
Contributor

dferber90 commented Sep 12, 2018

Yeah, let's do the Icons separately then. This PR is already pretty big.

@emmenko emmenko force-pushed the nm-remove-proxy-exports branch from 562ea2f to a59bb6b Compare September 12, 2018 12:18
@emmenko emmenko changed the base branch from nm-optimize-bundle-sizes to master September 12, 2018 12:19
@emmenko
Copy link
Member Author

emmenko commented Sep 12, 2018

@dferber90 I changed it a bit, can you check again? 28cef77

@emmenko
Copy link
Member Author

emmenko commented Sep 12, 2018

To confirm:

image

@@ -23,6 +25,8 @@ export { default as FieldLabel } from './components/field-label';

export { default as TextField } from './components/fields/text-field';

export { Icons };
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the new Icons export

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it would be worth following up here with possibly code splitting this?

@@ -23,6 +25,8 @@ export { default as FieldLabel } from './components/field-label';

export { default as TextField } from './components/fields/text-field';

export { Icons };
// TODO: this type of export is deprecated and should be removed in the next major release
export * from './components/icons';
Copy link
Member Author

Choose a reason for hiding this comment

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

This is kept for backwards compatibility and will be removed in the next major release

@@ -68,3 +71,5 @@ export { default as Text } from './components/typography/text';

export { default as withMouseDownState } from './hocs/with-mouse-down-state';
export { default as withMouseOverState } from './hocs/with-mouse-over-state';

export { i18n };
Copy link
Member Author

Choose a reason for hiding this comment

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

This is also now its own named export

Copy link
Contributor

@dferber90 dferber90 left a comment

Choose a reason for hiding this comment

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

I guess we'll see whether it works for real once we try it out in the MC. Let's give it a spin!

@emmenko emmenko merged commit 0d46b4e into master Sep 12, 2018
@emmenko emmenko deleted the nm-remove-proxy-exports branch September 12, 2018 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants