automan-cmd 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +65 -0
- package/README.md +56 -0
- package/bin/automan +3 -0
- package/bin/automan-build +3 -0
- package/bin/automan-config +3 -0
- package/bin/automan-create +3 -0
- package/bin/automan-publish +3 -0
- package/lib/automan-build.js +41 -0
- package/lib/automan-config.js +82 -0
- package/lib/automan-create.js +137 -0
- package/lib/automan-publish.js +331 -0
- package/lib/index.js +13 -0
- package/lib/install.js.tpl +47 -0
- package/lib/util.js +174 -0
- package/package.json +37 -0
- package/tpl/.babelrc +16 -0
- package/tpl/.browserslistrc +3 -0
- package/tpl/.eslintignore +2 -0
- package/tpl/.eslintrc.js +228 -0
- package/tpl/.gitignore.ejs +12 -0
- package/tpl/.postcssrc.js +12 -0
- package/tpl/README.md +1 -0
- package/tpl/changelog.md +1 -0
- package/tpl/editor/index.vue +45 -0
- package/tpl/icon.png +0 -0
- package/tpl/jsconfig.json +7 -0
- package/tpl/package.json.ejs +66 -0
- package/tpl/preview/app.vue +326 -0
- package/tpl/preview/attr/Data.vue +69 -0
- package/tpl/preview/attr/Resource.vue +79 -0
- package/tpl/preview/attr/com.vue +21 -0
- package/tpl/preview/attr/index.js +16 -0
- package/tpl/preview/components/Attribute.vue +365 -0
- package/tpl/preview/components/FitImg.vue +152 -0
- package/tpl/preview/components/ImgViewer.vue +80 -0
- package/tpl/preview/components/Loading.vue +55 -0
- package/tpl/preview/components/Toast.vue +111 -0
- package/tpl/preview/index.js +22 -0
- package/tpl/preview/index.tpl +13 -0
- package/tpl/preview/lib/ESlog.js +46 -0
- package/tpl/preview/lib/Util.js +57 -0
- package/tpl/preview/lib/fetch.js +139 -0
- package/tpl/preview/lib/index.js +15 -0
- package/tpl/preview/lib/vue/filters.js +53 -0
- package/tpl/preview/lib/vue/index.js +9 -0
- package/tpl/preview/lib/vue/mixin.js +166 -0
- package/tpl/preview/mint-ui/message-box/index.js +1503 -0
- package/tpl/preview/mint-ui/message-box/style.css +159 -0
- package/tpl/preview/mint-ui/popup/index.js +1046 -0
- package/tpl/preview/mint-ui/popup/style.css +115 -0
- package/tpl/preview/mint-ui/spinner/index.js +657 -0
- package/tpl/preview/mint-ui/spinner/style.css +227 -0
- package/tpl/preview/mint-ui/swipe/index.js +907 -0
- package/tpl/preview/mint-ui/swipe/style.css +43 -0
- package/tpl/preview/mint-ui/swipe-item/index.js +171 -0
- package/tpl/preview/mint-ui/swipe-item/style.css +1 -0
- package/tpl/preview/style.css +126 -0
- package/tpl/server.config.js +6 -0
- package/tpl/src/assets/css/index.scss +29 -0
- package/tpl/src/example.vue +165 -0
- package/tpl/src/index.vue.ejs +32 -0
- package/tpl/webpack.config.js.ejs +267 -0
- package/tpl/yarn.lock +6037 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
const path = require('path')
|
2
|
+
const webpack = require('webpack')
|
3
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
4
|
+
const merge = require('webpack-merge')
|
5
|
+
const pkg = require('./package.json')
|
6
|
+
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
7
|
+
const ServerConfig = require('./server.config.js')
|
8
|
+
|
9
|
+
function getIPAdress() {
|
10
|
+
const interfaces = require('os').networkInterfaces()
|
11
|
+
for (const devName in interfaces) {
|
12
|
+
const iface = interfaces[ devName ]
|
13
|
+
for (let i = 0; i < iface.length; i++) {
|
14
|
+
const alias = iface[ i ]
|
15
|
+
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
|
16
|
+
return alias.address
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
// function normalizeName (name) {
|
23
|
+
// return name.replace(/[-_]+(\w)/g, (m, p) => p.toUpperCase())
|
24
|
+
// }
|
25
|
+
const COMPONENT_EDITOR = false
|
26
|
+
|
27
|
+
const config = {
|
28
|
+
module: {
|
29
|
+
rules: [
|
30
|
+
{
|
31
|
+
test: /\.(js|vue)$/,
|
32
|
+
loader: 'eslint-loader',
|
33
|
+
enforce: 'pre',
|
34
|
+
include: [path.resolve(__dirname, 'src'), path.resolve(__dirname, './preview')],
|
35
|
+
exclude: [path.resolve(__dirname, './preview/mint-ui/')],
|
36
|
+
options: {
|
37
|
+
formatter: require('eslint-friendly-formatter'),
|
38
|
+
emitWarning: false
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
test: /\.css$/,
|
43
|
+
use: [
|
44
|
+
'vue-style-loader',
|
45
|
+
{
|
46
|
+
loader: 'css-loader',
|
47
|
+
options: {
|
48
|
+
importLoaders: 2
|
49
|
+
}
|
50
|
+
},
|
51
|
+
'postcss-loader'
|
52
|
+
]
|
53
|
+
},
|
54
|
+
{
|
55
|
+
test: /\.s[ac]ss$/i,
|
56
|
+
use: [
|
57
|
+
"vue-style-loader",
|
58
|
+
{
|
59
|
+
loader: 'css-loader',
|
60
|
+
options: {
|
61
|
+
importLoaders: 2
|
62
|
+
}
|
63
|
+
},
|
64
|
+
'postcss-loader',
|
65
|
+
"sass-loader"
|
66
|
+
]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
test: /\.less$/,
|
70
|
+
use: [
|
71
|
+
'vue-style-loader',
|
72
|
+
'css-loader',
|
73
|
+
'less-loader'
|
74
|
+
]
|
75
|
+
},
|
76
|
+
{
|
77
|
+
test: /\.styl(us)?$/,
|
78
|
+
use: [
|
79
|
+
'vue-style-loader',
|
80
|
+
'css-loader',
|
81
|
+
'stylus-loader'
|
82
|
+
]
|
83
|
+
},
|
84
|
+
{
|
85
|
+
test: /\.vue$/,
|
86
|
+
loader: 'vue-loader',
|
87
|
+
options: {
|
88
|
+
transformToRequire: {
|
89
|
+
video: ['src', 'poster'],
|
90
|
+
source: 'src',
|
91
|
+
audio: 'src',
|
92
|
+
img: 'src',
|
93
|
+
image: 'xlink:href'
|
94
|
+
},
|
95
|
+
loaders: {
|
96
|
+
}
|
97
|
+
}
|
98
|
+
},
|
99
|
+
{
|
100
|
+
test: /\.m?js$/,
|
101
|
+
exclude: /node_modules/,
|
102
|
+
use: {
|
103
|
+
loader: 'babel-loader'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
108
|
+
loader: 'url-loader',
|
109
|
+
options: {
|
110
|
+
limit: 1,
|
111
|
+
name: '[name].[hash:7].[ext]'
|
112
|
+
}
|
113
|
+
},
|
114
|
+
{
|
115
|
+
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
116
|
+
loader: 'url-loader',
|
117
|
+
options: {
|
118
|
+
limit: 1,
|
119
|
+
name: '[name].[hash:7].[ext]'
|
120
|
+
}
|
121
|
+
},
|
122
|
+
{
|
123
|
+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
124
|
+
loader: 'url-loader',
|
125
|
+
options: {
|
126
|
+
limit: 1,
|
127
|
+
name: '[name].[hash:7].[ext]'
|
128
|
+
}
|
129
|
+
}
|
130
|
+
]
|
131
|
+
},
|
132
|
+
resolve: {
|
133
|
+
extensions: ['*', '.js', '.vue', '.json']
|
134
|
+
},
|
135
|
+
externals: {
|
136
|
+
'godspen-lib': '$GP'
|
137
|
+
},
|
138
|
+
performance: {
|
139
|
+
hints: false
|
140
|
+
},
|
141
|
+
devtool: 'cheap-module-eval-source-map',
|
142
|
+
plugins: [
|
143
|
+
new webpack.DefinePlugin({
|
144
|
+
'process.env': {
|
145
|
+
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
|
146
|
+
LABEL: JSON.stringify(pkg.label),
|
147
|
+
STYLE: JSON.stringify(pkg.style),
|
148
|
+
COMPONENT_EDITOR: JSON.stringify(COMPONENT_EDITOR)
|
149
|
+
}
|
150
|
+
})
|
151
|
+
],
|
152
|
+
stats: {
|
153
|
+
children: false
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
let preview = {}
|
158
|
+
if (process.env.PREVIEW_ENV === 'editor') {
|
159
|
+
preview = {
|
160
|
+
entry: {
|
161
|
+
index: './src/index.vue'
|
162
|
+
},
|
163
|
+
output: {
|
164
|
+
path: path.resolve(__dirname, './dist'),
|
165
|
+
publicPath: ServerConfig.publicPath,
|
166
|
+
library: `${ServerConfig.componentName}@${ServerConfig.componentVersion}[name]`,
|
167
|
+
libraryTarget: 'umd',
|
168
|
+
filename: '[name].js'
|
169
|
+
}
|
170
|
+
}
|
171
|
+
} else {
|
172
|
+
preview = {
|
173
|
+
entry: './preview/index.js',
|
174
|
+
output: {
|
175
|
+
path: path.resolve(__dirname, './dist'),
|
176
|
+
publicPath: '/',
|
177
|
+
filename: 'app.js'
|
178
|
+
}
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
if (process.env.NODE_ENV === 'development') {
|
183
|
+
module.exports = merge(config, preview, {
|
184
|
+
resolve: {
|
185
|
+
alias: {
|
186
|
+
'vue$': 'vue/dist/vue.esm.js',
|
187
|
+
'mint-ui': path.resolve(__dirname, './preview/mint-ui/')
|
188
|
+
}
|
189
|
+
},
|
190
|
+
devServer: {
|
191
|
+
headers: { "Access-Control-Allow-Origin": "*" },
|
192
|
+
disableHostCheck: true,
|
193
|
+
clientLogLevel: 'warning',
|
194
|
+
historyApiFallback: true,
|
195
|
+
hot: true,
|
196
|
+
host: getIPAdress(),
|
197
|
+
open: false,
|
198
|
+
overlay: false,
|
199
|
+
publicPath: '/',
|
200
|
+
proxy: {
|
201
|
+
'/api': {
|
202
|
+
target: ServerConfig.url,
|
203
|
+
changeOrigin: true
|
204
|
+
}
|
205
|
+
}
|
206
|
+
},
|
207
|
+
plugins: [
|
208
|
+
new webpack.HotModuleReplacementPlugin(),
|
209
|
+
new webpack.NamedModulesPlugin(),
|
210
|
+
new webpack.NoEmitOnErrorsPlugin(),
|
211
|
+
new HtmlWebpackPlugin({
|
212
|
+
filename: 'index.html',
|
213
|
+
template: '!!ejs-loader!./preview/index.tpl',
|
214
|
+
inject: true
|
215
|
+
}),
|
216
|
+
new VueLoaderPlugin()
|
217
|
+
]
|
218
|
+
})
|
219
|
+
}
|
220
|
+
|
221
|
+
if (process.env.NODE_ENV === 'production') {
|
222
|
+
const entry = {
|
223
|
+
index: './src/index.vue'
|
224
|
+
}
|
225
|
+
|
226
|
+
if (COMPONENT_EDITOR) {
|
227
|
+
entry.editor = './editor/index.vue'
|
228
|
+
}
|
229
|
+
|
230
|
+
//编译时插入路径
|
231
|
+
const argvs = JSON.parse(process.env.npm_config_argv).original;
|
232
|
+
const curPathInfo = {}
|
233
|
+
|
234
|
+
argvs.forEach((item) => {
|
235
|
+
if (item.indexOf('--AUTO_NAMESPACE') !== -1 || item.indexOf('--AUTO_NAME') !== -1 || item.indexOf('--AUTO_VERSION') !== -1 || item.indexOf('--AUTO_PUBLICPATH') !== -1) {
|
236
|
+
const curItem = item.split('=')
|
237
|
+
curPathInfo[curItem[0].split('--')[1]] = curItem[1]
|
238
|
+
}
|
239
|
+
})
|
240
|
+
|
241
|
+
const AUTO_NAMESPACE = curPathInfo.AUTO_NAMESPACE
|
242
|
+
const AUTO_NAME = curPathInfo.AUTO_NAME
|
243
|
+
const AUTO_VERSION = curPathInfo.AUTO_VERSION
|
244
|
+
const AUTO_PUBLICPATH = curPathInfo.AUTO_PUBLICPATH
|
245
|
+
|
246
|
+
const COMPONENT_PATH = `${AUTO_NAMESPACE}/${AUTO_NAME}@${AUTO_VERSION}`
|
247
|
+
const OSS_BUCKET = `${AUTO_PUBLICPATH}`
|
248
|
+
|
249
|
+
|
250
|
+
module.exports = merge(config, {
|
251
|
+
entry,
|
252
|
+
output: {
|
253
|
+
path: path.resolve(__dirname, './dist'),
|
254
|
+
publicPath: `${OSS_BUCKET}${AUTO_NAMESPACE}/${AUTO_NAME}/${AUTO_VERSION}/`,
|
255
|
+
library: `${COMPONENT_PATH}/[name]`,
|
256
|
+
libraryTarget: 'umd',
|
257
|
+
filename: '[name].js'
|
258
|
+
},
|
259
|
+
devtool: 'source-map',
|
260
|
+
plugins: [
|
261
|
+
new VueLoaderPlugin()
|
262
|
+
],
|
263
|
+
externals: {
|
264
|
+
'vue': 'Vue'
|
265
|
+
}
|
266
|
+
})
|
267
|
+
}
|