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 Vue wrapper packaging issue #236

Merged
merged 2 commits into from
Apr 22, 2019

Conversation

moores2
Copy link
Contributor

@moores2 moores2 commented Mar 27, 2019

Fixes #231

  • Set main for package correctly
  • Export \src and \dist to package, so that individual components can be imported by clients (like the React wrappers do).

Note: the vue-cli library build generates and extraneous dist/demo.html that does not work. There is an issue for this here: vuejs/vue-cli#3291

Review checklist (for reviewers only)

  • Demos all features
  • Documented/annotated
  • Matches UI/UX specs
  • Meets the code style guide
  • Accessible
  • Mobile first (responsive)
  • RTL support (bidirectional text)
  • Performant (limited bloat)

@netlify
Copy link

netlify bot commented Mar 27, 2019

Deploy preview for carbon-charts ready!

Built with commit 9b69345

https://deploy-preview-236--carbon-charts.netlify.com

Copy link
Member

@theiliad theiliad left a comment

Choose a reason for hiding this comment

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

Hi,
When released, the JS files are not in the dist directory anymore, but in root:
image

Also, did you see #231 (comment)? Would adding the ./src directory to the published package fix that? We should also have a bundle that includes everything in itself without the need of the ./src folder

Copy link
Contributor

@cal-smith cal-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 generally 👍 just a couple tweaks due to some build/deploy changes we've implemented

packages/vue/package.json Outdated Show resolved Hide resolved
packages/vue/package.json Outdated Show resolved Hide resolved
@theiliad
Copy link
Member

theiliad commented Apr 2, 2019

@moores2 We need to modify build.sh for the vue package now to include src:
https://github.com/carbon-design-system/carbon-charts/blob/master/packages/vue/build.sh

@cal-smith
Copy link
Contributor

from my comment here: #231 (comment)

do we need so ship src/? I figure it best to just let consumers deal with the compiled JS ... especially with Vue, consumers really don't get anything by having it available.

@theiliad
Copy link
Member

theiliad commented Apr 2, 2019

Yeah it would be preferable if we have a bundle that exports modules separately, and one that includes all where dev can use it through CDNs

@moores2
Copy link
Contributor Author

moores2 commented Apr 3, 2019

I have reworked index.js with a simpler approach, and added exports so that the source is not needed in the shipped package. This update should allow clients to load the wrappers in 2 ways:

Firstly, to just load all of the chart components globally into Vue by using a Vue plug-in, like this:

import Vue from 'vue';
import chartsVue from '@carbon/charts-vue';
...
Vue.use(chartsVue);
...
export default {
...
  template:
    '<ccv-bar-chart :data="barData" :options="barOptions"></ccv-bar-chart>'

The second option is to allow consumers to selectively import just the wrappers/components that they want, like this:

<template>
  ...
  <ccv-bar-chart :data="barData" :options="barOptions"></ccv-bar-chart>
  ...
</template>

<script>
import { CcvBarChart } from "@carbon/charts-vue";

export default {
  ...
  components: { CcvBarChart },
  ...
};
</script>

Copy link
Contributor

@cal-smith cal-smith left a comment

Choose a reason for hiding this comment

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

Awesome! 🎉 LGTM

@theiliad
Copy link
Member

@moores2 @cal-smith This looks good 💯
Do we need any changes in the deploy scripts for the correct bundles/files/directories to be picked up?

@cal-smith
Copy link
Contributor

Nope we're good to go 👍

@cal-smith
Copy link
Contributor

Merging

@cal-smith cal-smith merged commit 5b83f9f into carbon-design-system:master Apr 22, 2019
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.

WIP: Vue package does not have an index.js
3 participants