Skip to content

Commit

Permalink
upload
Browse files Browse the repository at this point in the history
  • Loading branch information
moshang-ax committed Dec 5, 2020
0 parents commit 30c1b78
Show file tree
Hide file tree
Showing 67 changed files with 18,221 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
env: {
node: true
},
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
parser: "babel-eslint"
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
}
};
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.vscode
.git
build
docs
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# mo-chart

## 目录说明

### components
组件js,html源码文件夹

### scss
组件样式源码文件夹

### router
页面展示路由配置文件夹

### views
组件样例展示文件夹,建议在开发组件的过程中,测试demo写在该文件夹下对应的文件中,后期开发使用文档时可以直接复用,节省编写使用demo的时间,保证使用文档场景的覆盖
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
};
3 changes: 3 additions & 0 deletions build/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
// text: "./src/components/Text/index.js",
};
3 changes: 3 additions & 0 deletions build/scss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
// text: "./src/scss/text.scss",
};
59 changes: 59 additions & 0 deletions build/webpack.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const path = require("path");
const root = path.resolve(__dirname, ".."); // 项目的根目录绝对路径
const { VueLoaderPlugin } = require("vue-loader");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const config = require("./components.js");

module.exports = {
entry: config, // 入口文件路径
output: {
path: path.join(root, "dist/lib"), // 出口目录
chunkFilename: "[name].js?[chunkhash:5]",
filename: "[name].js",
//library: 'reasyUIVue',
libraryTarget: "commonjs2",
libraryExport: "default"
},
resolve: {
alias: {
// 配置目录别名
// 在任意目录下require('components/example') 相当于require('项目根目录/src/components/example')
vue: "vue/dist/vue.js", //解决 [Vue warn]: You are using the runtime-only build of Vue
"@": path.resolve("src")
},
extensions: [".js", ".vue"] // 引用js和vue文件可以省略后缀名
},

module: {
// 配置loader
rules: [
{
test: /\.js$/, //匹配所有.js文件
use: [
{
loader: "babel-loader"
}
],
exclude: /node_modules/ //排除node_module下的所有文件
},
{
test: /\.vue$/, //匹配所有.js文件
loader: "vue-loader",
options: {
loaders: {
js: "babel-loader",
//css: 'style-loader',
scss: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
},
extractCSS: true
}
}
]
},
optimization: {
//webpack 4
minimize: false
},
devtool: false,
plugins: [new VueLoaderPlugin(), new UglifyJsPlugin()]
};
119 changes: 119 additions & 0 deletions build/webpack.publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
const path = require("path");
const root = path.resolve(__dirname, ".."); // 项目的根目录绝对路径
const { VueLoaderPlugin } = require("vue-loader");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
entry: {
app: ["./src/components/index.js"]
}, // 入口文件路径
output: {
path: path.join(root, "dist/"), // 出口目录
publicPath: process.env.NODE_ENV === "publish" ? "/dist" : "/",
chunkFilename: "[name].js?[chunkhash:5]",
filename: "mo-chart.js",
libraryTarget: "commonjs2",
libraryExport: "default",
library: "mo-chart"
},
resolve: {
alias: {
// 配置目录别名
// 在任意目录下require('components/example') 相当于require('项目根目录/src/components/example')
vue: "vue/dist/vue.js", //解决 [Vue warn]: You are using the runtime-only build of Vue
"@": path.resolve("src")
},
extensions: [".js", ".vue"] // 引用js和vue文件可以省略后缀名
},

module: {
// 配置loader
rules: [
{
//npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
test: /\.(scss|css)$/,
use: [
//"vue-style-loader",
MiniCssExtractPlugin.loader,
"css-loader",
/* {
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1
}
}, */
"postcss-loader",
{
loader: "sass-loader"
},
{
loader: "sass-resources-loader",
options: {
// Provide path to the file with resources
resources: "./src/scss/vars.scss"
}
}
],
exclude: /node_modules/
},

{
test: /\.(png|jpe?g|gif)(\?.*)?$/,
loader: "url-loader",
options: {
limit: 1000,
publicPath: "/img/",
outputPath: "/img/",
name: "[name].[ext]?[hash:7]"
}
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
loader: "url-loader",
options: {
publicPath: "/fonts/",
outputPath: "/fonts/",
name: "vui-[name].[ext]?[hash:7]"
}
},

{
test: /\.js$/, //匹配所有.js文件
use: [
{
loader: "babel-loader"
}
],
exclude: /node_modules/ //排除node_module下的所有文件
},
{
test: /\.vue$/, //匹配所有.js文件

loader: "vue-loader",
options: {
loaders: {
js: "babel-loader",
//css: 'style-loader',
scss: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
},
extractCSS: true
}
}
]
},
optimization: {
//webpack 4
minimize: false
},
devtool: false,
plugins: [
new MiniCssExtractPlugin({
filename: "styles.css?[contenthash:5]",
chunkFilename: "[id].css"
}),
new VueLoaderPlugin(),
new UglifyJsPlugin()
]
};
70 changes: 70 additions & 0 deletions build/webpack.scss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
const path = require("path");
const root = path.resolve(__dirname, ".."); // 项目的根目录绝对路径
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const config = require("./scss.js");
module.exports = {
entry: config, // 入口文件路径
output: {
path: path.join(root, "dist/lib"), // 出口目录
publicPath: "/"
},
resolve: {
alias: {
// 配置目录别名
// 在任意目录下require('components/example') 相当于require('项目根目录/src/components/example')
vue: "vue/dist/vue.js", //解决 [Vue warn]: You are using the runtime-only build of Vue
"@": path.resolve("src")
},
extensions: [".js", ".vue"] // 引用js和vue文件可以省略后缀名
},

module: {
// 配置loader
rules: [
{
//npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
test: /\.(scss|css)$/,
use: [
//"vue-style-loader",
MiniCssExtractPlugin.loader,
"css-loader",
"postcss-loader",
{
loader: "sass-loader"
},

{
loader: "sass-resources-loader",
options: {
// Provide path to the file with resources
resources: "./src/scss/vars.scss"
}
}
],
exclude: /node_modules/
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
loader: "url-loader",
options: {
publicPath: "../../fonts/",
outputPath: "../fonts/",
name: "v-[name].[ext]?[hash:7]"
}
}
]
},
optimization: {
//webpack 4
minimize: false
},
devtool: false,
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: "css/[name].css",
chunkFilename: "[id].css"
})
]
};
Loading

0 comments on commit 30c1b78

Please sign in to comment.