Skip to content

Commit

Permalink
feat: add Vite & Storybook; delete Parcel (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: TechQuery <shiy2008@gmail.com>
  • Loading branch information
stevending1st and TechQuery authored May 26, 2023
1 parent 475774f commit e55f6b3
Show file tree
Hide file tree
Showing 17 changed files with 8,578 additions and 1,787 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ docs/
.parcel-cache
.vscode/settings.json
.vercel

storybook-static/
33 changes: 33 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { StorybookConfig } from "@storybook/react-vite";
import prettierConfig from "./prettier.config";
import path from "path";

const config: StorybookConfig = {
stories: ["../stories/**/*.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: "@storybook/addon-storysource",
options: {
rule: {
include: [path.resolve(__dirname, "../src")], // You can specify directories
},
loaderOptions: {
injectStoryParameters: false,
prettierConfig,
},
},
},
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};

export default config;
4 changes: 4 additions & 0 deletions .storybook/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
printWidth: 80,
singleQuote: false
};
24 changes: 24 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap@5.2.3/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-icons@1.10.2/font/bootstrap-icons.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/animate.css@4.1.1/animate.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/prismjs@1.29.0/themes/prism.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/idea-react@0.27.11/dist/index.umd.css"
/>
21 changes: 21 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Preview } from "@storybook/react";
import "@storybook/addon-console";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
docs: {
story: { inline: true }, // render the story in an iframe
canvas: { sourceState: "shown" }, // start with the source open
source: { type: "JSX" }, // forces the raw source code (rather than the rendered JSX).
},
},
};

export default preview;
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Table, List & Form components around Data models, have been migrated to https://
/>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"
href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
/>
```

Expand Down
32 changes: 32 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"compiler": {
"tsconfigFilePath": "./tsconfig.build.json"
},
"projectFolder": "..",
"mainEntryPointFilePath": "./dist/dts/index.d.ts",
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./dist/index.d.ts"
},
"apiReport": {
"enabled": false
},
"docModel": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"extractorMessageReporting": {
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-forgotten-export": {
"logLevel": "none"
}
}
}
}
54 changes: 38 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,65 @@
"source": "source/index.ts",
"types": "dist/index.d.ts",
"main": "dist/index.umd.js",
"module": "dist/index.js",
"module": "dist/index.es.js",
"dependencies": {
"@editorjs/editorjs": "^2.26.5",
"@editorjs/editorjs": "^2.27.0",
"@editorjs/paragraph": "^2.9.0",
"@swc/helpers": "^0.4.14",
"@types/leaflet": "^1.9.3",
"classnames": "^2.3.2",
"editorjs-html": "^3.4.2",
"koajax": "^0.8.4",
"leaflet": "^1.9.3",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"mobx": "^5.15.7",
"mobx-react": "^6.3.1",
"prismjs": "^1.29.0",
"react": "^17.0.2",
"react-bootstrap": "^2.7.4",
"react-dom": "^17.0.2",
"react-editor-js": "^2.1.0",
"react-element-to-jsx-string": "^15.0.0",
"react-leaflet": "^3.2.5",
"web-utility": "^4.0.0"
},
"peerDependencies": {
"react": ">=16 <18",
"react-dom": ">=16 <18"
},
"devDependencies": {
"@parcel/packager-ts": "~2.6.2",
"@parcel/transformer-less": "~2.6.2",
"@parcel/transformer-typescript-types": "~2.6.2",
"@types/lodash": "^4.14.194",
"@types/node": "^16.18.25",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.22.0",
"@microsoft/api-extractor": "^7.35.0",
"@storybook/addon-console": "^2.0.0",
"@storybook/addon-essentials": "^7.0.18",
"@storybook/addon-interactions": "^7.0.18",
"@storybook/addon-links": "^7.0.18",
"@storybook/addon-storysource": "^7.0.18",
"@storybook/blocks": "^7.0.18",
"@storybook/react": "^7.0.18",
"@storybook/react-vite": "^7.0.18",
"@storybook/testing-library": "0.1.0",
"@types/lodash": "^4.14.195",
"@types/node": "^16.18.33",
"@types/prismjs": "^1.26.0",
"@types/react": "^17.0.58",
"@types/react": "^17.0.60",
"@types/react-dom": "^17.0.20",
"@vitejs/plugin-react": "^4.0.0",
"husky": "^8.0.3",
"less": "^4.1.3",
"lint-staged": "^13.2.2",
"open-cli": "^7.2.0",
"parcel": "~2.6.2",
"postcss-preset-env": "^8.4.1",
"prettier": "^2.8.8",
"process": "^0.11.10",
"typedoc": "^0.24.6",
"prop-types": "15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "^5.0.1",
"storybook": "^7.0.18",
"ts-node": "^10.9.1",
"typedoc": "^0.24.7",
"typedoc-plugin-mdn-links": "^3.0.3",
"typescript": "~4.7.4"
"typescript": "~5.0.4",
"vite": "^4.3.9"
},
"prettier": {
"singleQuote": true,
Expand All @@ -81,9 +99,13 @@
"scripts": {
"prepare": "husky install",
"test": "lint-staged",
"build": "rm -rf dist/ docs/ && typedoc source/ && parcel build --no-source-maps",
"api-extractor": "tsc --project tsconfig.build.json --outDir dist/dts && api-extractor run && rimraf dist/dts",
"build": "rimraf dist/ docs/ && typedoc source/ && vite build && npm run api-extractor",
"start": "typedoc source/ && open-cli docs/index.html",
"prepublishOnly": "npm test && npm run build",
"dev:storybook": "storybook dev -p 6006",
"build:storybook": "rimraf storybook-static && storybook build -c .storybook",
"preview:storybook": "vite preview --outDir storybook-static",
"preview": "cd preview && npm start"
}
}
Loading

0 comments on commit e55f6b3

Please sign in to comment.