Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Initial work toward new component bundle directories #2859

Merged
merged 6 commits into from
Sep 22, 2017

Conversation

lmorchard
Copy link
Contributor

@lmorchard lmorchard commented Sep 14, 2017

Some remaining TODOs:

Done so far:

  • Moved ExperimentRowCard and UpdateList components into subdirectories

  • Extracted IncompatibleAddons as a component from ExperimentPage

  • Webpack config to extract static/app/app.js.css from component imports

  • Link to static/app/app.js.css styles from the static page template

  • Storybook config changes to use frontend/src/app/**/{ComponentName}/stories.jsx files

  • Mocha test command changes use frontend/src/app/**/{ComponentName}/tests.js

  • Hacks to frontend/tasks/pages.js to ignore scss imports

  • Hacks to test-setup.js to ignore scss imports

See also:
https://gist.github.com/chuckharmston/01e5b7a16ba9b771863cbb8b2de64138

Issue #2807

@lmorchard
Copy link
Contributor Author

@fzzzy - Still got some work to do here, but I think this is doing the right things so far with styles, stories, & tests.

@fzzzy
Copy link
Contributor

fzzzy commented Sep 14, 2017

What on earth is going on in this failure here? o.O

rules: [
{
test: /\.(css|scss)$/,
loaders: ["style-loader", "css-loader", "sass-loader"],
Copy link
Contributor

Choose a reason for hiding this comment

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

The sass-loader docs gave something very different than this. I never would have figured this out...

Copy link
Contributor Author

@lmorchard lmorchard Sep 14, 2017

Choose a reason for hiding this comment

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

Ignore that... it didn't work and shouldn't have been there - I was editing the wrong file in the wrong dir & accidentally committed it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW, these are the changes to the main webpack config, basically from the sass-loader docs: https://github.com/mozilla/testpilot/pull/2859/files#diff-11e9f7f953edc64ba14b0cc350ae7b9d

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that changeset looks really good. I think I can actually understand how it works!

@lmorchard lmorchard force-pushed the 2807-experimentdetails-breakdown branch 2 times, most recently from 5b9af0f to 9f3beda Compare September 14, 2017 21:50
@lmorchard
Copy link
Contributor Author

lmorchard commented Sep 14, 2017

What on earth is going on in this failure here? o.O

Looks like the test modules are getting caught up in the webpack bundling JS linting with browser rules. But, I've seen that before and can fix

@fzzzy
Copy link
Contributor

fzzzy commented Sep 14, 2017

Looking at the diff, I'm guessing the hacks you have in test-setup were what I needed to fix the weird problem I had trying to load sass earlier today.

I like the look of the way webpack is set up here better than what I had, too.

- Storybook now also finds stories in frontend/src/app/**/stories.js

- `npm run test` now also finds tests in frontend/src/app/**/tests.js

- New /static/app/app.js.css stylesheet built from Sass styles imported
  by components

- Hacks to ignore .scss imports when using component modules outside
  Webpack for static page build & tests

- Update flowconfig to ignore .scss imports

- Small eslint upgrade so CLI matches gulp-eslint

Issue mozilla#2807
@lmorchard lmorchard force-pushed the 2807-experimentdetails-breakdown branch from 9f3beda to bd61781 Compare September 15, 2017 18:53
@lmorchard
Copy link
Contributor Author

lmorchard commented Sep 15, 2017

Okay. Reorg'd this into a few more self-contained commits and cleaned some things up. And yay the tests pass!

Thinking I might punt on actually migrating styles over for now, though: It's going to take a bit more SCSS hacking than just moving the style files

Looks like we have #2808 for porting over SCSS - I'll say this PR enables index.scss per component directory, but we still have to rework the existing SCSS a bit to use the capability.

@lmorchard lmorchard changed the title [WIP] Initial work toward new component bundle directories Initial work toward new component bundle directories Sep 15, 2017
@lmorchard lmorchard force-pushed the 2807-experimentdetails-breakdown branch from bd61781 to ceaff1b Compare September 15, 2017 21:06
@ghost ghost added this to the Sprint 32 milestone Sep 18, 2017
@ghost ghost added the status: in progress label Sep 18, 2017
@fzzzy
Copy link
Contributor

fzzzy commented Sep 22, 2017

I think this is ready to land. I would be fine with just linking to the gist in the documentation for now.

Copy link
Contributor

@fzzzy fzzzy left a comment

Choose a reason for hiding this comment

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

This is going to be very nice.

@lmorchard
Copy link
Contributor Author

lmorchard commented Sep 22, 2017

This could use some revision, but I just copypasta'd most of that proposal into the Storybook docs. Might just call that good enough and merge after tests go green

@fzzzy
Copy link
Contributor

fzzzy commented Sep 22, 2017

Seems good enough for now!

@lmorchard lmorchard merged commit f4000e2 into mozilla:master Sep 22, 2017
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants