Skip to content

Commit

Permalink
[migrate] upgrade to ES Decorator stage-3 & Husky 9 (#51)
Browse files Browse the repository at this point in the history
* [migrate] upgrade to ES Decorator stage-3 & Husky 9

* [optimize] update Storybook configuration & Read Me document

* [fix] Storybook bundling bug with Babel/TypeScript
  • Loading branch information
TechQuery authored Jan 30, 2024
1 parent bc8c946 commit edc3ff3
Show file tree
Hide file tree
Showing 19 changed files with 2,110 additions and 2,189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}

- uses: amondnet/vercel-action@v25
Expand Down
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm test
4 changes: 0 additions & 4 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm run build
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.eslintrc.json
vite.config.ts
.parcel-cache/
.parcel*
docs/
preview/
api-extractor.json
stories/
.storybook/
storybook-static/
.vscode/settings.json
.vscode/
.husky/
.github/
8 changes: 8 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@parcel/config-default",
"transformers": {
"*.{ts,tsx}": [
"@parcel/transformer-typescript-tsc"
]
}
}
10 changes: 3 additions & 7 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap@5.2.3/dist/css/bootstrap.min.css"
href="https://unpkg.com/bootstrap@5.3.2/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-icons@1.10.2/font/bootstrap-icons.css"
href="https://unpkg.com/bootstrap-icons@1.11.3/font/bootstrap-icons.css"
/>
<link
rel="stylesheet"
Expand All @@ -16,9 +16,5 @@
/>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/index.umd.css"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
/>
31 changes: 27 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A **[React][1] advanced components library** based on [TypeScript][2] & [Bootstrap][3], built by **[idea2app][4] remote developers team**.

