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

fix: Only export components when publishing #177

Merged
merged 9 commits into from
Jan 16, 2019

Conversation

jeffredodd
Copy link
Contributor

@jeffredodd jeffredodd commented Jan 11, 2019

Hey everyone, the goal of this PR is to only publish our components to npm and to leave the tests, component documentation, and other CreateReactApp leftovers behind. This will reduce the payload we send to consumers and simply our outputted package while leaving the structure mostly intact to allow for simple contributions and also resolves #105.

I have performed the following...

  • Migrated required docs (application) files to _playground
  • Updated Babel to ignore tests, component documentation, and new _playground folder
  • Updated main index.js file to no longer have documentation site components
  • Altered Routes.js to point to existing components correctly

Feel free to pull this down and test the changes i've made and let me know what you think. It might help to poke around on master's dist folder first to see what was omitted in this branch.

This branch also should not go in until publishing on master is fixed.

jbadan
jbadan previously requested changes Jan 11, 2019
Copy link
Contributor

@jbadan jbadan left a comment

Choose a reason for hiding this comment

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

Blocking merge until permissions are fixed for fundamental-bot

@jeffredodd
Copy link
Contributor Author

Also I'm up for a name thats different from _playground. I just figured _ indicates private so that was a good start for us.

Copy link
Contributor

@greg-a-smith greg-a-smith left a comment

Choose a reason for hiding this comment

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

A few things:

  1. I am still seeing the documentation directory show up in dist. Should it be?
  2. If we are going to isolate the playground from the other src directories, I would prefer a playground directory at the root rather than a _playground directory within src. Just my opinion.
  3. In the src/index.js file, it is importing react and react-dom, but I don't believe it needs to be.
  4. In the src/index.js file, I am wondering if this file should be refactored so each line is the import AND export to make it more readable. Example:
export {Alert} from '../src/Alert/Alert';

@jeffredodd
Copy link
Contributor Author

Hey @greg-a-smith!

  1. Good catch, fixed this in 3ce0940
  2. Sadly the Create React App scripts prevent this for the moment requiring us to keep everything inside src. I know this is annoying but we should be able to fix this later if needed.
  3. I addressed this in e2d896e
  4. I'll be fixing this momentarily

@jbadan jbadan dismissed their stale review January 14, 2019 21:27

no longer need to hold

src/index.js Outdated

ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
export { ActionBar } from '../src/ActionBar/ActionBar';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all of these should be rewritten to NOT include the src directory as I am still seeing the src directory in the path in the dist directory.

So:

export { ActionBar } from '../src/ActionBar/ActionBar';

should become:

export { ActionBar } from './ActionBar/ActionBar';

Copy link
Contributor

@greg-a-smith greg-a-smith left a comment

Choose a reason for hiding this comment

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

Looks good. 🚢

@greg-a-smith greg-a-smith merged commit 87df4c8 into master Jan 16, 2019
@greg-a-smith greg-a-smith deleted the fix/remove-doc-from-dist branch January 16, 2019 18:18
@greg-a-smith
Copy link
Contributor

I spoke with @jeffredodd, who is out sick, about taking over this PR to get it merged.

greg-a-smith pushed a commit that referenced this pull request Mar 5, 2019
* Initial change to only export library

* Remove documentation folder from Components

* Remove react and react-dom from component exports

* Updating index.js file to contain individual exports

* Quick fix to src src-ing

* Changed the jest coverage ignore path of the playground components
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.

Consider separating the library code from the examples (Playground)
3 participants