-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4027 from storybooks/core/presets
Presets support
- Loading branch information
Showing
55 changed files
with
764 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { logger } from '@storybook/node-logger'; | ||
|
||
import { | ||
getAngularCliWebpackConfigOptions, | ||
applyAngularCliWebpackConfig, | ||
} from './angular-cli_config'; | ||
|
||
export function webpack(config) { | ||
const cwd = process.cwd(); | ||
const cliWebpackConfigOptions = getAngularCliWebpackConfigOptions(cwd); | ||
|
||
if (cliWebpackConfigOptions) { | ||
logger.info('=> Loading angular-cli config.'); | ||
} | ||
|
||
return applyAngularCliWebpackConfig(config, cliWebpackConfigOptions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import path from 'path'; | ||
import { ContextReplacementPlugin } from 'webpack'; | ||
import loadTsConfig from './ts_config'; | ||
|
||
export function webpack(config, { configDir }) { | ||
return { | ||
...config, | ||
module: { | ||
...config.module, | ||
rules: [ | ||
...config.module.rules, | ||
{ | ||
test: /\.tsx?$/, | ||
use: [ | ||
{ | ||
loader: require.resolve('ts-loader'), | ||
options: loadTsConfig(configDir), | ||
}, | ||
require.resolve('angular2-template-loader'), | ||
], | ||
}, | ||
{ | ||
test: /[/\\]@angular[/\\]core[/\\].+\.js$/, | ||
parser: { system: true }, | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'raw-loader', | ||
exclude: /\.async\.html$/, | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [require.resolve('raw-loader'), require.resolve('sass-loader')], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
...config.resolve, | ||
extensions: [...config.resolve.extensions, '.ts', '.tsx'], | ||
}, | ||
plugins: [ | ||
...config.plugins, | ||
// See https://github.com/angular/angular/issues/11580#issuecomment-401127742 | ||
new ContextReplacementPlugin( | ||
/@angular(\\|\/)core(\\|\/)fesm5/, | ||
path.resolve(__dirname, '..') | ||
), | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,10 @@ | ||
import { logger } from '@storybook/node-logger'; | ||
|
||
import packageJson from '../../package.json'; | ||
|
||
import wrapInitialConfig from './wrapInitialConfig'; | ||
|
||
import { | ||
getAngularCliWebpackConfigOptions, | ||
applyAngularCliWebpackConfig, | ||
} from './angular-cli_config'; | ||
|
||
const cliWebpackConfigOptions = getAngularCliWebpackConfigOptions(process.cwd()); | ||
|
||
if (cliWebpackConfigOptions) { | ||
logger.info('=> Loading angular-cli config.'); | ||
} | ||
|
||
export default { | ||
packageJson, | ||
defaultConfigName: 'angular-cli', | ||
wrapInitialConfig, | ||
wrapDefaultConfig: config => applyAngularCliWebpackConfig(config, cliWebpackConfigOptions), | ||
wrapBasicConfig: config => applyAngularCliWebpackConfig(config, cliWebpackConfigOptions), | ||
frameworkPresets: [ | ||
require.resolve('./framework-preset-angular.js'), | ||
require.resolve('./framework-preset-angular-cli.js'), | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function webpack(config) { | ||
return { | ||
...config, | ||
module: { | ||
...config.module, | ||
rules: [ | ||
...config.module.rules, | ||
{ | ||
test: /\.html$/, | ||
use: [ | ||
{ | ||
loader: require.resolve('html-loader'), | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
import wrapInitialConfig from './wrapInitialConfig'; | ||
|
||
export default { | ||
packageJson, | ||
wrapInitialConfig, | ||
frameworkPresets: [require.resolve('./framework-preset-html.js')], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function webpack(config) { | ||
return { | ||
...config, | ||
module: { | ||
...config.module, | ||
rules: [ | ||
...config.module.rules, | ||
{ | ||
test: /\.marko$/, | ||
loader: require.resolve('marko-loader'), | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
...config.resolve, | ||
extensions: [...config.resolve.extensions, '.marko'], | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
import wrapInitialConfig from './wrapInitialConfig'; | ||
|
||
export default { | ||
packageJson, | ||
wrapInitialConfig, | ||
frameworkPresets: [require.resolve('./framework-preset-marko.js')], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { mergeBabel } from '@storybook/core/server'; | ||
|
||
export function babel(config) { | ||
const patch = { | ||
plugins: [require.resolve('@babel/plugin-transform-react-jsx')], | ||
}; | ||
|
||
return mergeBabel(patch, config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
import wrapDefaultBabelConfig from './wrapDefaultBabelConfig'; | ||
|
||
export default { | ||
packageJson, | ||
wrapDefaultBabelConfig, | ||
frameworkPresets: [require.resolve('./framework-preset-mithril.js')], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { IgnorePlugin } from 'webpack'; | ||
|
||
export function webpack(config) { | ||
return { | ||
...config, | ||
module: { | ||
...config.module, | ||
rules: [ | ||
...config.module.rules, | ||
{ | ||
test: /\.html$/, | ||
use: [ | ||
...config.module.rules[0].use, | ||
{ | ||
loader: require.resolve('polymer-webpack-loader'), | ||
options: { processStyleLinks: true }, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
...config.plugins, | ||
// See https://github.com/webcomponents/webcomponentsjs/issues/794#issuecomment-386554298 | ||
new IgnorePlugin(/^vertx$/), | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
import wrapInitialConfig from './wrapInitialConfig'; | ||
|
||
export default { | ||
packageJson, | ||
wrapInitialConfig, | ||
frameworkPresets: [require.resolve('./framework-preset-polymer.js')], | ||
}; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
app/react/src/server/wrapBabelConfig.js → ...c/server/framework-preset-react-docgen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { mergeBabel } from '@storybook/core/server'; | ||
|
||
export function babel(config) { | ||
const patch = { | ||
presets: [require.resolve('@babel/preset-react'), require.resolve('@babel/preset-flow')], | ||
}; | ||
|
||
return mergeBabel(patch, config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import packageJson from '../../package.json'; | ||
|
||
import wrapBabelConfig from './wrapBabelConfig'; | ||
import wrapDefaultBabelConfig from './wrapDefaultBabelConfig'; | ||
|
||
export default { | ||
packageJson, | ||
defaultConfigName: 'create-react-app', | ||
wrapDefaultBabelConfig, | ||
wrapBabelConfig, | ||
frameworkPresets: [ | ||
require.resolve('./framework-preset-react.js'), | ||
require.resolve('./framework-preset-react-docgen.js'), | ||
], | ||
}; |
Oops, something went wrong.