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

refactor(All): move build to rollup, update core deps #175

Closed
wants to merge 59 commits into from

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented Jun 22, 2018

Follow up the release of [email protected] & [email protected], we can register global resources with direct view model references. Now ux elements as a single bundle file, like following pic

image

The entry configure will look like this:

import {
  FrameworkConfiguration,
  bindingMode,
} from 'aurelia-framework';

import { ValueAttributeObserver, EventSubscriber } from 'aurelia-binding';

import { AureliaUX } from '@aurelia-ux/core';
import { UxSelect } from './ux-select';
import { UxOptGroup } from './ux-optgroup';
import { UxOption } from './ux-option';

export { UxOption, UxOptionElement } from './ux-option';
export { UxOptGroup, UxOptGroupElement } from './ux-optgroup';
export { UxSelect, UxSelectElement } from './ux-select';
export { UxSelectTheme } from './ux-select-theme';

export function configure(config: FrameworkConfiguration) {
  config.container.get(AureliaUX).registerUxElementConfig(uxSelectConfig);
  config.globalResources([
    UxSelect,
    UxOptGroup,
    UxOption,
  ]);
}

const uxSelectConfig = {
  tagName: 'ux-select',
  properties: {
    value: {
      defaultBindingMode: bindingMode.twoWay,
      getObserver(element: Element, _: string) {
        return new ValueAttributeObserver(element, 'value', new EventSubscriber(['change']));
      }
    }
  }
};

This can be applied for all elements, which should help reduce build time too.

@EisenbergEffect @ZHollingshead I not sure how to update jspm dependencies properly.

resolves #162

TODO list:

Copy link
Contributor

@serifine serifine left a comment

Choose a reason for hiding this comment

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

This looks great to me!

@bigopon
Copy link
Member Author

bigopon commented Jun 23, 2018

@ZHollingshead Sorry Didn't state clearly WIP, I'm not sure if I should move wholesale to rollup, or one or few first and the rest later.

@bigopon
Copy link
Member Author

bigopon commented Jun 23, 2018

@ZHollingshead @EisenbergEffect It would be also nice if we don't have to duplicate css files for each dist format, instead copy all css into a folder name css

@serifine
Copy link
Contributor

@bigopon Oh, whoops. Yeah I will get in and start testing.

I would be okay with doing it all at once if it works.

On the folder structure, originally you proposed an idea where we had the dist folder look like the following:

css/
types/
amd-index.js
commonjs-index.js
es2015-index.js
native-modules.js

If we do that, then we can just put the folders in the root one time yeah? What is required for that to work though, is that a situation where we need to configure loaders specially?

To be honest I am not sure how to update JSPM dependencies either. I am most experienced with Webpack at this point.

@serifine serifine changed the title refactor(All): move build to rollup, update core deps WIP refactor(All): move build to rollup, update core deps Jun 23, 2018
Copy link
Contributor

@serifine serifine left a comment

Choose a reason for hiding this comment

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

Just doing this to clear my approval.

@bigopon
Copy link
Member Author

bigopon commented Jun 23, 2018

we have an options to set dist folder of format or similarly named folder, maybe @jods4 can comment on how to have it work with webpack, without having to nested inside a folder.

@EisenbergEffect
Copy link
Contributor

I'd love to see this converted all at once, if possible :)

@bigopon
Copy link
Member Author

bigopon commented Jun 24, 2018

@EisenbergEffect @ZHollingshead That's pretty much it for the base work. Needs to update Webpack for html import in test, beside css test for all loaders to see if any issues.

import { inject } from 'aurelia-dependency-injection';
import { StyleEngine, UxComponent, PaperRipple, normalizeBooleanAttribute } from '@aurelia-ux/core';
import { UxButtonTheme } from './ux-button-theme';
import UX_BUTTON_VIEW from './ux-button.html';
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't we want the casing to be UxButtonView instead of UX_BUTTON_VIEW to be consistent?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was not sure about this, so I named it like a constant. Wouldn't be an issue if you want to proceed.

config.globalResources([
PLATFORM.moduleName('@aurelia-ux/button/ux-button')
]);
DOM.injectStyles(css, undefined, undefined, 'ux-button-css');
Copy link
Contributor

Choose a reason for hiding this comment

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

So I am not sure how I feel about the style injection happening in the index page. This feels like it would be a better fit in the components view-model, either in a custom decorator or just in the constructor.

The ideal scenario would have been figuring out why the require tag is not working in Webpack when using rollup to move everything into a single file.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can copy the .css files over to dist to have it dynamically bundled. It will work fine, we just need to adjust the test to have those css file properly mapped

@bigopon bigopon changed the title WIP refactor(All): move build to rollup, update core deps refactor(All): move build to rollup, update core deps Aug 12, 2018
@bigopon
Copy link
Member Author

bigopon commented Dec 3, 2019

close as no longer relevant, resolved by #229

@bigopon bigopon closed this Dec 3, 2019
@bigopon bigopon reopened this Dec 3, 2019
@bigopon bigopon closed this Dec 3, 2019
@bigopon bigopon deleted the move-to-rollup branch December 3, 2019 12:34
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.

Switch all component build to rollup
3 participants