Skip to content

Commit

Permalink
Merge pull request #160 from storybookjs/future/tsup
Browse files Browse the repository at this point in the history
let's migrate to TS, and migrate to more modern tooling and output
  • Loading branch information
ndelangen authored Jul 4, 2022
2 parents 264d34c + db74509 commit d7f6e07
Show file tree
Hide file tree
Showing 54 changed files with 1,577 additions and 3,063 deletions.
7 changes: 3 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"targets": {
"browsers": ["ie >= 11"]
},
"loose": false
"chrome": 100
}
}
],
"@babel/preset-react"
Expand All @@ -15,7 +15,6 @@
"@babel/plugin-syntax-bigint",
["@babel/plugin-proposal-class-properties", { "loose": false }],
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-object-rest-spread",
Expand Down
42 changes: 12 additions & 30 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
module.exports = {
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8
},
"plugins": [
"react",
"jasmine"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jasmine/recommended"
],
"env": {
"browser": true,
"node": true,
"es6": true,
"jasmine": true
},
"rules": {
"react/prop-types": [0],
"react/display-name": [0],
"jasmine/new-line-before-expect": [0],
"react/no-unescaped-entities": [0]
},
"settings": {
"react": {
"version": "16.8", // React version. "detect" automatically picks the version you have installed.
},
}
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'prettier/prettier': ['error'],
'@typescript-eslint/ban-ts-comment': 'warn',
},
ignorePatterns: ['dist', 'node_modules'],
};
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"bracketSpacing": true,
"jsxBracketSameLine": true,
"printWidth": 80,
"printWidth": 120,
"singleQuote": true,
"trailingComma": "es5"
}
16 changes: 3 additions & 13 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
const path = require('path');

module.exports = {
stories: ['../stories/*.*'],
webpackFinal: (config, {configType}) => {
if (configType !== 'PRODUCTION') {
config.module.rules.push({
test: /\.(js|jsx)$/,
loaders: ['react-hot-loader'],
include: [path.join(__dirname, 'src')],
});
}

return config;
},
core: {
builder: 'webpack5'
}
};
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 6.0.0 (04/07/2022)
- Upgrade devDependencies
- Remove all dependencies
- Migrate to typescript (correct types are a WIP, please contribute!)
- Migrate to use use TSup as a build tool, also outputting modern ESM

## 5.1.1 (04/02/2021)
- Include support for React 17 in peerDependencies. [120](https://github.com/storybookjs/react-inspector/pull/120) [124](https://github.com/storybookjs/react-inspector/pull/124)
- Only publish required files. [119](https://github.com/storybookjs/react-inspector/pull/119)
Expand Down
66 changes: 31 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@
},
"license": "MIT",
"author": "Xiaoyi Chen <[email protected]> (https://github.com/xyc)",
"main": "dist/cjs/react-inspector.js",
"module": "dist/es/react-inspector.js",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*/",
"README.md",
Expand All @@ -41,29 +50,19 @@
".d.ts"
],
"scripts": {
"build": "rollup -c",
"build": "tsup",
"build-storybook": "build-storybook",
"chromatic": "chromatic --project-token=17yeg4lpa7q",
"clean": "rimraf dist",
"lint": "eslint src --fix",
"prerelease": "npm run lint && npm run test && npm run clean && npm run build",
"lint": "eslint src stories --fix",
"prerelease": "npm run lint && npm run test && npm run build",
"release": "npm publish . --access public",
"storybook": "start-storybook -p 9001",
"test": "jest src",
"test-updatesnapshot": "jest src --update-snapshot",
"test-watch": "npm run test -- --watch"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"is-dom": "^1.0.0",
"prop-types": "^15.0.0"
"test": "jest src"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-do-expressions": "^7.10.4",
"@babel/plugin-proposal-export-default-from": "^7.10.4",
"@babel/plugin-proposal-logical-assignment-operators": "^7.11.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
Expand All @@ -73,33 +72,30 @@
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.11.5",
"@storybook/react": "^6.0.21",
"babel-eslint": "^10.1.0",
"@storybook/builder-webpack5": "^6.5.9",
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/react": "^6.5.9",
"@types/is-dom": "^1.1.0",
"@types/react": "^16",
"@typescript-eslint/eslint-plugin": "^5.30.4",
"@typescript-eslint/parser": "^5.30.4",
"babel-loader": "^8.1.0",
"chromatic": "^5.1.0",
"core-js": "^3.6.5",
"css-loader": "^4.3.0",
"eslint": "^7.8.1",
"eslint-plugin-jasmine": "^4.1.1",
"eslint-plugin-react": "^7.20.6",
"chromatic": "^6.7.0",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"expect": "^26.4.2",
"is-dom": "^1.1.0",
"jest": "^26.4.2",
"prettier": "^2.1.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hot-loader": "^4.12.21",
"react-test-renderer": "^16.13.1",
"rimraf": "^3.0.2",
"rollup": "^2.26.11",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"style-loader": "^1.2.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
"tsup": "^6.1.3",
"typescript": "^4.7.4",
"webpack": "^5"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0 || ^18.0.0"
Expand Down
89 changes: 0 additions & 89 deletions rollup.config.js

This file was deleted.

61 changes: 0 additions & 61 deletions src/dom-inspector/DOMInspector.js

This file was deleted.

Loading

0 comments on commit d7f6e07

Please sign in to comment.