-
Notifications
You must be signed in to change notification settings - Fork 15
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
Revert "fix: use lerna to share code instead of copying resources (#214) #216
Conversation
…)" This reverts commit eecfea0.
How are you pulling in the plugin in dashboards? You will need to create a plugin bundle file which contains all of the dependencies in the bundle. This requires building the plugin with e.g. Webpack. |
Currently the plugin build is just a transpiled build: https://github.com/d2-ci/data-visualizer-plugin |
I've been trying to work with the existing app/plugin split in DV and I don't find it usable. I really don't think they should exist as separate packages, they should just be separate entrypoints to the same package (i.e. webpack bundles as @varl mentioned). This isn't natively supported by CRA, but it could be layered on top of CRA. It will also be built into the next-gen app build infrastructure. |
I thought in general we did not want to create bundles, so that we can do treeshaking? If I do this, then I add more customization to the webpack file, which is what we want to move away from. |
I think that's a good goal eventually, but I don't think it's the right optimization here for two reasons:
|
Can you be more specific about what you dont find "usable"? Yes, I know it should be tagged so the apps can be assured to get the desired functionality. What else?
This requires more discussion, and doesn't really help me out right now. The issue I'm trying to fix right now is for the dashboard to build with a tagged version of the plugin so we get rid of the plugin issues that people are experiencing. So yes, this is obviously a short term solution. |
It doesn't link into dashboards because the app code isn't transpiled. Bundling the plugin with webpack would solve this, so that it pulls in the dependent code from the app when it's built. I can take a stab at fixing that if you'd like. I believe that's an alternative solution to backing out the switch to lerna and going back to using github for dependency resolution. |
Go ahead :) |
App to app dependencies is a messy system architecture, and I do not think it's a good idea when considering the larger picture of our ecosystem. App to app dependencies is one point I am unwilling to budge on until we have exhausted all other options. Having them in separate packages allows us to be explicit about which app has a plugin and which does not, and other apps can depend on the plugin. It's not a perfect solution but I vastly prefer it over app to app dependencies.
When creating the IIRC that plugin exposes a single component which presumably uses everything left in the bundle, so there shouldn't be anything left to shake out? |
Can we try the bundle route first? |
I have another PR that I'm awaiting feedback on, where I am trying to figure out how to share other code. I agree that the "app" should not contain the shared code. #206
It was more about what the dashboard ends up bundling. In the case of this plugin, there probably isn't much common code between dashboard and what the plugin uses, it was more of a principle thing. |
Things like Mui aren't de-duplicated when bundled at the plugin level instead of at the host app (Dashboards) level (Dependencies could theoretically exist in the host app and also every plugin). So yeah, we're good for tree-shaking but not for de-duplication.
I agree we should avoid arbitrary app-to-app dependencies (which is exactly what we have here, just with a "plugin" shim between the two apps). However, having two different "artifacts" of an app build (one app, one plugin) seems quite a bit safer. |
Yes, let's. |
Ah, as a principle, yes. Bundling here is to strike a pragmatic balance.
You're right, that's an important distinction. |
Agreed, though that "shim" layer at least keeps the system level architecture some-what sane and I can maintain a graph of how the apps interact. If we start to introduce inter-app dependencies before we've even gotten rid of the single one we have (core-resource-app) my brain is going to melt.
Essentially that is what was the plan with using Lerna for these app+plugin packages. Each build would produce two artifacts: one app artifact and one plugin artifact. The app would be used for DHIS2 and the plugin would be published to NPM so other apps can use it. There are different technical was to go about this, and there are some drawbacks to each, but the principle of creating two artifacts from the same source is the same. |
I've merged this. Here is the commit message: Revert "fix: use lerna to share code instead of copying resources (#214)" (#216)
|
# [33.0.0](v32.0.3...v33.0.0) (2020-02-12) ### Bug Fixes * @dhis2/analytics 2.6.11 ([#448](#448)) ([231bcd8](231bcd8)) * added icons to tooltip for warning and locked ([#447](#447)) ([26a95e8](26a95e8)) * added lint, commit message and test commit/push hooks ([#526](#526)) ([0292a63](0292a63)) * adjust options dialog for easier scanning ([#580](#580)) ([b0393ff](b0393ff)) * assigned categories and new dimension types ([#576](#576)) ([2faae50](2faae50)) * avoid infinite loading and make chart plugin use hooks (DHIS2-8290) ([#653](#653)) ([9de60dd](9de60dd)) * avoid React warning about required proptype ([#311](#311)) ([5dda862](5dda862)) * changed height to min-height for the axes area ([#361](#361)) ([8c0ed13](8c0ed13)) * changed incorrect prop types and tests ([#372](#372)) ([c96ac09](c96ac09)) * chip cursor ([#566](#566)) ([8701256](8701256)) * convert numeric options to strings to silence ui-core warnings ([#617](#617)) ([c3fe18d](c3fe18d)) * correctly set showDimensionLabels option ([#621](#621)) ([01427ac](01427ac)) * d2-ui-analytics 1.0.2 ([#277](#277)) ([62241f8](62241f8)) * dashboard items resize should trigger chart reload ([#282](#282)) ([86070ae](86070ae)) * dimension dialog update validation ([#486](#486)) ([429c51e](429c51e)) * dimensions panel divided in to sections ([#581](#581)) ([3a9627a](3a9627a)) * do not run default adapter for pivot tables ([#616](#616)) ([27d8ab7](27d8ab7)) * don't render pivot table before data has loaded ([#635](#635)) ([844d989](844d989)) * download menu options for PT ([#624](#624)) ([c131970](c131970)) * dynamic axis names based on vis type ([#623](#623)) ([24510e0](24510e0)) * equal padding for the AO title bar ([#567](#567)) ([17238ed](17238ed)) * Fetching analytics for analytical object with undefined aggregationType in plugin ([#232](#232)) ([bfe41b4](bfe41b4)) * Fetching analytics for year over year charts in plugin ([#231](#231)) ([16853ef](16853ef)) * fix prop type for value in SortOrder option component ([#568](#568)) ([8379621](8379621)) * fix styling issues in options ([#585](#585)) ([d4c5bc6](d4c5bc6)) * fix values for topLimit option ([#579](#579)) ([3d249a6](3d249a6)) * fixes for DND between axes ([#554](#554)) ([886de23](886de23)) * fixes for options with numeric values and toggleable Select ([#583](#583)) ([8a40296](8a40296)) * gauge now follows the behaviour of single value instead of pie ([#489](#489)) ([9969e61](9969e61)) * gauge plot lines and range values in options ([#654](#654)) ([7736b29](7736b29)) * i18n merge conflict ([ac8c383](ac8c383)) * impl max dims rule ([#517](#517)) ([241de69](241de69)) * implemented the error code for assigned categories ([#557](#557)) ([7b9f52b](7b9f52b)) * layout for pivot tables ([#577](#577)) ([033be21](033be21)) * loading spinner for plugins (DHIS2-8117) ([#587](#587)) ([f8be30b](f8be30b)) * locked dims not array ([#491](#491)) ([15ae8a8](15ae8a8)) * long names for dimensions, chip and tooltip (DHIS2-7932) ([#556](#556)) ([2212398](2212398)) * manifest credentials bug in chrome ([#233](#233)) ([a0032e0](a0032e0)) * map is not vis type ([#371](#371)) ([22c36e2](22c36e2)) * merge conflicts ([3eb1c77](3eb1c77)) * only point series to axes for certain types ([#264](#264)) ([24b6ac0](24b6ac0)) * only run empty check after all values have been added ([#627](#627)) ([75b6ae4](75b6ae4)) * open modal for empty dims ([#625](#625)) ([e07d786](e07d786)) * options with numeric values (sortOrder) ([#564](#564)) ([94ad11d](94ad11d)) * org unit selector - only act on path if it exists ([#276](#276)) ([9299038](9299038)) * pie tooltip DHIS2-7532 ([#330](#330)) ([72eb5db](72eb5db)) * pin to analytics@2.6.11 ([#495](#495)) ([5f21406](5f21406)) * pin to analytics@2.6.11 ([#495](#495)) ([25b4545](25b4545)) * properly set layout on vis type change for all vis types ([#586](#586)) ([489fbf9](489fbf9)) * provide useful error messages (DHIS2-5029) ([#552](#552)) ([ef16c68](ef16c68)) * remove api.baseUrl duplicate ([#573](#573)) ([ac05af6](ac05af6)) * remove code climate config for now ([80c891a](80c891a)) * remove colon from chip if no selection ([#312](#312)) ([e667134](e667134)) * remove custom title when Auto is selected (DHIS2-8252) ([#636](#636)) ([44ed1a5](44ed1a5)) * remove ripple effect in dimension list when drag starts/ends ([#584](#584)) ([c91ed3b](c91ed3b)) * rename axis name constants ([#445](#445)) ([b75967a](b75967a)) * rules dim handling ([#446](#446)) ([445f1d8](445f1d8)) * single value without dx items ([#313](#313)) ([f1fbe22](f1fbe22)) * start screen icons ([#558](#558)) ([841c9c7](841c9c7)) * swap full axis dims to filter ([#518](#518)) ([a79e329](a79e329)) * tooltip message ([#449](#449)) ([ca55b7e](ca55b7e)) * turn class vars into functions ([#569](#569)) ([236885b](236885b)) * ui glitches ([#618](#618)) ([2788daf](2788daf)) * ui updates to the start screen ([#548](#548)) ([20dd6ca](20dd6ca)) * ui updates to the start screen ([#548](#548)) ([fee2153](fee2153)) * update @dhis2/analytics dependency ([#319](#319)) ([5752bea](5752bea)) * update analytics and plugin dep ([#324](#324)) ([8bb0202](8bb0202)) * update charts api dep ([#297](#297)) ([ab13e1c](ab13e1c)) * update gradient colors check ([#261](#261)) ([b39cec2](b39cec2)) * update plugin dependency ([#318](#318)) ([452a287](452a287)) * update plugin version ([#320](#320)) ([3921334](3921334)) * update recuder to handle empty axes ([#630](#630)) ([077dd68](077dd68)) * updated proptype for error ([#553](#553)) ([21a9b4a](21a9b4a)) * upgrade @dhis2/analytics to fix dimension dialog styling ([#551](#551)) ([c90f2b8](c90f2b8)) * upgrade @dhis2/cli-app-scripts and use platform-provided height ([#550](#550)) ([b6ffdfb](b6ffdfb)) * upgrade cli-app-scripts to fix package resolution ([#540](#540)) ([a52f7f3](a52f7f3)) * use a doc-like icon for PT downloads ([#626](#626)) ([a407372](a407372)) * use axisName instead of axisKey ([204fe7a](204fe7a)) * use layout type to get the right layout comp ([#563](#563)) ([17c26ba](17c26ba)) * use locked dimensions rule from analytics ([#444](#444)) ([883304f](883304f)) * use max items rule ([#373](#373)) ([ded0ee9](ded0ee9)) * use shared vis types ([#368](#368)) ([26d12c6](26d12c6)) * viewport layout with visible interpretations panel ([#323](#323)) ([2e2803b](2e2803b)) * vis type imports ([#496](#496)) ([2a1daaf](2a1daaf)) ### chore * **github-actions:** add workflows for lint and publish ([#638](#638)) ([739bb13](739bb13)) ### Features * add dnd from dimensions to specific position in layout axis ([#575](#575)) ([7c573b7](7c573b7)) * assigned categories DHIS2-7701 ([#539](#539)) ([636b365](636b365)) * drag 'n drop for reordering dimension items in layout ([#519](#519)) ([efd4acb](efd4acb)) * dual axis support ([#239](#239)) ([a50075c](a50075c)) * multiple orgunit roots support ([#328](#328)) ([e85668f](e85668f)) * show most viewed saved AO (DHIS2-7835) ([#547](#547)) ([97b0622](97b0622)) * summarize chart filters that have orgunit levels and/or groups ([#298](#298)) ([e5e0a7b](e5e0a7b)) * use layout rules for add-to-layout ui ([#362](#362)) ([a3dbb9f](a3dbb9f)) * use new pivot engine ([#574](#574)) ([f4ccef1](f4ccef1)) * WIP pivot table type ([#335](#335)) ([626f447](626f447)) ### Reverts * Revert "fix: use lerna to share code instead of copying resources (#214)" (#216) ([de00b4f](de00b4f)), closes [#214](#214) [#216](#216) ### BREAKING CHANGES * **github-actions:** Ensure that the plugin and app versions are locked to each other.
🎉 This PR is included in version 33.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [32.1.0](v32.0.3...v32.1.0) (2020-06-08) ### Bug Fixes * upgrade d2-ui dependencies for latest translations [v32] [DHIS2-8892] ([#1061](#1061)) ([6bc2f8c](6bc2f8c)) * **translations:** sync translations from transifex (v32) ([ff4839e](ff4839e)) * **translations:** sync translations from transifex (v32) ([bb026d0](bb026d0)) * **translations:** sync translations from transifex (v32) ([c15e3b6](c15e3b6)) * **translations:** sync translations from transifex (v32) ([0620c69](0620c69)) * @dhis2/analytics@2.4.9 ([4ed10df](4ed10df)) * allow : after bold and italic ([#314](#314)) ([59aed20](59aed20)) * changed height to min-height for the axes area ([#361](#361)) ([#366](#366)) ([5848460](5848460)) * d2-charts-api@32.0.9 ([27eff19](27eff19)) * deep check styles for changes ([#283](#283)) ([e76555c](e76555c)) * display 'and x others...' on tooltip (DHIS2-8753) v32 backport ([#945](#945)) ([0590fdf](0590fdf)), closes [#927](#927) [#925](#925) * epi curve bug (v32) ([#529](#529)) ([2908206](2908206)) * epi curve bug v32 (v2) ([#530](#530)) ([de40d3d](de40d3d)) * Fetching analytics for analytical object with undefined aggregationType in plugin ([#232](#232)) ([bfe41b4](bfe41b4)) * Fetching analytics for year over year charts in plugin ([#231](#231)) ([16853ef](16853ef)) * manifest credentials bug in chrome ([#233](#233)) ([a0032e0](a0032e0)) * merge conflict ([#545](#545)) ([8e5f7aa](8e5f7aa)) * pie tooltip v32 ([#332](#332)) ([77b2628](77b2628)) * plugin - add deep checks to determine whether to redraw chart ([#284](#284)) ([4b8837e](4b8837e)) * remove api.baseUrl duplicate ([#571](#571)) ([fafd58e](fafd58e)) * v32 backport, upgraded to Analytics v2.4.7 to support long dimension names (DHIS2-7932) ([#622](#622)) ([2cd524a](2cd524a)) * working translations [v32] ([#1001](#1001)) ([c32c623](c32c623)) ### Features * dual axis support ([#239](#239)) ([a50075c](a50075c)) * multiple org units support ([#333](#333)) ([6392efa](6392efa)) ### Reverts * Revert "fix: use lerna to share code instead of copying resources (#214)" (#216) ([de00b4f](de00b4f)), closes [#214](#214) [#216](#216)
🎉 This PR is included in version 32.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 33.1.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This reverts commit eecfea0.
The code-sharing solution does not work when the plugin is pulled in as a dependency in other apps (e.g., dashboards), since imports like:
import { apiFetchVisualization } from 'data-visualizer-app/src/api/visualization';
don't exist in dashboards. This code will have to remain duplicated until we are ready with a published, shared library.