[![MobX compatibility](https://img.shields.io/badge/Compatible-1?logo=mobx&label=MobX%204%2F5%2F6)][5]
[![MobX compatibility](https://img.shields.io/badge/Compatible-1?logo=mobx&label=MobX%206%2F7)][5]
[![NPM Dependency](https://img.shields.io/librariesio/github/idea2app/Idea-React.svg)][6]
[![CI & CD](https://github.com/idea2app/Idea-React/actions/workflows/main.yml/badge.svg)][7]

Expand All @@ -12,6 +12,13 @@ A **[React][1] advanced components library** based on [TypeScript][2] & [Bootstr
- Preview site: https://idea2app.github.io/Idea-React/preview/
- Storybook playground: https://idea-react.vercel.app/

## Versions

| SemVer | status | ES decorator | MobX |
| :----: | :----------: | :----------: | :---------: |
| `>=2` | ✅developing | stage-3 | `>=6.11` |
| `<2` | ❌deprecated | stage-2 | `>=4 <6.11` |

## Content

### Components
Expand Down Expand Up @@ -59,11 +66,11 @@ Open Map component & model, have been migrated to https://github.com/idea2app/Op
```html
<link
rel="stylesheet"
href="https://unpkg.com/[email protected].1/dist/css/bootstrap.min.css"
href="https://unpkg.com/[email protected].2/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-icons@1.10.5/font/bootstrap-icons.css"
href="https://unpkg.com/bootstrap-icons@1.11.3/font/bootstrap-icons.css"
/>
<link
rel="stylesheet"
Expand All @@ -75,6 +82,22 @@ Open Map component & model, have been migrated to https://github.com/idea2app/Op
/>
```

### `tsconfig.json`

Compatible with MobX 6/7:

```json
{
"compilerOptions": {
"target": "ES6",
"moduleResolution": "Node",
"useDefineForClassFields": true,
"experimentalDecorators": false,
"jsx": "react-jsx"
}
}
```

### Dialog

```tsx
Expand Down Expand Up @@ -149,7 +172,7 @@ export class ExamplePage extends PureComponent {
2. add Git tag

```shell
git tag vx.xx.x # such as v0.23.0
git tag vx.xx.x # such as v2.0.0
```

3. review tag
Expand Down
71 changes: 34 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idea-react",
"version": "1.0.0-rc.31",
"version": "2.0.0-rc.1",
"license": "LGPL-3.0-or-later",
"author": "[email protected]",
"description": "A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.",
Expand All @@ -22,19 +22,19 @@
"types": "dist/index.d.ts",
"main": "dist/index.js",
"dependencies": {
"@editorjs/editorjs": "^2.28.2",
"@editorjs/editorjs": "^2.29.0",
"@editorjs/paragraph": "^2.11.3",
"@react-editor-js/core": "^2.1.0",
"@swc/helpers": "^0.5.3",
"classnames": "^2.3.3",
"classnames": "^2.5.1",
"editorjs-html": "^3.4.3",
"iterable-observer": "^1.0.1",
"lodash": "^4.17.21",
"mobx": ">=4 <6.11",
"mobx-react": ">=6 <9.1",
"mobx-react-helper": "^0.2.7",
"mobx": ">=6.12.0",
"mobx-react": ">=9.1.0",
"mobx-react-helper": "^0.3.1",
"prismjs": "^1.29.0",
"react-bootstrap": "^2.9.2",
"react-bootstrap": "^2.10.0",
"react-editor-js": "^2.1.0",
"react-element-to-jsx-string": "^15.0.0",
"web-utility": "^4.1.3"
Expand All @@ -44,54 +44,51 @@
"react-dom": ">=16"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.23.6",
"@microsoft/api-extractor": "^7.39.0",
"@parcel/packager-ts": "~2.10.3",
"@parcel/transformer-typescript-types": "~2.10.3",
"@storybook/addon-console": "^2.0.0",
"@storybook/addon-essentials": "^7.6.6",
"@storybook/addon-interactions": "^7.6.6",
"@storybook/addon-links": "^7.6.6",
"@storybook/addon-storysource": "^7.6.6",
"@storybook/blocks": "^7.6.6",
"@storybook/react": "^7.6.6",
"@storybook/react-vite": "^7.6.6",
"@babel/plugin-proposal-decorators": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@microsoft/api-extractor": "^7.39.4",
"@parcel/config-default": "~2.11.0",
"@parcel/packager-ts": "~2.11.0",
"@parcel/transformer-typescript-tsc": "~2.11.0",
"@parcel/transformer-typescript-types": "~2.11.0",
"@storybook/addon-console": "^3.0.0",
"@storybook/addon-essentials": "^7.6.10",
"@storybook/addon-interactions": "^7.6.10",
"@storybook/addon-links": "^7.6.10",
"@storybook/addon-storysource": "^7.6.10",
"@storybook/blocks": "^7.6.10",
"@storybook/react": "^7.6.10",
"@storybook/react-vite": "^7.6.10",
"@storybook/testing-library": "^0.2.2",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.3",
"@types/node": "^18.19.10",
"@types/prismjs": "^1.26.3",
"@types/react": "^18.2.45",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"husky": "^9.0.7",
"koapache": "^2.2.2",
"less": "^4.2.0",
"lint-staged": "^15.2.0",
"parcel": "~2.10.3",
"parcel": "~2.11.0",
"postcss-preset-env": "^9.3.0",
"prettier": "^3.1.1",
"prettier": "^3.2.4",
"process": "^0.11.10",
"prop-types": "15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.5",
"storybook": "^7.6.6",
"typedoc": "^0.25.4",
"typedoc-plugin-mdn-links": "^3.1.9",
"storybook": "^7.6.10",
"typedoc": "^0.25.7",
"typedoc-plugin-mdn-links": "^3.1.14",
"typescript": "~5.3.3",
"vite": "^5.0.10"
},
"pnpm": {
"overrides": {
"@storybook/addon-actions": "~7.5"
}
"vite": "^5.0.12"
},
"prettier": {
"singleQuote": true,
Expand All @@ -110,7 +107,7 @@
}
},
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"test": "lint-staged",
"api-extractor": "tsc --project tsconfig.build.json --outDir dist/dts && api-extractor run && rimraf dist/dts",
"pack-preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel build --public-url=. --dist-dir=../docs/preview/",
Expand Down
Loading

1 comment on commit edc3ff3

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for idea-react ready!

✅ Preview
https://idea-react-87u41hxhs-stevending1st.vercel.app

Built with commit edc3ff3.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.