jufubao-third 1.0.0-beta1

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/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # gxd-uni
2
+ ```text
3
+ 1、自定义uni-app组件功能,支持h5,mp-weixin平台已自测(竖屏),(文档尚未完善),
4
+ 2、根据自己的项目需要持续更新。
5
+ 3、提bug或者需要技术交流加:QQ:149648746 微信:15110208397
6
+ 4、预览地址:http://uni.e56buy.com/
7
+ ```
8
+
9
+
10
+ ## 安装
11
+ ```
12
+ npm i gxd-uni-commands --save --registry https://registry.npm.taobao.org
13
+
14
+ #在package.json文件中加入拷贝脚本
15
+
16
+ "scripts": {
17
+ ...
18
+ "init.commands": "cp -rf ./node_modules/gxd-uni-commands/build ./",
19
+ "init.entry": "node ./build/commands/entry.init.js"
20
+ ...
21
+ }
22
+
23
+ npm run init.commands //拷贝命令行
24
+
25
+ ```
26
+
27
+
package/commands.js ADDED
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const basePath = require('./build/path');
5
+ const clog = require('./build/clog');
6
+ const fileHelper = require('./build/fileHepler');
7
+ let fromBuildPath = path.resolve('./node_modules/gxd-commands-bussiness/build');
8
+ const toBuildPath = path.resolve('./build');
9
+ let fromCommandsPath = path.resolve('./node_modules/gxd-commands-bussiness/commands');
10
+ const toCommandsPath = path.resolve('./commands');
11
+ const utils = require('./build/lib/utils');
12
+ const execSync = require('child_process').execSync;
13
+ const getPackage = `${basePath.buildRoot}/get.package.path.js`;
14
+ const handleJsonPackage = require('./build/version/Json');
15
+
16
+
17
+ (async () => {
18
+
19
+ let argv = utils.getArgv();
20
+ if (argv.length === 0) {
21
+ clog(`请传入参数, 例如: node ./commands.update.js true`, 'red');
22
+ process.exit(-1);
23
+ }
24
+ let isLocal = argv[0] === 'true';
25
+ let is0ss = argv[1] === 'true';
26
+
27
+ //本地文件拷贝基础框架
28
+ if (isLocal) {
29
+ //复制插件库文件
30
+ clog(`从本地拷贝框架资源`, 'cyanBG');
31
+ utils.logsLine(clog);
32
+ execSync(`cross-env isLocal=true node ./build/commands/copy.init.js`, {stdio: 'inherit'});
33
+ clog(`完成更新`, 'cyan');
34
+ utils.logsLine(clog);
35
+ process.exit(0)
36
+ }
37
+
38
+ let isUpdate = false;
39
+ let currentPackage = require(fileHelper.getPlatformSurePath(`${basePath.buildRoot}/package.json`));
40
+ let baseLibrary = await handleJsonPackage.getByCodeJson('gxd-uni-library-editx');
41
+
42
+ //检查node_odules是否需要更新
43
+ let nodeModulesPath = fileHelper.getPlatformSurePath(basePath.buildRoot + '/node_modules/gxd-uni-library-editx/package.json');
44
+ let isNodeModulesVersionUpdate = true;
45
+ if (fileHelper.existFileSync(nodeModulesPath)) {
46
+ let temp = require(nodeModulesPath);
47
+ if (baseLibrary.version === temp.version) {
48
+ isNodeModulesVersionUpdate = false
49
+ }
50
+ }
51
+
52
+
53
+ if (baseLibrary.version !== currentPackage['dependencies'][baseLibrary.name]) {
54
+ currentPackage['dependencies'][baseLibrary.name] = baseLibrary.version;
55
+ fileHelper.writeFileSync(
56
+ fileHelper.getPlatformSurePath(fileHelper.getPlatformSurePath(basePath.buildRoot + '/package.json')),
57
+ JSON.stringify(currentPackage, null, 2)
58
+ )
59
+ isUpdate = true;
60
+ }
61
+
62
+ if (isUpdate || isNodeModulesVersionUpdate) {
63
+ //是否需要升级基础插件
64
+ let cmdStr = `npm i --registry=https://registry.npmmirror.com && `;
65
+
66
+ //复制插件库文件
67
+ cmdStr = `${cmdStr} cross-env oss=${is0ss} node ./build/commands/copy.init.js`;
68
+
69
+ clog(`完成更新框架资源`, 'cyanBG');
70
+ utils.logsLine(clog, 'start');
71
+ clog(`执行命令行:${cmdStr}`, 'cyan');
72
+ utils.logsLine(clog);
73
+ execSync(cmdStr, {stdio: 'inherit'});
74
+ clog(`完成更新`, 'cyan');
75
+ utils.logsLine(clog);
76
+ } else {
77
+ let cmdStr = `cross-env oss=${is0ss} node ./build/commands/copy.init.js`;
78
+ execSync(cmdStr, {stdio: 'inherit'});
79
+ clog(`完成更新`, 'cyan');
80
+ utils.logsLine(clog);
81
+ }
82
+ })();
83
+
84
+
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const basePath = require('./build/path');
5
+ const clog = require('./build/clog');
6
+ const fileHelper = require('./build/fileHepler');
7
+ const utils = require('./build/lib/utils');
8
+ const execSync = require('child_process').execSync;
9
+
10
+ ///Users/shiyonggao/Desktop/code/BASE/UNIAPP/
11
+ //业务项目ID
12
+ // const projectPathList = [
13
+ // {
14
+ // name: '业务组件基础插件库',
15
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-base'
16
+ // },
17
+ // {
18
+ // name: '业务组件商城库',
19
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-mall'
20
+ // },
21
+ // {
22
+ // name: '业务组件在线选座库',
23
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-movie'
24
+ // },
25
+ // {
26
+ // name: '业务组件核销库',
27
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-cashier'
28
+ // },
29
+ // ];
30
+
31
+ //业务项目ID
32
+ const projectPathList = [
33
+ {
34
+ name: '业务组件基础插件库',
35
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-base'
36
+ },
37
+ {
38
+ name: '业务组件商城库',
39
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-mall'
40
+ },
41
+ {
42
+ name: '业务组件在线选座库',
43
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-movie'
44
+ },
45
+ {
46
+ name: '业务组件核销库',
47
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-cashier'
48
+ },
49
+ {
50
+ name: '业务组件演出库',
51
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-play'
52
+ },
53
+ {
54
+ name: '业务组件礼包库',
55
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-gift'
56
+ },
57
+ {
58
+ name: '业务组件旅游库',
59
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-travel'
60
+ },
61
+ {
62
+ name: '业务组件餐饮库',
63
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-food'
64
+ },
65
+ ];
66
+
67
+
68
+
69
+ //插件库版本
70
+ function getLibraryVersion() {
71
+ let pathUrl = fileHelper.getPlatformSurePath(`${basePath.buildRoot}/package.json`);
72
+ let packagejson = require(pathUrl);
73
+ return packagejson.dependencies['gxd-uni-library-editx'];
74
+ }
75
+
76
+ //需要更新的文件
77
+ const projectChange = [
78
+ //系统文件
79
+ // '/commands',
80
+ // '/build',
81
+ // "/src/mixins",
82
+ //
83
+ // //其他
84
+ // '/commands.js',
85
+ // "/src/common/request.js",
86
+ // "/schemas/card.js",
87
+
88
+ ];
89
+
90
+ const init = () => {
91
+ let argv = utils.getArgv();
92
+ if (argv.length === 0) {
93
+ clog(`请传入参数,例如: npm run change copy(拷贝)|del(删除)`, 'red');
94
+ process.exit(-1);
95
+ }
96
+
97
+ if (argv[0] !== 'copy' && argv[0] !== 'del') {
98
+ clog(`参数错误,正确参数为:copy,del。例如: npm run change copy`, 'red');
99
+ process.exit(-1);
100
+ }
101
+
102
+ let type = argv[0];
103
+ let isLocal = argv[1] !== undefined;
104
+
105
+
106
+ //获取需要拷贝的项目路径
107
+ clog(`开始操作文件`, 'cyanBG');
108
+
109
+ //复制命令行
110
+ projectChange.map(file => {
111
+ let toPath = fileHelper.getPlatformSurePath(basePath.buildRoot + '/' + file);
112
+ projectPathList.map(item => {
113
+ let fromPath = fileHelper.getPlatformSurePath(item.path + '/' + file);
114
+ if (type === 'copy') {
115
+ if (file === '/commands' || file === '/build') {
116
+ if (fileHelper.existFileSync(fromPath)) {
117
+ fileHelper.removeFileAndDir(fromPath)
118
+ }
119
+ }
120
+ fileHelper.copySync(toPath, fromPath);
121
+ clog(`拷贝文件成功,目录:${fromPath}`, 'green');
122
+ }
123
+ if (type === 'del') {
124
+ fileHelper.removeFileAndDir(fromPath);
125
+ clog(`删除文件成功,目录:${fromPath}`, 'green');
126
+ }
127
+ });
128
+
129
+ //复制到打包服务器中
130
+ if (file === '/src/mixins') {
131
+ let templatePath = '/Users/shiyonggao/Desktop/code/JFB/package/ali-editx-templates.jufubao.cn';
132
+ if(fileHelper.existFileSync(templatePath)) {
133
+ let templateFromPath = fileHelper.getPlatformSurePath(templatePath + '/' + file);
134
+ fileHelper.copySync(toPath, templateFromPath);
135
+ }
136
+ }
137
+ });
138
+
139
+
140
+ //获取需要拷贝的项目路径
141
+ clog(`结束操作文件`, 'cyanBG');
142
+
143
+ if (type === 'del') return;
144
+
145
+ //更新版本
146
+ projectPathList.map(item => {
147
+ let pathUrl = fileHelper.getPlatformSurePath(`${item.path}/package.json`);
148
+ let packagejson = require(pathUrl);
149
+ let version = getLibraryVersion();
150
+ //切换目录
151
+ let cmdStr = `cd ${fileHelper.getPlatformSurePath(item.path)}`;
152
+ if (version !== packagejson.dependencies['gxd-uni-library-editx']) {
153
+ clog(`更新前版本:${packagejson.dependencies['gxd-uni-library-editx']},更新后的版本:${version}`, 'cyan');
154
+
155
+
156
+ //安装版本
157
+ cmdStr = `${cmdStr} && npm run init false`;
158
+
159
+ //插件库拷贝命令
160
+ cmdStr = `${cmdStr} && npm run update`;
161
+ clog(cmdStr, 'cyan');
162
+ execSync(cmdStr, {stdio: 'inherit'});
163
+
164
+ } else {
165
+ //插件库拷贝命令
166
+ cmdStr = `${cmdStr} && cross-env oss=true isLocal=${isLocal} node ./build/commands/copy.init.js && npm run update`;
167
+ clog(cmdStr, 'cyan');
168
+ execSync(cmdStr, {stdio: 'inherit'});
169
+ }
170
+ });
171
+
172
+ };
173
+
174
+ init();
175
+
176
+
package/file.config.js ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ /**
4
+ * @type {Number}
5
+ * @description 生成文件路径格式类型
6
+ * 其值:默认:1
7
+ * 1=>使用时间格式
8
+ * 2=>使用固定路径(resource,方便替换发布)
9
+ * 默认:1
10
+ *
11
+ * resource,需要文件替换才可以发布:
12
+ * 1、index.js resource/ => / /@@@@/ => https://domain/dir
13
+ * 2、index.html /@@@@/resource => https://domain/dir
14
+ */
15
+ fileVersionType: 1,
16
+ }
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 第三方库
5
+ * @param threePackagePath {String} 第三方库所在项目路径存放路径路
6
+ * @param packname {String} 包名字
7
+ * @returns {string|*}
8
+ */
9
+ const getPackagePath = (threePackagePath, packname = 'gxd-commands-bussiness')=>{
10
+ if(packname === 'gxd-commands-bussiness') {
11
+ return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-commands-bussiness/${threePackagePath}`;
12
+ }
13
+
14
+ if (packname === 'gxd-uni-library-editx') {
15
+ return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-uni-library-editx/${threePackagePath}`;
16
+ }
17
+
18
+ };
19
+
20
+ module.exports = {
21
+ getPackagePath
22
+ }
package/package.json ADDED
@@ -0,0 +1,122 @@
1
+ {
2
+ "name": "jufubao-third",
3
+ "version": "1.0.0-beta1",
4
+ "private": false,
5
+ "description": "聚福宝业务组件第三方购物平台包",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "serve": "cross-env type=test cross-env NODE_ENV=development UNI_PLATFORM=h5 npm run init.entry",
9
+ "test": "cross-env type=test cross-env NODE_ENV=development UNI_PLATFORM=h5 npm run init.entry",
10
+ "dev": "cross-env type=test cross-env NODE_ENV=development UNI_PLATFORM=h5 npm run init.entry",
11
+ "build": "cross-env type=build cross-env NODE_ENV=production UNI_PLATFORM=h5 npm run init.entry",
12
+ "init.entry": "node ./build/commands/entry.init.js",
13
+ "update": "node ./commands/npmignore && node ./commands/update.pack.js",
14
+ "create": "node ./commands/create.pack.js",
15
+ "release": "node ./commands/release.js",
16
+ "view": "node ./commands/update.preview.js third",
17
+ "replace": "node ./commands/vue.replace.js JfbThird",
18
+ "rename": "node ./commands/change.pack.js JfbBase JfbThird",
19
+ "copy.pack": "node ./commands/change.pack.js",
20
+ "init": "node ./commands.js false",
21
+ "init.local": "node ./commands.js true",
22
+ "init.change": "node ./commands.update.change.js",
23
+ "coder": "node ./build/commands/coder.js",
24
+ "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
25
+ "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch --minimize",
26
+ "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
27
+ "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
28
+ "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --minimize",
29
+ "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
30
+ "copy": "cross-env isOpenDir=true node build/commands/copy.js",
31
+ "oss": "cross-env bucket=xxx region=oss-cn-beijing name=基础项目 node ./build/commands/oss.js",
32
+ "oss.dev": "cross-env bucket=dev-xxx region=oss-cn-qingdao name=基础项目 node ./build/commands/oss.js",
33
+ "oss.test": "cross-env bucket=test-xxx region=oss-cn-qingdao name=基础项目 node ./build/commands/oss.js"
34
+ },
35
+ "dependencies": {
36
+ "@dcloudio/uni-app-plus": "2.0.1-33920220208001",
37
+ "@dcloudio/uni-h5": "2.0.1-33920220208001",
38
+ "@dcloudio/uni-helper-json": "*",
39
+ "@dcloudio/uni-i18n": "2.0.1-33920220208001",
40
+ "@dcloudio/uni-mp-360": "2.0.1-33920220208001",
41
+ "@dcloudio/uni-mp-alipay": "2.0.1-33920220208001",
42
+ "@dcloudio/uni-mp-baidu": "2.0.1-33920220208001",
43
+ "@dcloudio/uni-mp-qq": "2.0.1-33920220208001",
44
+ "@dcloudio/uni-mp-toutiao": "2.0.1-33920220208001",
45
+ "@dcloudio/uni-mp-vue": "2.0.1-33920220208001",
46
+ "@dcloudio/uni-mp-weixin": "2.0.1-33920220208001",
47
+ "@dcloudio/uni-quickapp-native": "2.0.1-33920220208001",
48
+ "@dcloudio/uni-quickapp-webview": "2.0.1-33920220208001",
49
+ "@dcloudio/uni-stat": "2.0.1-33920220208001",
50
+ "@vue/shared": "^3.0.0",
51
+ "color": "^3.1.3",
52
+ "core-js": "^2.6.5",
53
+ "flyio": "^0.6.2",
54
+ "gxd-uni-library-editx": "1.0.69",
55
+ "jweixin-module": "^1.6.0",
56
+ "md5": "^2.3.0",
57
+ "path-to-regexp": "^6.2.1",
58
+ "qs": "^6.9.6",
59
+ "regenerator-runtime": "^0.12.1",
60
+ "vue": "^2.6.10",
61
+ "vue-clipboard2": "^0.3.1",
62
+ "vuex": "^3.2.0"
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git@gitee.com:e56buy/xd-uni.git"
67
+ },
68
+ "homepage": "http://uni.e56buy.com/",
69
+ "devDependencies": {
70
+ "@dcloudio/types": "*",
71
+ "@dcloudio/uni-automator": "2.0.1-33920220208001",
72
+ "@dcloudio/uni-cli-i18n": "2.0.1-33920220208001",
73
+ "@dcloudio/uni-cli-shared": "2.0.1-33920220208001",
74
+ "@dcloudio/uni-migration": "2.0.1-33920220208001",
75
+ "@dcloudio/uni-template-compiler": "2.0.1-33920220208001",
76
+ "@dcloudio/vue-cli-plugin-hbuilderx": "2.0.1-33920220208001",
77
+ "@dcloudio/vue-cli-plugin-uni": "2.0.1-33920220208001",
78
+ "@dcloudio/vue-cli-plugin-uni-optimize": "2.0.1-33920220208001",
79
+ "@dcloudio/webpack-uni-mp-loader": "2.0.1-33920220208001",
80
+ "@dcloudio/webpack-uni-pages-loader": "2.0.1-33920220208001",
81
+ "@types/uni-app": "*",
82
+ "@vue/cli-plugin-babel": "^3.12.0",
83
+ "@vue/cli-service": "^3.12.0",
84
+ "babel-plugin-import": "^1.11.0",
85
+ "cross-env": "^7.0.2",
86
+ "jest": "^25.4.0",
87
+ "less": "^3.12.2",
88
+ "less-loader": "^7.0.1",
89
+ "mini-css-extract-plugin": "^1.1.1",
90
+ "mini-types": "*",
91
+ "miniprogram-api-typings": "*",
92
+ "node-sass": "^4.0.0",
93
+ "postcss-comment": "^2.0.0",
94
+ "require-context": "^1.1.0",
95
+ "sass": "^1.29.0",
96
+ "sass-loader": "^8.0.2",
97
+ "sass-resources-loader": "^2.1.1",
98
+ "scss-loader": "0.0.1",
99
+ "uglifyjs-webpack-plugin": "^1.1.1",
100
+ "vue-template-compiler": "^2.6.10",
101
+ "uni-read-pages": "^1.0.5",
102
+ "webpack": "4.44.2",
103
+ "js-base64": "^2.6.4",
104
+ "progress": "^2.0.3",
105
+ "ali-oss": "^6.16.0",
106
+ "ejs": "^3.1.6",
107
+ "js-beautify": "^1.14.0",
108
+ "art-template": "^4.13.2",
109
+ "mockjs": "1.0.1-beta3",
110
+ "vue-baidu-map": "^0.21.22",
111
+ "copy-webpack-plugin": "5.1.2",
112
+ "copy-dir": "^1.3.0",
113
+ "md5": "^2.3.0"
114
+ },
115
+ "browserslist": [
116
+ "Android >= 4",
117
+ "ios >= 8"
118
+ ],
119
+ "uni-app": {
120
+ "scripts": {}
121
+ }
122
+ }