Skip to content

Commit

Permalink
Upgrade to storybook 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed May 18, 2019
1 parent fa2bc4c commit 701643e
Show file tree
Hide file tree
Showing 8 changed files with 5,051 additions and 4,477 deletions.
2 changes: 1 addition & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setOptions({
* URL for name in top left corner to link to
* @type {String}
*/
url: 'https://github.com/jaredpalerm/formik',
url: 'https://github.com/jaredpalmer/formik',
/**
* Show story component as full screen
* @type {Boolean}
Expand Down
30 changes: 19 additions & 11 deletions .storybook/example.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,25 @@ import SyncValidation from '../examples/SyncValidation';
import FieldLevelValidation from '../examples/FieldLevelValidation';
import CombinedValidations from '../examples/CombinedValidations';

const AsyncValidationCode = require('!raw-loader!../examples/AsyncValidation');
const ArraysCode = require('!raw-loader!../examples/Arrays');
const BasicCode = require('!raw-loader!../examples/Basic.js');
const CustomInputsCode = require('!raw-loader!../examples/CustomInputs');
const ErrorMessageCode = require('!raw-loader!../examples/ErrorMessage');
const FastFieldCode = require('!raw-loader!../examples/FastField');
const MultistepWizardCode = require('!raw-loader!../examples/MultistepWizard');
const SchemaValidationCode = require('!raw-loader!../examples/SchemaValidation');
const SyncValidationCode = require('!raw-loader!../examples/SyncValidation');
const FieldLevelValidationCode = require('!raw-loader!../examples/FieldLevelValidation');
const CombinedValidationsCode = require('!raw-loader!../examples/CombinedValidations');
const AsyncValidationCode = require('!raw-loader!../examples/AsyncValidation')
.default;
const ArraysCode = require('!raw-loader!../examples/Arrays').default;
const BasicCode = require('!raw-loader!../examples/Basic.js').default;
const CustomInputsCode = require('!raw-loader!../examples/CustomInputs')
.default;
const ErrorMessageCode = require('!raw-loader!../examples/ErrorMessage')
.default;
const FastFieldCode = require('!raw-loader!../examples/FastField').default;
const MultistepWizardCode = require('!raw-loader!../examples/MultistepWizard')
.default;
const SchemaValidationCode = require('!raw-loader!../examples/SchemaValidation')
.default;
const SyncValidationCode = require('!raw-loader!../examples/SyncValidation')
.default;
const FieldLevelValidationCode = require('!raw-loader!../examples/FieldLevelValidation')
.default;
const CombinedValidationsCode = require('!raw-loader!../examples/CombinedValidations')
.default;

function cleanExample(str) {
return str
Expand Down
10 changes: 5 additions & 5 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const { TsConfigPathsPlugin } = require('awesome-typescript-loader');

module.exports = (storybookBaseConfig, configType, defaultConfig) => {
defaultConfig.module.rules.push({
module.exports = async ({ config, mode }) => {
config.module.rules.push({
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
options: {
configFileName: 'tsconfig.storybook.json',
},
});
defaultConfig.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx'];
defaultConfig.resolve.plugins = [new TsConfigPathsPlugin({})];
config.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx'];
config.resolve.plugins = [new TsConfigPathsPlugin({})];

return defaultConfig;
return config;
};
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@storybook/addon-options": "^3.4.8",
"@storybook/react": "^3.4.0",
"@storybook/addon-options": "^5.0.11",
"@storybook/addons": "^5.0.11",
"@storybook/react": "^5.0.11",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^24.0.5",
"@types/lodash": "^4.14.119",
Expand All @@ -69,8 +70,9 @@
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"all-contributors-cli": "^4.4.0",
"awesome-typescript-loader": "^3.4.1",
"babel-eslint": "9.x",
"awesome-typescript-loader": "^5.2.1",
"babel-eslint": "10.0.1",
"babel-loader": "^8.0.6",
"cp-cli": "^1.1.2",
"cross-env": "5.0.5",
"doctoc": "^1.3.0",
Expand All @@ -86,13 +88,14 @@
"husky": "0.14.3",
"lint-staged": "4.0.2",
"prettier": "^1.17.1",
"raw-loader": "^0.5.1",
"raw-loader": "^2.0.0",
"react": "^16.9.0-alpha.0",
"react-dom": "^16.9.0-alpha.0",
"react-testing-library": "^7.0.0",
"rimraf": "^2.6.2",
"tsdx": "^0.5.11",
"typescript": "^3.4.5",
"webpack": "^4.31.0",
"yup": "0.21.3"
},
"lint-staged": {
Expand Down
33 changes: 33 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"strict": true,
"pretty": true,
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"stripInternal": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"emitDecoratorMetadata": false,
"experimentalDecorators": false,
"moduleResolution": "node",
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
},
"include": ["src", "types"],
"exclude": ["node_modules", "dist"]
}
38 changes: 5 additions & 33 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
{
"extends": "./tsconfig.base.json",
"include": ["src", "types", "test", "test/setupTests.ts"],
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"strict": true,
"pretty": true,
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"stripInternal": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"emitDecoratorMetadata": false,
"experimentalDecorators": false,
"moduleResolution": "node",
"baseUrl": "./",
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"paths": {
"*": ["src/*", "node_modules/*"]
},

},
"include": ["src", "types"],
"exclude": ["node_modules", "dist"]
"formik": ["src/"]
}
}
}
1 change: 1 addition & 0 deletions tsconfig.storybook.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "./tsconfig.json",
"include": ["src", "./typings.d.ts", "types"],
"compilerOptions": {
"baseUrl": "./"
}
Expand Down
Loading

0 comments on commit 701643e

Please sign in to comment.