-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
chore(Ux-Core): switch to rollup, return configure promise #147
Conversation
@ZHollingshead I'd love it if you could take a look into this. @bigopon has some great ideas here. |
@bigopon Is this something we should also look at for all the modules we convert to TS for the Aurelia port? |
@ZHollingShead came up with the single file idea. For the port, i think so |
I will look at this in the morning. Thanks!
…On Feb 2, 2018 1:05 AM, "bigopon" ***@***.***> wrote:
@ZHollingshead <https://github.com/zhollingshead> came up with the single
file idea. For the port, i think so
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#147 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AVJVBzUiRMikS5uuj9vBPlNY3MLRTJGKks5tQrOqgaJpZM4R2pkj>
.
|
@bigopon @EisenbergEffect I had been thinking that if we wanted to make things more beginner friendly, we could the On the single file front, I think I may have miscommunicated. I was thinking of toying around with something like Universal Module Definition where we could produce a single output that will work across all loaders to decrease build times rather than build four separate distributions. I do however like the idea of the output being put into a single file, will that improve performance? Will it affect bundle sizes? |
Only the first call will actually do things so performance overhead is non existence. Because of this, it will always be the same instance of UX core. For the module output, it is fairly easy I believe, but I was following our "tradition", exporting it as different module types. This call will be up to @ZHollingshead and @EisenbergEffect . Doing this could help us to trim the amount of files in distribution folder / files |
What about the configuration? UX Core requires a configuration. If that is in each individual component now, wouldn't you have to pass in the same configuration to each one if it does not use the default config? I am not sure how I feel about hiding the plugin setup for UX Core inside of components since UX Core also has its own features that it brings to the table. In most scenarios I feel people would take a standard configuration of all components (e.g. To me, hiding the |
The config ux core receives is the same with the config each component receives. So passing it around is safe, You can see it from this line in framework repo https://github.com/aurelia/framework/blob/master/src/framework-configuration.js#L385 Basically all globally applied plugin will have the same first instance of framework configuration as its parameter.
With this PR changes, you can do either export function configure(aurelia: Aurelia) {
aurelia.use.plugin('@aurelia-ux/core');
aurelia.use.plugin('@aurelia-ux/select/index');
} or just export function configure(aurelia: Aurelia) {
aurelia.use.plugin('@aurelia-ux/select/index');
} There is no difference between them. |
For the distribution, I think we can distribute it like: 📁dist
instead of wrapping in folders. @EisenbergEffect @ZHollingshead |
If there are no performance hits, then I think this could be useful. |
@bigopon Is this ready to do then? |
Let me adjust types, currently it emits types to all distribution, but I think it can be in only one folder
thoughts ? @EisenbergEffect @ZHollingshead |
17b105f
to
627381b
Compare
It's ready to use, test locally via lerna run build --scope @aurelia-ux/core @EisenbergEffect @ZHollingshead @jdanyow |
I think the export declare function configure(
config: FrameworkConfiguration,
callback?: (config: AureliaUX) => Promise<any>
): Promise<AureliaUX>; |
627381b
to
634d7f4
Compare
@ZHollingshead Feel free to merge :) No need for my approval. |
looking forward to learning all this bundling and distribution ninja-stuff (-: |
@ZHollingshead Good to go now. I also added first test for ux element config. As aurelia/framework#858 is getting merged soon, we can start rolling every |
@ZHollingshead I'm wondering how we can enforce |
If we add those as a dependency to the |
Does that mean that we have to add it to everyone of them or just the root ? This PR doesn't need any more modification in |
Given that all the components rely on |
👍 @ZHollingshead . This one can be merged. All done here then. |
Oh actually I was having issue with the test in global style engine. Not sure why. Did it work for you ? |
I have not re run the tests on this yet. I am planning to merge after 0.8.0 goes out so we have time to play with the new build setup. |
At the moment all ux modules are distributed as is, which means they are not bundled into a single file for distribution. This could lead to a drop in startup performance where the browser have to deal with many modules, either via webpack / requirejs / systemjs. This PR introduces rollup, in a basic usage, to concatenate all modules of
@aurelia-ux/core
into a single javascript file for distribution, as this cannot be done easily with only typescript as it supports--outFile
for onlyamd
andsystem
module types. Besides this, allcss
/html
distribution configurations could also sit together within oneconfig.rollup.js
file, which is a plus.There are also changes in the
configure
function of@aurelia-ux/core
, it now will return a promise that will be resolved once the ux configuration finished, and also cache it. This can be leveraged as ux components will be able to call it repeatedly without worrying about side effect, also helps synchronously load ux custom elements (will give more detail in another PR).before, in
main.ts
We see that
ux-core
is always needed to be mentioned beforeux-select
, could be beginner unfriendly.after, in
@aurelia-ux/select/index
and in
main.ts
https://gist.run/?id=7787dea956bffeca3c0bd7c342b69819
The gist above is an example of how a distribution file of
ux-core
module looks like with this change.@EisenbergEffect @ZHollingshead
Edit:
Step 2 of this will be ability to distribute each ux component as a single javascript file, with templates inlined to the custom element view model classes. I could already achieved this. But it depends on how this PR goes.