dai-cli

f

2022/1/8 10:48:19

更改列表

.gitignore 2(+2 -0)

.prettierrc 16(+16 -0)

desktop.ini 6(+6 -0)

index.js 0(+0 -0)

package.json 20(+20 -0)

详细信息

.gitignore 2(+2 -0)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..04c01ba
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules/
+dist/
\ No newline at end of file

.prettierrc 16(+16 -0)

diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..6c1a4ff
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,16 @@
+{
+    "printWidth": 120,
+    "tabWidth": 4,
+    "semi": true,
+    "singleQuote": true,
+    "trailingComma": "none",
+    "bracketSpacing": true,
+    "jsxBracketSameLine": false,
+    "arrowParens": "always",
+    "requirePragma": false,
+    "proseWrap": "preserve",
+    "stylelintIntegration": true,
+    "stylelint.config": {
+        "indentation": 2
+    }
+}

desktop.ini 6(+6 -0)

diff --git a/desktop.ini b/desktop.ini
new file mode 100644
index 0000000..85fe68f
--- /dev/null
+++ b/desktop.ini
@@ -0,0 +1,6 @@
+[.ShellClassInfo]
+InfoTip=���ּ�
+[ViewState]
+Mode=
+Vid=
+FolderType=Generic

index.js 0(+0 -0)

diff --git a/index.js b/index.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/index.js

package.json 20(+20 -0)

