neo-cmp-cli 1.8.6-beta.2 → 1.8.6-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/AddNeoRequirePlugin.js +8 -0
- package/dist/_virtual/OverloadYield.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js +40 -0
- package/dist/_virtual/array-set.js +5 -0
- package/dist/_virtual/base64-vlq.js +5 -0
- package/dist/_virtual/base64.js +5 -0
- package/dist/_virtual/binary-search.js +5 -0
- package/dist/_virtual/createCmpByZip.js +8 -0
- package/dist/_virtual/deleteCmp.js +8 -0
- package/dist/_virtual/index.js +9 -0
- package/dist/_virtual/mapping-list.js +5 -0
- package/dist/_virtual/neoLogin.js +8 -0
- package/dist/_virtual/neoService.js +8 -0
- package/dist/_virtual/openProject.js +8 -0
- package/dist/_virtual/publish2oss.js +8 -0
- package/dist/_virtual/pullCmp.js +8 -0
- package/dist/_virtual/pushCmp.js +8 -0
- package/dist/_virtual/quick-sort.js +5 -0
- package/dist/_virtual/regenerator.js +5 -0
- package/dist/_virtual/regeneratorAsync.js +5 -0
- package/dist/_virtual/regeneratorAsyncGen.js +5 -0
- package/dist/_virtual/regeneratorAsyncIterator.js +5 -0
- package/dist/_virtual/regeneratorDefine.js +5 -0
- package/dist/_virtual/regeneratorKeys.js +5 -0
- package/dist/_virtual/regeneratorRuntime.js +5 -0
- package/dist/_virtual/regeneratorValues.js +5 -0
- package/dist/_virtual/source-map-consumer.js +5 -0
- package/dist/_virtual/source-map-generator.js +5 -0
- package/dist/_virtual/source-map-support.js +5 -0
- package/dist/_virtual/source-map.js +5 -0
- package/dist/_virtual/source-node.js +5 -0
- package/dist/_virtual/typeof.js +5 -0
- package/dist/_virtual/typescript.js +5 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/config/auth.config.js +50 -0
- package/dist/config/default.config.js +225 -0
- package/dist/config/index.js +27 -0
- package/dist/main.js +9 -0
- package/dist/main2.js +261 -0
- package/dist/module/inspect.js +64 -0
- package/dist/module/neoInit.js +69 -0
- package/dist/module/neoInitByCopy.js +81 -0
- package/dist/neo/neoLogin.js +663 -0
- package/dist/neo/neoRequire.js +118 -0
- package/dist/neo/neoService.js +1246 -0
- package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +19 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +29 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
- package/dist/node_modules/@babel/runtime/helpers/regenerator.js +105 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +24 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +23 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +50 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +37 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +25 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +98 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +35 -0
- package/dist/node_modules/@babel/runtime/helpers/typeof.js +25 -0
- package/dist/node_modules/@babel/runtime/regenerator/index.js +29 -0
- package/dist/node_modules/buffer-from/index.js +57 -0
- package/dist/node_modules/source-map/lib/array-set.js +134 -0
- package/dist/node_modules/source-map/lib/base64-vlq.js +144 -0
- package/dist/node_modules/source-map/lib/base64.js +81 -0
- package/dist/node_modules/source-map/lib/binary-search.js +122 -0
- package/dist/node_modules/source-map/lib/mapping-list.js +94 -0
- package/dist/node_modules/source-map/lib/quick-sort.js +126 -0
- package/dist/node_modules/source-map/lib/source-map-consumer.js +1018 -0
- package/dist/node_modules/source-map/lib/source-map-generator.js +385 -0
- package/dist/node_modules/source-map/lib/source-node.js +400 -0
- package/dist/node_modules/source-map/lib/util.js +449 -0
- package/dist/node_modules/source-map/source-map.js +25 -0
- package/dist/node_modules/source-map-support/source-map-support.js +610 -0
- package/dist/node_modules/typescript/lib/typescript.js +22376 -0
- package/dist/oss/publish2oss.js +378 -0
- package/dist/plugins/AddNeoRequirePlugin.js +178 -0
- package/dist/utils/autoEntryRootDir.js +98 -0
- package/dist/utils/cmpUtils/createCmpByTemplate.js +73 -0
- package/dist/utils/cmpUtils/createCmpByZip.js +530 -0
- package/dist/utils/cmpUtils/createCommonModulesCode.js +84 -0
- package/dist/utils/cmpUtils/deleteCmp.js +98 -0
- package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +38 -0
- package/dist/utils/cmpUtils/getCmpPreviewCode.js +37 -0
- package/dist/utils/cmpUtils/getCmpRegisterCode.js +38 -0
- package/dist/utils/cmpUtils/getCmpTypeByDir.js +58 -0
- package/dist/utils/cmpUtils/hasCmpTypeByDir.js +25 -0
- package/dist/utils/cmpUtils/previewCmp.js +74 -0
- package/dist/utils/cmpUtils/pullCmp.js +144 -0
- package/dist/utils/cmpUtils/pushCmp.js +290 -0
- package/dist/utils/common.js +121 -0
- package/dist/utils/configureNeoBuild.js +153 -0
- package/dist/utils/generateEntries.js +73 -0
- package/dist/utils/neoConfigInit.js +25 -0
- package/dist/utils/neoParams.js +23 -0
- package/dist/utils/pathUtils.js +48 -0
- package/dist/utils/projectNameValidator.js +89 -0
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +74 -0
- package/dist/utils/projectUtils/createCmpProjectZip.js +135 -0
- package/dist/utils/projectUtils/getEntries.js +99 -0
- package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +127 -0
- package/dist/utils/projectUtils/hasNeoProject.js +31 -0
- package/dist/utils/projectUtils/openProject.js +168 -0
- package/dist/utils/projectUtils/updatePublishLog.js +45 -0
- package/dist/utils/replaceInFilesByMap.js +70 -0
- package/dist/utils/replaceInPackage.js +151 -0
- package/dist/utils/resetPackageVersion.js +134 -0
- package/package.json +2 -2
- package/src/config/auth.config.js +0 -27
- package/src/config/default.config.js +0 -176
- package/src/config/index.js +0 -9
- package/src/initData/defaultTemplate.html +0 -13
- package/src/initData/neo.config.js +0 -138
- package/src/module/inspect.js +0 -41
- package/src/module/neoInit.js +0 -55
- package/src/module/neoInitByCopy.js +0 -61
- package/src/neo/NeoUMDContent.js +0 -30
- package/src/neo/neoLogin.js +0 -565
- package/src/neo/neoRequire.js +0 -125
- package/src/neo/neoService.js +0 -874
- package/src/neo/webpack.mf.js +0 -60
- package/src/neo/wrapperContent.js +0 -16
- package/src/oss/publish2oss.js +0 -348
- package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
- package/src/plugins/AddNeoRequirePlugin.js +0 -179
- package/src/plugins/README.md +0 -109
- package/src/utils/autoEntryRootDir.js +0 -85
- package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
- package/src/utils/cmpUtils/createCmpByZip.js +0 -408
- package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
- package/src/utils/cmpUtils/deleteCmp.js +0 -63
- package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
- package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
- package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
- package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
- package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
- package/src/utils/cmpUtils/previewCmp.js +0 -55
- package/src/utils/cmpUtils/pullCmp.js +0 -104
- package/src/utils/cmpUtils/pushCmp.js +0 -230
- package/src/utils/common.js +0 -107
- package/src/utils/configureNeoBuild.js +0 -109
- package/src/utils/generateEntries.js +0 -63
- package/src/utils/neoConfigInit.js +0 -13
- package/src/utils/neoParams.js +0 -12
- package/src/utils/pathUtils.js +0 -23
- package/src/utils/projectNameValidator.js +0 -76
- package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
- package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
- package/src/utils/projectUtils/getEntries.js +0 -80
- package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
- package/src/utils/projectUtils/hasNeoProject.js +0 -17
- package/src/utils/projectUtils/openProject.js +0 -94
- package/src/utils/projectUtils/updatePublishLog.js +0 -30
- package/src/utils/replaceInFiles.js +0 -47
- package/src/utils/replaceInFilesByMap.js +0 -54
- package/src/utils/replaceInPackage.js +0 -134
- package/src/utils/resetPackageVersion.js +0 -115
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// 统一路径解析:
|
|
3
|
-
const { resolve } = require('akfun');
|
|
4
|
-
const path = require('path'); // 以命令执行目录为根目录
|
|
5
|
-
|
|
6
|
-
// 当前neo的路径解析(用于获取neo-cmp-cli本身的文件地址)
|
|
7
|
-
function resolveByDirname(dir) {
|
|
8
|
-
return path.resolve(__dirname, dir);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 脚手架赋予当前项目的默认配置
|
|
13
|
-
*/
|
|
14
|
-
const defaultNEOConfig = {
|
|
15
|
-
settings: {
|
|
16
|
-
enableESLint: false, // 是否开启ESLint,默认开启ESLint检测代码格式
|
|
17
|
-
enableESLintFix: false, // 是否ESLint自动修正代码格式
|
|
18
|
-
enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
|
|
19
|
-
enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
|
|
20
|
-
},
|
|
21
|
-
webpack: {
|
|
22
|
-
resolve: {
|
|
23
|
-
// webpack的resolve配置
|
|
24
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
|
|
25
|
-
alias: {
|
|
26
|
-
'@': resolve('src')
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
createDeclaration: false, // 打包时是否创建ts声明文件
|
|
30
|
-
ignoreNodeModules: false, // 打包时是否忽略 node_modules
|
|
31
|
-
allowList: [], // ignoreNodeModules为true时生效
|
|
32
|
-
externals: {}, // 从输出的 bundle 中排除依赖
|
|
33
|
-
projectDir: ['src'],
|
|
34
|
-
template: resolveByDirname('../initData/defaultTemplate.html'), // 默认使用neo-widget提供的页面模板(会启动页面设计器)
|
|
35
|
-
sassResources: [],
|
|
36
|
-
babelPlugins: [
|
|
37
|
-
['import', { libraryName: 'antd', style: 'css' }] // 配置 antd 的样式按需引入
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
envParams: {
|
|
41
|
-
// 项目系统环境变量
|
|
42
|
-
common: {
|
|
43
|
-
// 通用参数
|
|
44
|
-
'#version#': '20221229.1'
|
|
45
|
-
},
|
|
46
|
-
local: {
|
|
47
|
-
// 本地开发环境
|
|
48
|
-
'#dataApiBase#': 'http://localhost:1024', // 数据接口根地址
|
|
49
|
-
'#assetsPublicPath#': 'http://localhost:1024', // 静态资源根地址
|
|
50
|
-
'#routeBasePath#': '/' // 路由根地址
|
|
51
|
-
},
|
|
52
|
-
online: {
|
|
53
|
-
// 线上正式环境配置参数
|
|
54
|
-
'#dataApiBase#': '/', // 数据接口根地址 "//xxx.cn/"格式
|
|
55
|
-
'#assetsPublicPath#': '', // 静态资源根地址 "//xxx.cn/_spa/projectName"格式
|
|
56
|
-
'#routeBasePath#': '/' // 路由根地址 "/_spa/projectName/"格式
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
dev: {
|
|
60
|
-
// 用于开启本地调试模式的相关配置信息
|
|
61
|
-
NODE_ENV: 'development',
|
|
62
|
-
port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
|
|
63
|
-
autoOpenBrowser: true,
|
|
64
|
-
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
65
|
-
assetsSubDirectory: '',
|
|
66
|
-
hostname: 'localhost',
|
|
67
|
-
proxyTable: {},
|
|
68
|
-
/** CSS Sourcemaps off by default because relative paths are "buggy"
|
|
69
|
-
* with this option, according to the CSS-Loader README
|
|
70
|
-
* (https://github.com/webpack/css-loader#sourcemaps)
|
|
71
|
-
* In our experience, they generally work as expected,
|
|
72
|
-
* just be aware of this issue when enabling this option.
|
|
73
|
-
*/
|
|
74
|
-
cssSourceMap: true
|
|
75
|
-
},
|
|
76
|
-
build: {
|
|
77
|
-
// 用于构建生产环境代码的相关配置信息
|
|
78
|
-
NODE_ENV: 'production', // production 模式,会启动UglifyJsPlugin服务
|
|
79
|
-
assetsRoot: resolve('dist'), // 编译完成的文件存放路径
|
|
80
|
-
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
81
|
-
assetsSubDirectory: '', // 资源引用二级路径
|
|
82
|
-
productionSourceMap: false,
|
|
83
|
-
// closeHtmlWebpackPlugin: true, // 可用于控制不生成html文件
|
|
84
|
-
// Gzip off by default as many popular public hosts such as
|
|
85
|
-
// Surge or Netlify already gzip all public assets for you.
|
|
86
|
-
// Before setting to `true`, make sure to:
|
|
87
|
-
// npm install --save-dev compression-webpack-plugin
|
|
88
|
-
productionGzip: false,
|
|
89
|
-
productionGzipExtensions: ['js', 'css', 'json'],
|
|
90
|
-
// Run the build command with an extra argument to
|
|
91
|
-
// View the bundle analyzer report after build finishes:
|
|
92
|
-
// `npm run build --report`
|
|
93
|
-
// Set to `true` or `false` to always turn it on or off
|
|
94
|
-
bundleAnalyzerReport: false
|
|
95
|
-
},
|
|
96
|
-
build2lib: {
|
|
97
|
-
// 用于构建第三方功能包的配置文件
|
|
98
|
-
NODE_ENV: 'production',
|
|
99
|
-
libraryName: '', // 构建第三方功能包时最后导出的引用变量名
|
|
100
|
-
assetsRoot: resolve('dist'), // 编译完成的文件存放路径
|
|
101
|
-
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
102
|
-
assetsSubDirectory: '', // 资源引用二级路径
|
|
103
|
-
productionSourceMap: false,
|
|
104
|
-
productionGzip: false,
|
|
105
|
-
productionGzipExtensions: ['js', 'css', 'json'],
|
|
106
|
-
bundleAnalyzerReport: false
|
|
107
|
-
},
|
|
108
|
-
linkDebug: {
|
|
109
|
-
// 用于开启本地调试模式的相关配置信息
|
|
110
|
-
NODE_ENV: 'development',
|
|
111
|
-
closeHtmlWebpackPlugin: true,
|
|
112
|
-
autoOpenBrowser: false,
|
|
113
|
-
cssExtract: false,
|
|
114
|
-
consoleInfo: '当前自定义组件可用外链地址'
|
|
115
|
-
},
|
|
116
|
-
publish2oss: {
|
|
117
|
-
output: {
|
|
118
|
-
filename: '[name].js',
|
|
119
|
-
library: {
|
|
120
|
-
type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
|
|
121
|
-
export: 'default'
|
|
122
|
-
},
|
|
123
|
-
globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
|
|
124
|
-
},
|
|
125
|
-
cssExtract: false, // 不额外提取css文件
|
|
126
|
-
ossType: 'ali', // oss类型:ali、baidu
|
|
127
|
-
ossConfig: {
|
|
128
|
-
endpoint: 'https://oss-cn-beijing.aliyuncs.com',
|
|
129
|
-
// 个人阿里云子账户(neo-cmp-cli),有流量限制,请勿滥用
|
|
130
|
-
AccessKeyId: 'LTAI5tS47y9L4fAPLXNoEzxS',
|
|
131
|
-
AccessKeySecret: '8qz2GxxJJe44K5NRmLAAzIVJnbcYAU',
|
|
132
|
-
bucket: 'neo-widgets' // 存储桶名称
|
|
133
|
-
},
|
|
134
|
-
assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
|
|
135
|
-
},
|
|
136
|
-
// 授权码授权模式下的 NeoCRM 平台配置
|
|
137
|
-
neoConfig: {
|
|
138
|
-
authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
|
|
139
|
-
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
140
|
-
// 当 authType 为 oauth2 时,loginURL 配置项必填
|
|
141
|
-
loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
|
|
142
|
-
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token' // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
143
|
-
},
|
|
144
|
-
/*
|
|
145
|
-
// 密码授权模式下的 NeoCRM 平台配置
|
|
146
|
-
neoConfig: {
|
|
147
|
-
authType: 'password', // 授权类型,可选值:oauth2(默认)、password
|
|
148
|
-
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
149
|
-
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
150
|
-
// 当 authType 为 password 时,auth 配置项必填
|
|
151
|
-
auth: {
|
|
152
|
-
client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
|
|
153
|
-
client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
|
|
154
|
-
username: auth.username || 'xx', // 用户在销售易系统中的用户名
|
|
155
|
-
// password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
|
|
156
|
-
// 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
|
|
157
|
-
password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
*/
|
|
161
|
-
pushCmp: {
|
|
162
|
-
output: {
|
|
163
|
-
filename: '[name].js',
|
|
164
|
-
library: {
|
|
165
|
-
type: 'var', // webpack 5 中生成 IIFE 格式的 type 配置
|
|
166
|
-
export: 'default'
|
|
167
|
-
},
|
|
168
|
-
globalObject: 'this' // 定义全局变量,兼容node和浏览器运行,避免出现"window is not defined"的情况
|
|
169
|
-
},
|
|
170
|
-
cssExtract: false, // 不额外提取css文件
|
|
171
|
-
assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// 备注:数组类型则直接覆盖
|
|
176
|
-
module.exports = defaultNEOConfig;
|
package/src/config/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 统一路径解析:
|
|
2
|
-
const { resolve, getConfigObj, deepMergeConfig } = require('akfun');
|
|
3
|
-
const defaultNEOConfig = require('./default.config');
|
|
4
|
-
|
|
5
|
-
// 从项目根目录获取当前项目的配置文件
|
|
6
|
-
const curProjectConfig = getConfigObj(resolve('neo.config.js'));
|
|
7
|
-
|
|
8
|
-
// 备注:数组类型则直接覆盖
|
|
9
|
-
module.exports = deepMergeConfig(defaultNEOConfig, curProjectConfig);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<html lang="en">
|
|
2
|
-
<head>
|
|
3
|
-
<meta charset="UTF-8">
|
|
4
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
5
|
-
<meta name="format-detection" content="telephone=no"/>
|
|
6
|
-
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,width=device-width,viewport-fit=cover">
|
|
7
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
-
<title>自定义组件预览页</title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<div id="root"></div>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// 统一路径解析
|
|
5
|
-
function resolve(dir) {
|
|
6
|
-
return path.resolve(__dirname, dir);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// 包括生产和开发的环境配置信息
|
|
10
|
-
module.exports = {
|
|
11
|
-
settings: {
|
|
12
|
-
enableESLint: true, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
|
|
13
|
-
enableESLintFix: true, // 是否自动修正代码格式,默认不自动修正
|
|
14
|
-
enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
|
|
15
|
-
enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
|
|
16
|
-
},
|
|
17
|
-
webpack: {
|
|
18
|
-
target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
|
|
19
|
-
resolve: {
|
|
20
|
-
// webpack的resolve配置
|
|
21
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
|
|
22
|
-
alias: {
|
|
23
|
-
'@': resolve('src'),
|
|
24
|
-
$assets: resolve('src/assets'),
|
|
25
|
-
$public: resolve('public')
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
// sassResources 中的 sass 文件会自动注入项目中每一个 sass 文件中
|
|
29
|
-
sassResources: [
|
|
30
|
-
resolve('./src/assets/css/common.scss'),
|
|
31
|
-
resolve('./src/assets/css/mixin.scss')
|
|
32
|
-
],
|
|
33
|
-
// createDeclaration: true, // 打包时是否创建ts声明文件
|
|
34
|
-
ignoreNodeModules: false // 打包时是否忽略 node_modules
|
|
35
|
-
// allowList: [], // ignoreNodeModules 为 true 时生效
|
|
36
|
-
// projectDir: ['src'],
|
|
37
|
-
// template: resolve('./public/template.html'), // 自定义html模板
|
|
38
|
-
// plugins: [],
|
|
39
|
-
// babelPlugins: [],
|
|
40
|
-
},
|
|
41
|
-
// 用于添加 Neo 共享依赖模块的配置信息
|
|
42
|
-
/*
|
|
43
|
-
neoCommonModule: {
|
|
44
|
-
// exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
|
|
45
|
-
exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
|
|
46
|
-
'xxModule': path.resolve('./src/components/xxModule'), // 导出 xx组件 或 xx模块
|
|
47
|
-
},
|
|
48
|
-
// remoteDeps: ['xxCmpType'], // 远程依赖组件,表示当前自定义组件会用到的依赖组件,需要和 externals 配合使用
|
|
49
|
-
// externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
|
|
50
|
-
},
|
|
51
|
-
*/
|
|
52
|
-
preview: {
|
|
53
|
-
// 用于开启本地预览模式的相关配置信息
|
|
54
|
-
/*
|
|
55
|
-
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
56
|
-
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
57
|
-
// 本地预览自定义组件内容
|
|
58
|
-
index: './src/preview.jsx',
|
|
59
|
-
},
|
|
60
|
-
NODE_ENV: 'development',
|
|
61
|
-
port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
|
|
62
|
-
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
63
|
-
assetsSubDirectory: '',
|
|
64
|
-
hostname: 'localhost',
|
|
65
|
-
proxyTable: {
|
|
66
|
-
'/apiTest': {
|
|
67
|
-
target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
|
|
68
|
-
ws: true,
|
|
69
|
-
changeOrigin: true,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
*/
|
|
73
|
-
},
|
|
74
|
-
linkDebug: {
|
|
75
|
-
// 用于开启本地调试模式的相关配置信息
|
|
76
|
-
/*
|
|
77
|
-
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
78
|
-
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
79
|
-
// 外链调试(在线上页面设计器端预览自定义组件)
|
|
80
|
-
index: [
|
|
81
|
-
'./src/components/xxCmp/register.ts',
|
|
82
|
-
'./src/components/xxCmp/model.ts',
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
NODE_ENV: 'development',
|
|
86
|
-
port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
|
|
87
|
-
closeHotReload: true, // 是否关闭热更新
|
|
88
|
-
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
89
|
-
assetsSubDirectory: '',
|
|
90
|
-
hostname: 'localhost',
|
|
91
|
-
proxyTable: {
|
|
92
|
-
'/apiTest': {
|
|
93
|
-
target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
|
|
94
|
-
ws: true,
|
|
95
|
-
changeOrigin: true,
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
*/
|
|
99
|
-
},
|
|
100
|
-
// 授权码授权模式下的 NeoCRM 平台配置
|
|
101
|
-
neoConfig: {
|
|
102
|
-
authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
|
|
103
|
-
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
104
|
-
// 当 authType 为 oauth2 时,loginURL 配置项必填
|
|
105
|
-
loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
|
|
106
|
-
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token' // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
107
|
-
},
|
|
108
|
-
/*
|
|
109
|
-
// 密码授权模式下的 NeoCRM 平台配置
|
|
110
|
-
neoConfig: {
|
|
111
|
-
authType: 'password', // 授权类型,可选值:oauth2(默认)、password
|
|
112
|
-
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
113
|
-
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
114
|
-
// 当 authType 为 password 时,auth 配置项必填
|
|
115
|
-
auth: {
|
|
116
|
-
client_id: auth.client_id || 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
|
|
117
|
-
client_secret: auth.client_secret || 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
|
|
118
|
-
username: auth.username || 'xx', // 用户在销售易系统中的用户名
|
|
119
|
-
// password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
|
|
120
|
-
// 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
|
|
121
|
-
password: auth.password || 'xx xx', // 用户账户密码 + 8 位安全令牌
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
*/
|
|
125
|
-
pushCmp: {
|
|
126
|
-
// 用于构建并发布至 NeoCRM 的相关配置
|
|
127
|
-
/*
|
|
128
|
-
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
129
|
-
NODE_ENV: 'production',
|
|
130
|
-
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
131
|
-
InfoCardModel: './src/components/xxCmp/model.ts',
|
|
132
|
-
infoCard: './src/components/xxCmp/register.ts'
|
|
133
|
-
},
|
|
134
|
-
cssExtract: false, // 不额外提取css文件
|
|
135
|
-
assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
|
|
136
|
-
*/
|
|
137
|
-
}
|
|
138
|
-
};
|
package/src/module/inspect.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const ora = require('ora');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const { getCurWebpackConfig } = require('akfun'); // 用于获取当前webpack配置的方法
|
|
5
|
-
const curConfig = require('../config/index');
|
|
6
|
-
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
7
|
-
const { errorLog, successLog } = require('../utils/common');
|
|
8
|
-
|
|
9
|
-
// 根据当前配置文件内容创建指定名称的文件
|
|
10
|
-
const createConfigJs = function (fileName, fileCont) {
|
|
11
|
-
let filePath = path.resolve(process.cwd(), fileName);
|
|
12
|
-
|
|
13
|
-
fs.writeFile(filePath, JSON.stringify(fileCont, null, 2), (err) => {
|
|
14
|
-
if (err) {
|
|
15
|
-
throw Error(err);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 用于输出当前项目配置文件
|
|
22
|
-
*/
|
|
23
|
-
module.exports = (type) => {
|
|
24
|
-
const spinner = ora(`${consoleTag}正在获取当前环境的配置数据...`).start();
|
|
25
|
-
if (type === 'dev') {
|
|
26
|
-
const devConfig = getCurWebpackConfig(type, curConfig);
|
|
27
|
-
createConfigJs('current-neo-dev-config.js', devConfig);
|
|
28
|
-
successLog(`当前配置数据已输出至 current-neo-dev-config.js中。`, spinner);
|
|
29
|
-
} else if (type === 'lib') {
|
|
30
|
-
const libraryConfig = getCurWebpackConfig(type, curConfig);
|
|
31
|
-
createConfigJs('current-neo-build2lib-config.js', libraryConfig);
|
|
32
|
-
successLog(`当前配置数据已输出至 current-neo-build2lib-config.js中。`, spinner);
|
|
33
|
-
} else if (type === 'build') {
|
|
34
|
-
const prodConfig = getCurWebpackConfig(type, curConfig);
|
|
35
|
-
// 默认输出生产环境的配置文件
|
|
36
|
-
createConfigJs('current-neo-build-config.js', prodConfig);
|
|
37
|
-
successLog(`当前配置数据已输出至 current-neo-build-config.js。`, spinner);
|
|
38
|
-
} else {
|
|
39
|
-
errorLog(`type 不能为空。`, spinner);
|
|
40
|
-
}
|
|
41
|
-
};
|
package/src/module/neoInit.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const { gitClone } = require('akfun');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
4
|
-
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
5
|
-
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
6
|
-
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
7
|
-
|
|
8
|
-
const templateList = {
|
|
9
|
-
react: {
|
|
10
|
-
projectName: 'react-custom-cmp-template',
|
|
11
|
-
url: 'git@github.com:wibetter/react-custom-cmp-template.git'
|
|
12
|
-
},
|
|
13
|
-
'react-ts': {
|
|
14
|
-
projectName: 'react-ts-custom-cmp-template',
|
|
15
|
-
url: 'git@github.com:wibetter/react-ts-custom-cmp-template.git'
|
|
16
|
-
},
|
|
17
|
-
vue2: {
|
|
18
|
-
projectName: 'vue2-custom-cmp-template',
|
|
19
|
-
url: 'git@github.com:wibetter/vue2-custom-cmp-template.git'
|
|
20
|
-
}
|
|
21
|
-
/*
|
|
22
|
-
'vue3': {
|
|
23
|
-
projectName: 'vue3-neo-custom-widget',
|
|
24
|
-
url: 'git@github.com:wibetter/vue3-neo-custom-widget.git'
|
|
25
|
-
}
|
|
26
|
-
*/
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 通过 git clone 从 github 拉取并创建自定义组件
|
|
31
|
-
* @param {*} type 自定义组件类型
|
|
32
|
-
* @param {*} projectName 自定义组件项目名称
|
|
33
|
-
*/
|
|
34
|
-
const neoInit = function (type, projectName) {
|
|
35
|
-
const currentTemplate = templateList[type || 'react'];
|
|
36
|
-
const currentTemplateUrl = currentTemplate.url;
|
|
37
|
-
const finalProjectName = projectName || 'neoCustomCmp';
|
|
38
|
-
|
|
39
|
-
gitClone(
|
|
40
|
-
currentTemplateUrl,
|
|
41
|
-
finalProjectName,
|
|
42
|
-
() => {
|
|
43
|
-
// 克隆完成后,替换项目名称
|
|
44
|
-
replaceInPackage(finalProjectName, currentTemplate.projectName, finalProjectName);
|
|
45
|
-
replaceInPackage(finalProjectPath, 'wibetter', 'xxx');
|
|
46
|
-
replaceInPackage(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
47
|
-
resetPackageVersion(finalProjectPath);
|
|
48
|
-
// 自动切换到项目根目录
|
|
49
|
-
autoEntryRootDir(finalProjectPath);
|
|
50
|
-
},
|
|
51
|
-
consoleTag
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
module.exports = neoInit;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
4
|
-
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
5
|
-
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
6
|
-
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
7
|
-
const { errorLog } = require('../utils/common');
|
|
8
|
-
|
|
9
|
-
const templateList = {
|
|
10
|
-
react: {
|
|
11
|
-
projectName: 'react-custom-cmp-template',
|
|
12
|
-
dir: path.resolve(__dirname, '../../template/react-custom-cmp-template')
|
|
13
|
-
},
|
|
14
|
-
'react-ts': {
|
|
15
|
-
projectName: 'react-ts-custom-cmp-template',
|
|
16
|
-
dir: path.resolve(__dirname, '../../template/react-ts-custom-cmp-template')
|
|
17
|
-
},
|
|
18
|
-
antd: {
|
|
19
|
-
projectName: 'antd-custom-cmp-template',
|
|
20
|
-
dir: path.resolve(__dirname, '../../template/antd-custom-cmp-template')
|
|
21
|
-
},
|
|
22
|
-
echarts: {
|
|
23
|
-
projectName: 'echarts-custom-cmp-template',
|
|
24
|
-
dir: path.resolve(__dirname, '../../template/echarts-custom-cmp-template')
|
|
25
|
-
},
|
|
26
|
-
neo: {
|
|
27
|
-
projectName: 'neo-custom-cmp-template',
|
|
28
|
-
dir: path.resolve(__dirname, '../../template/neo-custom-cmp-template')
|
|
29
|
-
},
|
|
30
|
-
vue2: {
|
|
31
|
-
projectName: 'vue2-custom-cmp-template',
|
|
32
|
-
dir: path.resolve(__dirname, '../../template/vue2-custom-cmp-template')
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 通过拷贝模板创建自定义组件
|
|
38
|
-
* @param {*} type 自定义组件类型
|
|
39
|
-
* @param {*} projectName 自定义组件项目名称
|
|
40
|
-
*/
|
|
41
|
-
const neoInitByCopy = function (type, projectName) {
|
|
42
|
-
const currentTemplate = templateList[type || 'react'];
|
|
43
|
-
const currentTemplateDir = currentTemplate.dir;
|
|
44
|
-
const finalProjectName = projectName || 'neoCustomCmp';
|
|
45
|
-
const finalProjectPath = path.resolve(process.cwd(), finalProjectName);
|
|
46
|
-
|
|
47
|
-
fs.copy(currentTemplateDir, finalProjectPath)
|
|
48
|
-
.then(() => {
|
|
49
|
-
replaceInPackage(finalProjectPath, currentTemplate.projectName, finalProjectName);
|
|
50
|
-
replaceInPackage(finalProjectPath, 'wibetter', 'xxx');
|
|
51
|
-
replaceInPackage(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
52
|
-
resetPackageVersion(finalProjectPath);
|
|
53
|
-
|
|
54
|
-
console.log(`${consoleTag}已创建自定义组件(${finalProjectName})!`);
|
|
55
|
-
// 自动切换到项目根目录
|
|
56
|
-
autoEntryRootDir(finalProjectPath);
|
|
57
|
-
})
|
|
58
|
-
.catch((err) => errorLog(`${consoleTag}自定义组件模板下载失败:`, err));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
module.exports = neoInitByCopy;
|
package/src/neo/NeoUMDContent.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 内置 UMD 模块,用于在 Node cli 端加载自定义组件模型
|
|
3
|
-
* 特别说明:这个文件内容会通过 AddNeoRequirePlugin 插入的构建代码中。
|
|
4
|
-
* 暂未使用,保留备用。
|
|
5
|
-
*/
|
|
6
|
-
(function (root, factory) {
|
|
7
|
-
// AMD 环境检测
|
|
8
|
-
if (typeof define === 'function' && define.amd) {
|
|
9
|
-
define([], factory);
|
|
10
|
-
}
|
|
11
|
-
// CommonJS 环境检测
|
|
12
|
-
else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
|
13
|
-
module.exports = factory();
|
|
14
|
-
}
|
|
15
|
-
// 浏览器全局变量
|
|
16
|
-
else {
|
|
17
|
-
root.NeoCustomCmpModel = factory();
|
|
18
|
-
}
|
|
19
|
-
})(typeof self !== 'undefined' ? self : this, function () {
|
|
20
|
-
'use strict';
|
|
21
|
-
|
|
22
|
-
const getCustomModels = (cmpType) => {
|
|
23
|
-
// 自定义组件模型列表
|
|
24
|
-
const NEOEditorCustomModels = window.NEOEditorCustomModels || {};
|
|
25
|
-
return NEOEditorCustomModels[cmpType] || {};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// 导出模块
|
|
29
|
-
return getCustomModels;
|
|
30
|
-
});
|