@kengic/uni 0.7.1 → 0.7.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/package.json +5 -1
- package/script/cmd.mjs +39 -0
- package/script/postinstall.mjs +5 -11
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kengic/uni",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"postinstall": "node ./script/postinstall.mjs"
|
|
6
6
|
},
|
|
7
|
+
"bin": {
|
|
8
|
+
"kg-uni": "./script/cmd.mjs"
|
|
9
|
+
},
|
|
7
10
|
"dependencies": {
|
|
8
11
|
"@dcloudio/types": "3.3.3",
|
|
9
12
|
"@dcloudio/uni-app": "3.0.0-alpha-3080220230428001",
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
"@vueuse/shared": "8.9.4",
|
|
26
29
|
"ant-design-vue": "3.2.20",
|
|
27
30
|
"chalk": "4.1.2",
|
|
31
|
+
"commander": "14.0.2",
|
|
28
32
|
"dayjs": "1.11.10",
|
|
29
33
|
"less": "4.1.3",
|
|
30
34
|
"lodash-es": "4.17.22",
|
package/script/cmd.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
|
|
3
|
+
const program = new Command();
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 打印日志.
|
|
7
|
+
*
|
|
8
|
+
* @param message 日志消息.
|
|
9
|
+
*/
|
|
10
|
+
function log(message) {
|
|
11
|
+
console.log(`[${new Date(Date.now() + 1000 * 60 * 60 * 8).toISOString().substring(0, 23).replace('T', ' ')}] [@kengic/uni] COPY-DIST-TO-ANDROID | ${message}`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function execute() {
|
|
15
|
+
try {
|
|
16
|
+
program
|
|
17
|
+
.command('copy-dist-to-android')
|
|
18
|
+
.description('COPY DIST TO ANDROID')
|
|
19
|
+
.option('--appid <appid>', 'APPID', '')
|
|
20
|
+
.action(async (args) => {
|
|
21
|
+
try {
|
|
22
|
+
log(``);
|
|
23
|
+
log(`当前目录 | ${process.cwd()}`);
|
|
24
|
+
log(`args | ${args}`);
|
|
25
|
+
|
|
26
|
+
// TODO LT
|
|
27
|
+
log('复制成功');
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log(e);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
program.parse(process.argv);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error(e.stack);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { execute };
|
package/script/postinstall.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 安装完成之后, 处理其他任务.
|
|
5
5
|
*/
|
|
6
|
-
function now() {
|
|
7
|
-
return `[${new Date(Date.now() + 1000 * 60 * 60 * 8).toISOString().substring(0, 23).replace('T', ' ')}] [@kengic/uni] POST INSTALL | `;
|
|
8
|
-
}
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
8
|
* 打印日志.
|
|
@@ -13,7 +10,7 @@ function now() {
|
|
|
13
10
|
* @param message 日志消息.
|
|
14
11
|
*/
|
|
15
12
|
function log(message) {
|
|
16
|
-
console.log(
|
|
13
|
+
console.log(`[${new Date(Date.now() + 1000 * 60 * 60 * 8).toISOString().substring(0, 23).replace('T', ' ')}] [@kengic/uni] POST-INSTALL | ${message}`);
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -22,11 +19,11 @@ function log(message) {
|
|
|
22
19
|
const PROJECT_DIR_01 = '../../../../../../..';
|
|
23
20
|
const PROJECT_DIR_02 = '../../../../../..';
|
|
24
21
|
|
|
25
|
-
//region 同步依赖
|
|
26
|
-
//----------------------------------------------------------------------------------------------------
|
|
27
22
|
log(``);
|
|
28
23
|
log(`当前目录 | ${process.cwd()}`);
|
|
29
24
|
|
|
25
|
+
//region 同步依赖
|
|
26
|
+
//----------------------------------------------------------------------------------------------------
|
|
30
27
|
let json01 = null;
|
|
31
28
|
|
|
32
29
|
try {
|
|
@@ -97,10 +94,7 @@ if (json01 && json02) {
|
|
|
97
94
|
text = text.replaceAll("'Run method: open {devtools}, import {outputDir} run.'", "''");
|
|
98
95
|
text = text.replaceAll("'Compiler version: {version}'", "'框架版本: {version}'");
|
|
99
96
|
text = text.replaceAll("'运行方式:打开 {devtools}, 导入 {outputDir} 运行。'", "''");
|
|
100
|
-
text = text.replaceAll(
|
|
101
|
-
"'Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.'",
|
|
102
|
-
"''",
|
|
103
|
-
);
|
|
97
|
+
text = text.replaceAll("'Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.'", "''");
|
|
104
98
|
fs.writeFileSync(filepath, text, {});
|
|
105
99
|
}
|
|
106
100
|
|