Skip to content

Commit

Permalink
Fixed storybook according to new build system
Browse files Browse the repository at this point in the history
  • Loading branch information
Shenato committed Oct 27, 2023
1 parent f73644d commit 512b0d8
Show file tree
Hide file tree
Showing 9 changed files with 541 additions and 412 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
browser: true,
jest: true,
},
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
Expand Down
9 changes: 8 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ module.exports = {
config.module.rules.push({
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['ts-loader'],
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.node.json',
},
},
],
});
config.resolve.extensions.push('.ts', '.tsx');
// Alternately, for an alias:
Expand Down
4 changes: 1 addition & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type {Config} from 'jest';

const config: Config = {
verbose: true,
};

export default config;
export default config;
896 changes: 499 additions & 397 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "@g-loot/react-tournament-brackets",
"version": "1.0.0",
"description": "A react component to visualize bracket leaderboards",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"main": "dist/cjs/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "rimraf dist && tsc && tsc-alias",
"build-cjs": "tsc -p ./tsconfig.node.json && tsc-alias -p ./tsconfig.node.json",
"build-esm": "tsc -p ./tsconfig.browser.json && tsc-alias -p ./tsconfig.browser.json",
"build": "rimraf dist & npm run build-cjs && npm run build-esm",
"dev": "start-storybook -p 4442",
"start": "start-storybook -p $PORT -h 0.0.0.0",
"build-storybook": "build-storybook -o devapp-build",
Expand All @@ -29,7 +32,8 @@
"deepmerge": "^4.2.2"
},
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/core": "^7.23.2",
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-typescript": "^7.14.5",
"@storybook/addon-actions": "^6.5.9",
Expand All @@ -46,7 +50,7 @@
"babel-plugin-module-resolver": "^4.1.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.6.0",
"eslint": "^8.34.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-alias": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/aliases.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {
compilerOptions: { paths: unprocessAliases },
} = require(`../tsconfig.json`);
} = require(`../tsconfig.node.json`);

const aliases = Object.keys(unprocessAliases).reduce((obj, alias) => {
const key = alias.match(/[a-zA-Z0-9]+/g);
Expand Down
11 changes: 9 additions & 2 deletions scripts/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ module.exports = {
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['ts-loader'],
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.node.json',
},
},
],
},
{
test: /\.css$/,
Expand Down Expand Up @@ -54,7 +61,7 @@ module.exports = {
filename: 'bundle.js',
library: '@g-loot/react-tournament-brackets',
libraryTarget: 'umd',
globalObject: 'this'
globalObject: 'this',
},
externals: {
'styled-components': {
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.node",
"compilerOptions": {
"outDir": "./dist/esm/",
"module": "esnext"
}
}
10 changes: 7 additions & 3 deletions tsconfig.json → tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
"**/*.stories.jsx",
"**/*.stories.tsx",
"**/*.stories.js",
"**/*.stories.ts"
"**/*.stories.ts",
"**/*.spec.jsx",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.ts"
],
"compilerOptions": {
"outDir": "./dist/cjs/",
"module": "commonjs",
"baseUrl": "src",
"moduleResolution": "node",
"target": "es2017",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"removeComments": true,
"strict": true,
"allowJs": true,
Expand Down

0 comments on commit 512b0d8

Please sign in to comment.