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

Move more things to core #2788

Merged
merged 12 commits into from
Jan 20, 2018
Merged

Move more things to core #2788

merged 12 commits into from
Jan 20, 2018

Conversation

igor-dv
Copy link
Member

@igor-dv igor-dv commented Jan 19, 2018

Issue: #2636

What I did

  1. Moved manager to core
  2. Moved default webpack.config.js to core

(Didn't touch RN)

@igor-dv igor-dv added the maintenance User-facing maintenance tasks label Jan 19, 2018
@igor-dv igor-dv self-assigned this Jan 19, 2018
@codecov
Copy link

codecov bot commented Jan 19, 2018

Codecov Report

Merging #2788 into master will increase coverage by 0.31%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2788      +/-   ##
==========================================
+ Coverage   35.51%   35.83%   +0.31%     
==========================================
  Files         434      427       -7     
  Lines        9501     9422      -79     
  Branches      987      970      -17     
==========================================
+ Hits         3374     3376       +2     
+ Misses       5481     5403      -78     
+ Partials      646      643       -3
Impacted Files Coverage Δ
app/angular/src/server/config/webpack.config.js 0% <ø> (ø) ⬆️
app/react/src/server/config/webpack.config.prod.js 0% <ø> (ø) ⬆️
app/vue/src/client/index.js 0% <ø> (ø) ⬆️
lib/core/src/client/manager/provider.js 0% <ø> (ø)
...p/angular/src/server/config/webpack.config.prod.js 0% <ø> (ø) ⬆️
lib/core/src/client/manager/index.js 0% <ø> (ø)
app/vue/src/server/config/webpack.config.prod.js 0% <ø> (ø) ⬆️
app/vue/src/server/config/webpack.config.js 0% <ø> (ø) ⬆️
lib/core/src/client/manager/preview.js 0% <ø> (ø)
app/polymer/src/client/index.js 0% <ø> (ø) ⬆️
... and 73 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ad831f...ddbc05e. Read the comment docs.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for taking care of this!

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

Looks great! Only one very very minor comment, feel free to ignore.

const client = require('./dist/client').default;

module.exports = client;
module.exports.pathToManager = require.resolve('./dist/client/manager');
Copy link
Member

Choose a reason for hiding this comment

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

I would have called this managerPath

@@ -1,73 +1,5 @@
// import webpack from 'webpack';
import autoprefixer from 'autoprefixer';
import { createDefaultWebpackConfig } from '@storybook/core/server';
Copy link
Member

@ndelangen ndelangen Jan 20, 2018

Choose a reason for hiding this comment

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

How about moving the webpack configs into a separate package?

So this becomes much easier:
https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default

Copy link
Member Author

@igor-dv igor-dv Jan 20, 2018

Choose a reason for hiding this comment

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

What do you mean? Will it be something like @storybook/configs ? TBH, I think we need to make some progress in core extraction because this copypasta across all the apps makes me crazy 😷

Copy link
Member

@Hypnosphi Hypnosphi Jan 20, 2018

Choose a reason for hiding this comment

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

@storybook/webpack-config sounds good to me. We only need to publish the default one, because it's the only one that should be imported from outside

Copy link
Member

@Hypnosphi Hypnosphi Jan 20, 2018

Choose a reason for hiding this comment

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

But maybe it would be an even better solution just to pass genDefaultConfig as third argument to custom webpack config function, so that users could write full control + defaults like this, without any extra imports:

module.exports = (baseConfig, env, genDefaultConfig) => {
  const config = genDefaultConfig(baseConfig, env);

  // Extend it as you need.
};

Or maybe even like this:

module.exports = (baseConfig, env, defaultConfig) => {
  // Extend `defaultConfig` as you need.
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense to me. It's way much simpler than publishing one more package

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 mean from the user's point of view =)

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather not create yet another package. @Hypnosphi the proposals above seem pretty reasonable--are they backwards compatible or breaking changes?

Copy link
Member

@Hypnosphi Hypnosphi Jan 20, 2018

Choose a reason for hiding this comment

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

@shilman We should deprecate the old way using utils-deprecate for now, and then remove it in next major
So the answer is yes, it can be backwards-compatible

@storybookjs storybookjs deleted a comment from igor-dv Jan 20, 2018
@ndelangen
Copy link
Member

My bad @igor-dv you're right you've made sure this is backwards compatible ✅

@ndelangen
Copy link
Member

Merge when ready

@ndelangen ndelangen merged commit abd4f0e into master Jan 20, 2018
@ndelangen ndelangen deleted the move-more-things-to-core branch January 20, 2018 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants