From 987d57878aa2984e93ab57271b20e3d952dc542e Mon Sep 17 00:00:00 2001 From: Flcwl Date: Tue, 1 Jun 2021 11:23:26 +0800 Subject: [PATCH] chore: remove unused code --- .npmignore | 2 +- .storybook/main.js | 16 +- .storybook/manager-head.html | 7 - .storybook/manager.js | 6 +- .storybook/preview-body.html | 10 - .storybook/preview-head.html | 6 - .storybook/preview.js | 57 +- .storybook/reset.css | 38 -- .storybook/stringReplace.js | 15 - .../{codeTheme.js => themes/code-theme.js} | 0 .../{hiuiTheme.js => themes/hiui-theme.js} | 4 +- .storybook/webpack.config.js | 45 -- .../fonts}/OpenSans-Light-webfont.eot | Bin .../fonts}/OpenSans-Light-webfont.svg | 502 +++++++++--------- .../fonts}/OpenSans-Light-webfont.ttf | Bin .../fonts}/OpenSans-Light-webfont.woff | Bin .../fonts}/OpenSans-Regular-webfont.eot | Bin .../fonts}/OpenSans-Regular-webfont.svg | 502 +++++++++--------- .../fonts}/OpenSans-Regular-webfont.ttf | Bin .../fonts}/OpenSans-Regular-webfont.woff | Bin .../pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf | Bin .../fonts}/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf | Bin .../fonts}/pe0qMImSLYBIv1o4X1M8cce9I94.ttf | Bin .../icon => assets/icons}/percolate.eot | Bin .../icon => assets/icons}/percolate.svg | 0 .../icon => assets/icons}/percolate.ttf | Bin .../icon => assets/icons}/percolate.woff | Bin {.storybook/icon => assets/icons}/todos.eot | Bin {.storybook/icon => assets/icons}/todos.svg | 0 {.storybook/icon => assets/icons}/todos.ttf | Bin {.storybook/icon => assets/icons}/todos.woff | Bin assets/{ => images}/code-brackets.svg | 0 assets/{ => images}/colors.svg | 0 assets/{ => images}/comments.svg | 0 assets/{ => images}/direction.svg | 0 assets/{ => images}/flow.svg | 0 assets/{ => images}/plugin.svg | 0 assets/{ => images}/repo.svg | 0 assets/{ => images}/stackalt.svg | 0 build-tools/package.json | 39 -- build-tools/webpack.config.js | 103 ---- commitlint.config.js | 8 +- packages/ui/alert/package.json | 4 +- packages/ui/checkbox/package.json | 4 +- packages/ui/core/package.json | 4 +- packages/ui/loading/package.json | 3 +- packages/ui/popper/package.json | 6 +- packages/ui/select/package.json | 2 - postcss.config.js | 6 +- 49 files changed, 571 insertions(+), 818 deletions(-) delete mode 100644 .storybook/manager-head.html delete mode 100644 .storybook/preview-body.html delete mode 100644 .storybook/preview-head.html delete mode 100644 .storybook/reset.css delete mode 100644 .storybook/stringReplace.js rename .storybook/{codeTheme.js => themes/code-theme.js} (100%) rename .storybook/{hiuiTheme.js => themes/hiui-theme.js} (95%) delete mode 100644 .storybook/webpack.config.js rename {.storybook/font => assets/fonts}/OpenSans-Light-webfont.eot (100%) rename {.storybook/font => assets/fonts}/OpenSans-Light-webfont.svg (99%) rename {.storybook/font => assets/fonts}/OpenSans-Light-webfont.ttf (100%) rename {.storybook/font => assets/fonts}/OpenSans-Light-webfont.woff (100%) rename {.storybook/font => assets/fonts}/OpenSans-Regular-webfont.eot (100%) rename {.storybook/font => assets/fonts}/OpenSans-Regular-webfont.svg (99%) rename {.storybook/font => assets/fonts}/OpenSans-Regular-webfont.ttf (100%) rename {.storybook/font => assets/fonts}/OpenSans-Regular-webfont.woff (100%) rename {.storybook/font => assets/fonts}/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf (100%) rename {.storybook/font => assets/fonts}/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf (100%) rename {.storybook/font => assets/fonts}/pe0qMImSLYBIv1o4X1M8cce9I94.ttf (100%) rename {.storybook/icon => assets/icons}/percolate.eot (100%) rename {.storybook/icon => assets/icons}/percolate.svg (100%) rename {.storybook/icon => assets/icons}/percolate.ttf (100%) rename {.storybook/icon => assets/icons}/percolate.woff (100%) rename {.storybook/icon => assets/icons}/todos.eot (100%) rename {.storybook/icon => assets/icons}/todos.svg (100%) rename {.storybook/icon => assets/icons}/todos.ttf (100%) rename {.storybook/icon => assets/icons}/todos.woff (100%) rename assets/{ => images}/code-brackets.svg (100%) rename assets/{ => images}/colors.svg (100%) rename assets/{ => images}/comments.svg (100%) rename assets/{ => images}/direction.svg (100%) rename assets/{ => images}/flow.svg (100%) rename assets/{ => images}/plugin.svg (100%) rename assets/{ => images}/repo.svg (100%) rename assets/{ => images}/stackalt.svg (100%) delete mode 100644 build-tools/package.json delete mode 100644 build-tools/webpack.config.js diff --git a/.npmignore b/.npmignore index 31d9b81b1..bee0f25be 100644 --- a/.npmignore +++ b/.npmignore @@ -31,4 +31,4 @@ Desktop.ini Thumbs.db .Spotlight-V100 .Trashes -postcss.config.js \ No newline at end of file +postcss.config.js diff --git a/.storybook/main.js b/.storybook/main.js index a864d9530..0fffea9d7 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,8 +1,12 @@ -// const customWebpack = require('./webpack.config.js'); -// .storybook/main.js - -const path = require("path") module.exports = { - stories: ["../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)", "../packages/**/*.stories.@(js|jsx|ts|tsx|mdx)"], - addons: ["@storybook/addon-links", "@storybook/addon-essentials", "storybook-addon-react-live-edit", "@storybook/preset-scss"], + stories: [ + "../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)", + "../packages/**/*.stories.@(js|jsx|ts|tsx|mdx)", + ], + addons: [ + "@storybook/addon-links", + "@storybook/addon-essentials", + "storybook-addon-react-live-edit", + "@storybook/preset-scss", + ], } diff --git a/.storybook/manager-head.html b/.storybook/manager-head.html deleted file mode 100644 index 7887ecd7c..000000000 --- a/.storybook/manager-head.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/.storybook/manager.js b/.storybook/manager.js index 4e80ff754..2f7698d8f 100644 --- a/.storybook/manager.js +++ b/.storybook/manager.js @@ -1,7 +1,8 @@ import { addons } from '@storybook/addons'; -import hiuiTheme from './hiuiTheme'; +import hiuiTheme from './themes/hiui-theme'; addons.setConfig({ + theme: hiuiTheme, isFullscreen: false, showNav: true, showPanel: false, @@ -9,8 +10,7 @@ addons.setConfig({ sidebarAnimations: true, enableShortcuts: true, isToolshown: true, - theme: hiuiTheme, selectedPanel: undefined, initialActive: 'sidebar', showRoots: false, -}); \ No newline at end of file +}) diff --git a/.storybook/preview-body.html b/.storybook/preview-body.html deleted file mode 100644 index 55aea1b8e..000000000 --- a/.storybook/preview-body.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
- - - \ No newline at end of file diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html deleted file mode 100644 index 2a8a93dff..000000000 --- a/.storybook/preview-head.html +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/.storybook/preview.js b/.storybook/preview.js index 715056702..4d6fc3225 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,11 +1,10 @@ -// .storybook/preview.js +import React, { useRef, useState } from "react" import { addDecorator } from "@storybook/react" -// import theme from "./codeTheme" import DocViewer from "../libs/doc-viewer" -import "./reset.css" +import theme from "./themes/code-theme" import "@hi-ui/hiui/es/base-css" -import React, { useRef, useState } from "react" + // import { Meta, ArgsTable, Source, Story, Canvas } from "@storybook/addon-docs/blocks" // import { Title, Subtitle, Description, Primary, ArgsTable, Stories, PRIMARY_STORY } from "@storybook/addon-docs/blocks" // import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live" @@ -18,9 +17,16 @@ import React, { useRef, useState } from "react" // import Checkbox from "../packages/ui/checkbox/src" // import EmptyState from "../packages/ui/empty-state/src" -const importRegx = /import\s+([\w*{}\n, ])+.*;?/gm +const withThemeProvider = (Story,context) => { + const theme = getTheme(context.globals.theme); + return ( + + + + ) +} -function addSbCodeEditro(cb, props) { +const withCodeEditor = (cb, props) => { const { argTypes, args } = props const Component = props.parameters.component const { parameters = {}, globals } = props @@ -40,19 +46,27 @@ function addSbCodeEditro(cb, props) { ) } -addDecorator(addSbCodeEditro) +/** + * Add global stories Decorators + */ +export const decorators = [withThemeProvider]; +/** +* Add global stories context +*/ export const parameters = { actions: { argTypesRegex: "^on[A-Z].*" }, layout: "centered", options: { storySort: { - order: ["HiUI 简介", "Alert", "页面", "数据录入"], locales: "en-US" } } } +/** +* Add global toolbar menus for switching to theme, i18n and RTL-LTR +*/ export const globalTypes = { theme: { name: "Theme", @@ -60,23 +74,28 @@ export const globalTypes = { defaultValue: "light", toolbar: { icon: "circlehollow", - // array of plain string values or MenuItem shape (see below) - items: ["light", "dark"] - } + items: ["light", "dark"], + }, }, locale: { name: "Locale", description: "Internationalization locale", - defaultValue: "en", + defaultValue: "zh", toolbar: { icon: "globe", items: [ - { value: "en", right: "🇺🇸", title: "English" }, - { value: "fr", right: "🇫🇷", title: "Français" }, - { value: "es", right: "🇪🇸", title: "Español" }, { value: "zh", right: "🇨🇳", title: "中文" }, - { value: "kr", right: "🇰🇷", title: "한국어" } - ] - } - } + { value: "en", right: "🇺🇸", title: "English" }, + ], + }, + }, + direction: { + name: "Direction", + description: "Direction for layout", + defaultValue: "LTR", + toolbar: { + icon: "transfer", + items: ["LTR", "RTL"], + }, + }, } diff --git a/.storybook/reset.css b/.storybook/reset.css deleted file mode 100644 index 8e345e44b..000000000 --- a/.storybook/reset.css +++ /dev/null @@ -1,38 +0,0 @@ -table { - font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace, Apple Color Emoji, Segoe UI Emoji, - Segoe UI Symbol; - width: 100%; - border-radius: 2px; - border-collapse: collapse; - border: 1px solid #e7e7e7; - line-height: 22px; - color: #666; - margin-top: 16px; -} - -table:not(.no-border):not(.no-vertical-border) tr > td:first-of-type { - color: #3b77db; -} - -table:not(.no-border):not(.no-vertical-border) td { - padding: 20px 9px; - border: 1px solid #e7e7e7; -} - -table:not(.no-border):not(.no-vertical-border) th { - text-align: left; - border: 1px solid #e7e7e7; - padding: 20px 10px; - background: #f6f6f6; -} - -table:not(.no-border):not(.no-vertical-border) tr > td:nth-of-type(3) { - color: #e65069; -} - -.sbdocs { - margin-top: 20px; -} -#root { - margin-top: 60px; -} diff --git a/.storybook/stringReplace.js b/.storybook/stringReplace.js deleted file mode 100644 index 4297690bc..000000000 --- a/.storybook/stringReplace.js +++ /dev/null @@ -1,15 +0,0 @@ -const { getOptions } = require('loader-utils') - -/** - * A Simplest loader - * @param {*} source - * @returns - */ -module.exports = function (source) { - if (typeof source !== 'string') { - return source - } - const options = getOptions(this) - const { from = '', to = '' } = options - return source.replace(from, to) -} diff --git a/.storybook/codeTheme.js b/.storybook/themes/code-theme.js similarity index 100% rename from .storybook/codeTheme.js rename to .storybook/themes/code-theme.js diff --git a/.storybook/hiuiTheme.js b/.storybook/themes/hiui-theme.js similarity index 95% rename from .storybook/hiuiTheme.js rename to .storybook/themes/hiui-theme.js index 658dae154..fa13d59c6 100644 --- a/.storybook/hiuiTheme.js +++ b/.storybook/themes/hiui-theme.js @@ -32,7 +32,7 @@ export default create({ // inputBorderRadius: 4, base: 'light', - brandTitle: 'My custom storybook', + brandTitle: 'HiUI', brandUrl: 'https://infra.mioffice.cn/hiui/zh-CN/', brandImage: '', -}); \ No newline at end of file +}) diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js deleted file mode 100644 index ebf30649d..000000000 --- a/.storybook/webpack.config.js +++ /dev/null @@ -1,45 +0,0 @@ -const HtmlWebpackPlugin = require('html-webpack-plugin') -// const rehypePrism = require('@mapbox/rehype-prism') - -const IS_GITHUB = process.env.DOC_ENV === 'github' - -module.exports = { - output: { - publicPath: IS_GITHUB ? '/hiui/' : '/', - filename: '[name].js', - chunkFilename: '[name].chunk.js' - }, - resolve: { - extensions: ['.web.js', '.js', '.jsx', '.json'], - }, - module: { - rules: [ - { - test: /\.s?css$/, - use: ['style-loader', 'css-loader', 'sass-loader'] - }, - { - test: /(fontawesome-webfont)\.(svg)$/, - loader: 'file-loader', - options: { - name: './static/fonts/[name].[ext]?[hash]' - } - }, - { - test: /\.(png|jpg|gif|svg)$/, - loader: 'url-loader', - options: { - limit: 1000, - name: './static/img/[name].[ext]?[hash]' - } - }, - { - test: /\.(eot|ttf|woff|woff2|otf)/, - loader: 'file-loader', - options: { - name: './static/fonts/[name].[ext]?[hash]' - } - } - ] - } -} diff --git a/.storybook/font/OpenSans-Light-webfont.eot b/assets/fonts/OpenSans-Light-webfont.eot similarity index 100% rename from .storybook/font/OpenSans-Light-webfont.eot rename to assets/fonts/OpenSans-Light-webfont.eot diff --git a/.storybook/font/OpenSans-Light-webfont.svg b/assets/fonts/OpenSans-Light-webfont.svg similarity index 99% rename from .storybook/font/OpenSans-Light-webfont.svg rename to assets/fonts/OpenSans-Light-webfont.svg index deadc3ef1..c7ae13a29 100755 --- a/.storybook/font/OpenSans-Light-webfont.svg +++ b/assets/fonts/OpenSans-Light-webfont.svg @@ -1,252 +1,252 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.storybook/font/OpenSans-Light-webfont.ttf b/assets/fonts/OpenSans-Light-webfont.ttf similarity index 100% rename from .storybook/font/OpenSans-Light-webfont.ttf rename to assets/fonts/OpenSans-Light-webfont.ttf diff --git a/.storybook/font/OpenSans-Light-webfont.woff b/assets/fonts/OpenSans-Light-webfont.woff similarity index 100% rename from .storybook/font/OpenSans-Light-webfont.woff rename to assets/fonts/OpenSans-Light-webfont.woff diff --git a/.storybook/font/OpenSans-Regular-webfont.eot b/assets/fonts/OpenSans-Regular-webfont.eot similarity index 100% rename from .storybook/font/OpenSans-Regular-webfont.eot rename to assets/fonts/OpenSans-Regular-webfont.eot diff --git a/.storybook/font/OpenSans-Regular-webfont.svg b/assets/fonts/OpenSans-Regular-webfont.svg similarity index 99% rename from .storybook/font/OpenSans-Regular-webfont.svg rename to assets/fonts/OpenSans-Regular-webfont.svg index 46a8f4c6c..ead219a56 100755 --- a/.storybook/font/OpenSans-Regular-webfont.svg +++ b/assets/fonts/OpenSans-Regular-webfont.svg @@ -1,252 +1,252 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.storybook/font/OpenSans-Regular-webfont.ttf b/assets/fonts/OpenSans-Regular-webfont.ttf similarity index 100% rename from .storybook/font/OpenSans-Regular-webfont.ttf rename to assets/fonts/OpenSans-Regular-webfont.ttf diff --git a/.storybook/font/OpenSans-Regular-webfont.woff b/assets/fonts/OpenSans-Regular-webfont.woff similarity index 100% rename from .storybook/font/OpenSans-Regular-webfont.woff rename to assets/fonts/OpenSans-Regular-webfont.woff diff --git a/.storybook/font/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf b/assets/fonts/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf similarity index 100% rename from .storybook/font/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf rename to assets/fonts/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf diff --git a/.storybook/font/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf b/assets/fonts/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf similarity index 100% rename from .storybook/font/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf rename to assets/fonts/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf diff --git a/.storybook/font/pe0qMImSLYBIv1o4X1M8cce9I94.ttf b/assets/fonts/pe0qMImSLYBIv1o4X1M8cce9I94.ttf similarity index 100% rename from .storybook/font/pe0qMImSLYBIv1o4X1M8cce9I94.ttf rename to assets/fonts/pe0qMImSLYBIv1o4X1M8cce9I94.ttf diff --git a/.storybook/icon/percolate.eot b/assets/icons/percolate.eot similarity index 100% rename from .storybook/icon/percolate.eot rename to assets/icons/percolate.eot diff --git a/.storybook/icon/percolate.svg b/assets/icons/percolate.svg similarity index 100% rename from .storybook/icon/percolate.svg rename to assets/icons/percolate.svg diff --git a/.storybook/icon/percolate.ttf b/assets/icons/percolate.ttf similarity index 100% rename from .storybook/icon/percolate.ttf rename to assets/icons/percolate.ttf diff --git a/.storybook/icon/percolate.woff b/assets/icons/percolate.woff similarity index 100% rename from .storybook/icon/percolate.woff rename to assets/icons/percolate.woff diff --git a/.storybook/icon/todos.eot b/assets/icons/todos.eot similarity index 100% rename from .storybook/icon/todos.eot rename to assets/icons/todos.eot diff --git a/.storybook/icon/todos.svg b/assets/icons/todos.svg similarity index 100% rename from .storybook/icon/todos.svg rename to assets/icons/todos.svg diff --git a/.storybook/icon/todos.ttf b/assets/icons/todos.ttf similarity index 100% rename from .storybook/icon/todos.ttf rename to assets/icons/todos.ttf diff --git a/.storybook/icon/todos.woff b/assets/icons/todos.woff similarity index 100% rename from .storybook/icon/todos.woff rename to assets/icons/todos.woff diff --git a/assets/code-brackets.svg b/assets/images/code-brackets.svg similarity index 100% rename from assets/code-brackets.svg rename to assets/images/code-brackets.svg diff --git a/assets/colors.svg b/assets/images/colors.svg similarity index 100% rename from assets/colors.svg rename to assets/images/colors.svg diff --git a/assets/comments.svg b/assets/images/comments.svg similarity index 100% rename from assets/comments.svg rename to assets/images/comments.svg diff --git a/assets/direction.svg b/assets/images/direction.svg similarity index 100% rename from assets/direction.svg rename to assets/images/direction.svg diff --git a/assets/flow.svg b/assets/images/flow.svg similarity index 100% rename from assets/flow.svg rename to assets/images/flow.svg diff --git a/assets/plugin.svg b/assets/images/plugin.svg similarity index 100% rename from assets/plugin.svg rename to assets/images/plugin.svg diff --git a/assets/repo.svg b/assets/images/repo.svg similarity index 100% rename from assets/repo.svg rename to assets/images/repo.svg diff --git a/assets/stackalt.svg b/assets/images/stackalt.svg similarity index 100% rename from assets/stackalt.svg rename to assets/images/stackalt.svg diff --git a/build-tools/package.json b/build-tools/package.json deleted file mode 100644 index b9a99931b..000000000 --- a/build-tools/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "hiui-build-tools", - "version": "0.0.2", - "description": "", - "main": "webpack.config.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { - "@babel/core": "^7.4.4", - "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-flow": "^7.12.13", - "@babel/plugin-syntax-jsx": "^7.12.13", - "@babel/plugin-transform-runtime": "^7.11.5", - "@babel/polyfill": "^7.4.4", - "@babel/preset-env": "^7.4.5", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.13.0", - "@babel/runtime": "^7.13.6", - "@babel/standalone": "^7.4.5", - "@mdx-js/loader": "^1.1.0", - "babel-loader": "^8.2.2", - "babel-plugin-lodash": "^3.3.4", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-plugin-transform-remove-console": "^6.9.4", - "clean-webpack-plugin": "^3.0.0", - "css-loader": "^5.0.1", - "glob": "^7.1.6", - "mini-css-extract-plugin": "^1.3.8", - "terser-webpack-plugin": "^5.1.1", - "webpack": "^4.46.0", - "webpack-cli": "^4.5.0", - "webpack-merge": "^5.7.3" - }, - "author": "", - "license": "ISC" -} diff --git a/build-tools/webpack.config.js b/build-tools/webpack.config.js deleted file mode 100644 index 566643ae5..000000000 --- a/build-tools/webpack.config.js +++ /dev/null @@ -1,103 +0,0 @@ -// 包抽离 -// const TerserPlugin = require('terser-webpack-plugin') -// const MiniCssExtractPlugin = require('mini-css-extract-plugin') -// const fs = require('fs') -const path = require('path') -const glob = require('glob') -const { CleanWebpackPlugin } = require('clean-webpack-plugin') -const resolve = (subpath) => { - return path.join(process.cwd(), subpath) -} - -const getUrlLoader = (type) => { - return { - loader: require.resolve('url-loader'), - options: { - limit: 10 * 1024, - publicPath: '/', - name: path.join('./', `${type}/[name].[hash:8].[ext]`) - } - } -} -const getDeepEntry = (srcDirName) => { - const entry = {} - glob.sync(srcDirName, { matchBase: true }).forEach((name, ...arg) => { - let key = name.replace('/src', '') - if (key.includes('.scss') || key.includes('.css') || key.includes('.stories') || key.includes('d.ts')) return - const typeIndex = key.lastIndexOf('.') - key = key.substring(0, typeIndex) - entry[key] = resolve(name) - }) - - return entry -} -// 没用调用的代码,保留-0308 -// const allPackageModules = () => { -// var exts = {} -// fs.readdirSync(__dirname + '/node_modules').forEach((item) => { -// // 我没有使用es6 -// if (item.indexOf('.') === 0) return -// exts[item] = 'commonjs ' + item -// }) -// return exts -// } -const entryFile = Object.assign(getDeepEntry('./src/**/*.*')) - -module.exports = { - entry: { ...entryFile }, - output: { - filename: '[name].js', - libraryTarget: 'umd', - path: process.cwd() + '/es' - }, - resolve: { - extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], - modules: ['node_modules'] - }, - externals: { - react: 'react', - React: 'react', - 'react-dom': 'react-dom', - classNames: 'classNames', - lodash: { - commonjs: 'lodash', - commonjs2: 'lodash', - amd: 'lodash', - root: '_' // 指向全局变量 - } - }, - mode: 'production', - module: { - rules: [ - { - test: /\.(js|jsx|tsx|ts)$/, - loader: 'babel-loader', - options: { - presets: ['@babel/preset-react', '@babel/preset-typescript'], - plugins: [ - ['transform-class-properties'], - ['@babel/plugin-syntax-class-properties'], - ['@babel/plugin-syntax-jsx'] - ] - } - }, - { - test: /\.(scss|css)$/, - use: ['style-loader', 'css-loader', 'sass-loader'] - }, - { - test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, - use: getUrlLoader('imgs') - }, - { - test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, - use: getUrlLoader('media') - }, - { - test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, - use: getUrlLoader('fonts') - } - ] - }, - plugins: [new CleanWebpackPlugin()] -} diff --git a/commitlint.config.js b/commitlint.config.js index c2177abe8..df07b9c4d 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -11,6 +11,10 @@ module.exports = { 'subject-tense': [1, 'always', ['present-imperative']], 'type-case': [2, 'always', 'lowerCase'], 'type-empty': [2, 'never'], - 'type-enum': [2, 'always', ['build', 'chore', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']] - } + 'type-enum': [ + 2, + 'always', + ['build', 'chore', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'], + ], + }, } diff --git a/packages/ui/alert/package.json b/packages/ui/alert/package.json index 83ea1f62b..1580b34d1 100644 --- a/packages/ui/alert/package.json +++ b/packages/ui/alert/package.json @@ -4,8 +4,7 @@ "description": "", "main": "es/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "compile": "webpack --config ./node_modules/hiui-build-tools/webpack.config.js" + "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", @@ -14,6 +13,5 @@ "classnames": "^2.2.6" }, "devDependencies":{ - "hiui-build-tools": "0.0.2" } } diff --git a/packages/ui/checkbox/package.json b/packages/ui/checkbox/package.json index 26994a17d..34604371c 100644 --- a/packages/ui/checkbox/package.json +++ b/packages/ui/checkbox/package.json @@ -4,8 +4,7 @@ "description": "", "main": "es/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "compile": "webpack --config ./node_modules/hiui-build-tools/webpack.config.js" + "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", @@ -14,6 +13,5 @@ "lodash": "^4.17.11" }, "devDependencies": { - "hiui-build-tools": "0.0.2" } } diff --git a/packages/ui/core/package.json b/packages/ui/core/package.json index 948525751..62fbd19c9 100644 --- a/packages/ui/core/package.json +++ b/packages/ui/core/package.json @@ -3,11 +3,9 @@ "version": "0.0.1", "description": "", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "compile": "webpack --config ./node_modules/hiui-build-tools/webpack.config.js" + "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { - "hiui-build-tools": "0.0.2" }, "author": "HIUI ", "license": "MIT", diff --git a/packages/ui/loading/package.json b/packages/ui/loading/package.json index 3880a56ad..45e5b8a65 100644 --- a/packages/ui/loading/package.json +++ b/packages/ui/loading/package.json @@ -31,8 +31,7 @@ "devDependencies": { "@babel/plugin-syntax-class-properties": "^7.12.13", "@babel/preset-react": "^7.12.13", - "@types/react-transition-group": "^4.4.1", - "hiui-build-tools": "0.0.2" + "@types/react-transition-group": "^4.4.1" }, "peerDependencies": { "react": "^17.0.1", diff --git a/packages/ui/popper/package.json b/packages/ui/popper/package.json index aada142fd..ecd818213 100644 --- a/packages/ui/popper/package.json +++ b/packages/ui/popper/package.json @@ -4,8 +4,7 @@ "description": "", "main": "es/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "compile": "webpack --config ./node_modules/hiui-build-tools/webpack.config.js" + "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", @@ -16,8 +15,7 @@ }, "devDependencies": { "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/preset-react": "^7.12.13", - "hiui-build-tools": "0.0.2" + "@babel/preset-react": "^7.12.13" }, "gitHead": "ad9f74a44192949f1b49a0fc8fc6fadedabff0bb" } diff --git a/packages/ui/select/package.json b/packages/ui/select/package.json index 5b80be488..ea1b077e4 100644 --- a/packages/ui/select/package.json +++ b/packages/ui/select/package.json @@ -5,7 +5,6 @@ "main": "es/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "compile": "webpack --config ./node_modules/hiui-build-tools/webpack.config.js" }, "author": "", "license": "ISC", @@ -14,7 +13,6 @@ "hiui-popper": "^0.0.3-alpha.0" }, "devDependencies": { - "hiui-build-tools": "0.0.2", "@babel/plugin-syntax-class-properties": "^7.12.13", "@babel/preset-react": "^7.12.13" }, diff --git a/postcss.config.js b/postcss.config.js index 04f510b60..304a19ff0 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -5,7 +5,7 @@ module.exports = { plugins: [ rucksack(), autoprefixer({ - browsers: ['last 2 versions', 'ie > 9'] - }) - ] + browsers: ['last 2 versions', 'ie > 9'], + }), + ], }