-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Revise process of making bundles and simplify making partial bundles #5508
Conversation
- simplify lib folder and generate index files for partial bundles in build - remove confusing dev flags from dist bundle - make a separate script for partial bundles - integrate header_dist into bundle tasks
I feel like removing all these files from |
That's a good point @nicolaskruchten - I suppose we could keep them around but not use them ourselves, and deprecate them so they can be removed in v3? I guess perhaps the purpose of having this extra layer was to make it clear to folks where the entry points are for |
Q1: In addition to traces, transforms, calendars components do we want to keep |
I still think that having those redundant lib files are more confusing than helpful for the users as well as contributors. BTW here is an example script to generate a custom bundle including
It also generates and prints the |
I agree they're confusing but I think we should keep them anyway, to reduce the number of breaking changes in 2.0. |
If we want to keep this folder around we should cleanup |
Why don't we just leave |
We shouldn't keep unused files as the API input. Here is one risk: |
We can generate them if you feel strongly about it :) |
100%. |
Ah I think we're misunderstanding each other: I really want these to not be removed in this PR, as this would constitute a new breaking change for people who have followed the instructions in our readme. If you want to generate these identical files moving forward that's fine with me. |
Are you referring to a README other than |
Nope... the main readme contains this section https://github.com/plotly/plotly.js#modules |
Related PR: #202 |
Also interesting to see here that users were actually looking for a partial-bundle script. |
Yes, I agree that the current readme is not really all that helpful in that it doesn't show how to actually make a custom bundle, which is what this current PR is meant to do. But I also don't want to break things for folks who have followed these instructions that have been in our readme for a long time. Basically: these lib files are part of the documented, public API for 1.x and I don't want this removal to be part of the 2.x breakage please. |
- generated component files using preprocess in lib - deprecate component files in lib
… lib folder - generated index files for our partial bundles using extra-bundles script
|
lib/core.js
Outdated
@@ -1,3 +0,0 @@ | |||
'use strict'; | |||
|
|||
module.exports = require('../src/core'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we'd better bring this file back, as it was referenced in the readme
lib/index-basic.js
Outdated
]); | ||
|
||
module.exports = require('./register_extra')(Plotly); | ||
module.exports = (function(Plotly) { return Plotly; })(core); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally it feels to me like this indirection makes things more confusing than the previous pattern - which with register_extra
removed becomes just:
var Plotly = require('../src/core');
Plotly.register([...]);
module.exports = Plotly;
Is there another reason for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
register_extra
file is not documented and confusing.
Until we could bump d3 (cc: #5112) or possibly release a @plotly/d3-v3
patch to fix unexpected characters at build time we need a function to the return correct result.
require('./violin'), | ||
require('./image'), | ||
require('./pie'), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, image
and pie
used to be registered in a different order in cartesian
bundles.
require('./ohlc'), | ||
require('./candlestick'), | ||
require('./funnel'), | ||
require('./waterfall'), | ||
require('./indicator') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, funnel
and waterfall
and indicator
used to be registered in a different order in finance
bundles.
README.md
Outdated
@@ -96,13 +96,9 @@ Then elsewhere in your code: | |||
var Plotly = require('./path/to/custom-plotly'); | |||
``` | |||
|
|||
#### Non-ascii characters | |||
Alternatively you could browserify a custom bundle of desired trace modules e.g. `pie` and `choropleth` using | |||
`npm run partial-bundle pie choropleth name=custom` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice if this followed the usual command-line flag patterns and hence had --name=custom
instead of just name=custom
IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a side note I don't want to rely on minimist; but OK I could look for --name
when parsing the arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8d902aa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 LGTM!
Resolves #5484.
Also resolves #4949.
Now one could simply use
to have "browserified" partial bundles (both minified and unminified) in
dist
folder.As displayed in the output of this program the temporary index file for such custom build would be created inside
build
folder notlib
and would be labeled asindex-custom.js
.Also to mention regarding this PR:
lib
folder is now auto-generatedtraces
,transforms
andcalendars
files insidelib
folder as "deprecated"index.js
registering order in all bundlesheader_dist
task into bundle tasksdist
bundle@plotly/plotly_js