diff --git a/package.json b/package.json
new file mode 100644
index 0000000..eec4e23
--- /dev/null
+++ b/package.json
@@ -0,0 +1,20 @@
+{
+  "name": "dai-cli",
+  "type": "module",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "chalk": "^5.0.0",
+    "commander": "^8.3.0",
+    "download-git-repo": "^3.0.2",
+    "handlebars": "^4.7.7",
+    "inquirer": "^8.2.0",
+    "ora": "^6.0.1"
+  }
+}
diff --git a/src/webpack.build.js b/src/webpack.build.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/webpack.build.js
diff --git a/src/webpack.config.build.js b/src/webpack.config.build.js
new file mode 100644
index 0000000..9a4077e
--- /dev/null
+++ b/src/webpack.config.build.js
@@ -0,0 +1,143 @@
+var webpack = require('webpack');
+// 用于生成HTML文件并自动注入依赖文件(link/script)的webpack插件
+var HtmlWebpackPlugin = require('html-webpack-plugin');
+var CopyWebpackPlugin = require('copy-webpack-plugin');
+var VueLoaderPlugin = require('vue-loader/lib/plugin');
+var path = require('path');
+var webpack = require('webpack');
+
+module.exports = function (config) {
+    let webpackConfig = {
+        // devtool: 'eval',
+        devServer: {
+            disableHostCheck: true,
+            host: '0.0.0.0',
+            port: 8889
+        },
+        entry: {
+            // babel: 'babel-polyfill',
+            index: './main/index.js'
+        },
+        output: {
+            // path: __dirname,
+            path: path.resolve(config.buildPath),
+            filename: './static/scripts/[name].[hash:7].bundle.js',
+            // 没有指定输出名的文件输出的文件名格式
+            chunkFilename: './static/scripts/[name].[chunkhash].js'
+        },
+        module: {
+            rules: [
+                // {
+                //     test: /.js$/,
+                //     loader: 'babel-loader',
+                //     options: {
+                //         presets: ['@babel/preset-env'],
+                //         plugins: ['@babel/plugin-proposal-class-properties']
+                //     }
+                // },
+                {
+                    test: /\.css$/,
+                    use: [
+                        {
+                            loader: 'vue-style-loader'
+                        },
+                        {
+                            loader: 'css-loader'
+                        }
+                    ]
+                },
+                {
+                    test: /\.less$/,
+                    use: [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'less-loader' }]
+                },
+                { test: /\.vue$/, loader: 'vue-loader' },
+                {
+                    test: /\.(png|jpe?g|gif)$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 5120,
+                        name: 'static/images/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                },
+                {
+                    test: /\.(|eot|woff|woff2|ttf|svg)$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 10000,
+                        name: './static/fonts/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                },
+                {
+                    test: /\.(xls|doc)?$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 10000,
+                        name: './static/other/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                }
+            ]
+        },
+        // 配置webpack插件
+        plugins: [
+            new HtmlWebpackPlugin({
+                filename: './index.html',
+                template: './main/index.html',
+                // favicon: './main/favicon.ico',
+                inject: true,
+                title: '兔小乖字帖'
+            }),
+            new VueLoaderPlugin(),
+            //拷贝文件
+            // new CopyWebpackPlugin([
+            //     {
+            //         from: './src/content/other',
+            //         to: './static/other',
+            //         ignore: ['.*']
+            //     }
+            // ]),
+            new webpack.DefinePlugin({
+                // 定义环境和变量
+                'process.env': {
+                    NODE_ENV: JSON.stringify('production')
+                }
+            })
+        ],
+        optimization: {
+            splitChunks: {
+                cacheGroups: {
+                    commons: {
+                        name: 'commons',
+                        chunks: 'initial',
+                        minChunks: 2,
+                        minSize: 0
+                    },
+                    vendor: {
+                        test: /node_modules/,
+                        chunks: 'initial',
+                        name: 'vendor',
+                        priority: 10,
+                        enforce: true
+                    }
+                }
+            },
+            // // 表示只导出那些外部使用了的那些成员
+            // usedExports: true,
+            // // 压缩模块
+            // minimize:true,
+            // // 合并模块
+            // concatenateModules:true,
+            runtimeChunk: false
+        },
+        resolve: {
+            // Vue v2.x 之后 NPM Package 预设会分出 runtime-only 版本,若要使用 standalone 功能则需下列设定s
+            alias: {
+                vue$: 'vue/dist/vue.js'
+            }
+        },
+        mode: 'production'
+    };
+    return webpackConfig;
+};
diff --git a/src/webpack.config.dev.js b/src/webpack.config.dev.js
new file mode 100644
index 0000000..1456736
--- /dev/null
+++ b/src/webpack.config.dev.js
@@ -0,0 +1,104 @@
+// 用于生成HTML文件并自动注入依赖文件(link/script)的webpack插件
+var HtmlWebpackPlugin = require('html-webpack-plugin');
+var VueLoaderPlugin = require('vue-loader/lib/plugin');
+var webpack = require('webpack');
+module.exports = function (config) {
+    var webpackConfig = {
+        devtool: 'eval',
+        devServer: {
+            disableHostCheck: true,
+            host: '0.0.0.0',
+            port: 8881
+        },
+        entry: {
+            index: './main/index.js'
+        },
+        output: {
+            path: __dirname,
+            filename: '.y/scripts/[name].bundle.js'
+        },
+        module: {
+            rules: [
+                // {
+                //     test: /.js$/,
+                //     loader: 'babel-loader',
+                //     options: {
+                //         presets: ['@babel/preset-env'],
+                //         plugins: ['@babel/plugin-proposal-class-properties']
+                //     }
+                // },
+                {
+                    test: /\.css$/,
+                    use: [
+                        {
+                            loader: 'vue-style-loader'
+                        },
+                        {
+                            loader: 'css-loader'
+                        },
+                        { loader: 'less-loader' }
+                    ]
+                },
+                {
+                    test: /\.less$/,
+                    use: [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'less-loader' }]
+                },
+                { test: /\.vue$/, loader: 'vue-loader' },
+                {
+                    test: /\.(png|jpe?g|gif)$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 5120,
+                        name: 'static/images/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                },
+                {
+                    test: /\.(|eot|woff|woff2|ttf|svg)$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 5120,
+                        name: './static/fonts/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                },
+                {
+                    test: /\.(xls|doc)?$/,
+                    loader: 'url-loader',
+                    options: {
+                        limit: 5120,
+                        name: './static/other/[name].[hash:7].bundle.[ext]',
+                        esModule: false
+                    }
+                }
+            ]
+        },
+        // 配置webpack插件
+        plugins: [
+            new HtmlWebpackPlugin({
+                filename: './index.html',
+                template: './main/index.html',
+                inject: true,
+                title: '兔小乖字帖'
+            }),
+            // new webpack.DefinePlugin({
+            //     'process.env.NODE_ENV': JSON.stringify('production')
+            // }),
+            new webpack.DefinePlugin({
+                // 定义环境和变量
+                'process.env': {
+                    NODE_ENV: JSON.stringify('development')
+                }
+            }),
+            new VueLoaderPlugin()
+        ],
+        resolve: {
+            // Vue v2.x 之后 NPM Package 预设会分出 runtime-only 版本,若要使用 standalone 功能则需下列设定s
+            alias: {
+                vue$: 'vue/dist/vue.js'
+            }
+        },
+        mode: 'development'
+    };
+    return webpackConfig;
+};
diff --git a/src/webpack.dev.js b/src/webpack.dev.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/webpack.dev.js