@yorha2b-lab/autodev 2.0.3 → 2.0.5
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/bin/autodev.js +2 -11
- package/package.json +1 -1
- package/src/commands/handlers/page-handler.js +4 -4
- package/src/utils/utils.js +27 -1
package/bin/autodev.js
CHANGED
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
const fs = require('fs')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const chalk = require('chalk')
|
|
5
|
-
const figlet = require('figlet')
|
|
6
5
|
const { program } = require('commander')
|
|
7
6
|
const pkg = require(path.join(__dirname, '../package.json'))
|
|
8
|
-
const { language, matrixEffect } = require(path.join(__dirname, '../src/utils/utils.js'))
|
|
7
|
+
const { language, matrixEffect, bootSequence } = require(path.join(__dirname, '../src/utils/utils.js'))
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
console.log(chalk.gray('Booting System...'))
|
|
12
|
-
console.log(chalk.white(' [System] ') + chalk.green('Locale Detection: ') + chalk.cyan(language('ZH-CN', 'EN-US')))
|
|
13
|
-
console.log(chalk.white(' [System] ') + chalk.green('YoRHa No.2 Type B Unit: ') + chalk.cyan('Online'))
|
|
14
|
-
console.log(chalk.white(' [System] ') + chalk.green('Scanner Type 9S Unit: ') + chalk.cyan('Standby'))
|
|
15
|
-
console.log(chalk.white(' [System] ') + chalk.green('Full-Channel Link: ') + chalk.cyan('Established')) // 2.0 新增
|
|
16
|
-
console.log(chalk.white(' [Mission] ') + chalk.yellow('Bunker Construction Protocol: ') + chalk.cyan('v' + pkg.version))
|
|
17
|
-
console.log(chalk.white(' [Bunker] ') + chalk.magenta('Glory to mankind. (人类荣光永存)'))
|
|
18
|
-
console.log(chalk.gray('--------------------------------------------------\n'))
|
|
9
|
+
bootSequence(pkg.version)
|
|
19
10
|
|
|
20
11
|
program
|
|
21
12
|
.version(pkg.version)
|
package/package.json
CHANGED
|
@@ -40,10 +40,10 @@ module.exports = async (filePath, context) => {
|
|
|
40
40
|
|
|
41
41
|
let pageConfig
|
|
42
42
|
if (config.useDemo) {
|
|
43
|
-
spinner.
|
|
44
|
-
`🤖 Pod 042: [
|
|
45
|
-
`🤖 Pod 042: [
|
|
46
|
-
))
|
|
43
|
+
spinner.warn(chalk.yellow(language(
|
|
44
|
+
`🤖 Pod 042: [报告] 拦截到实弹请求。正在空投标准模拟包: example.json`,
|
|
45
|
+
`🤖 Pod 042: [Report] Real-fire request intercepted. Dropping simulation package: example.json`
|
|
46
|
+
)))
|
|
47
47
|
pageConfig = require(path.join(__dirname, '../../../example/example.json'))
|
|
48
48
|
} else {
|
|
49
49
|
spinner.text = chalk.cyan(language(
|
package/src/utils/utils.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const chalk = require('chalk')
|
|
4
|
+
const figlet = require('figlet')
|
|
4
5
|
|
|
5
6
|
const isCN = Intl.DateTimeFormat().resolvedOptions().locale.includes('zh')
|
|
6
7
|
const language = (zh, en) => (isCN ? zh : en)
|
|
7
8
|
|
|
9
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* 获取项目配置信息
|
|
10
13
|
* 优先读取项目根目录的 config.js,如果不存在则使用默认配置
|
|
@@ -41,6 +44,29 @@ const cleanCode = str => {
|
|
|
41
44
|
.trim() + '\n'
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 引导序列
|
|
49
|
+
* 模拟系统引导过程中的动画效果
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
const bootSequence = async version => {
|
|
53
|
+
const lines = [
|
|
54
|
+
chalk.cyan(figlet.textSync('AutoDev', { horizontalLayout: 'full' })),
|
|
55
|
+
chalk.gray('Booting System...'),
|
|
56
|
+
chalk.white(' [System] ') + chalk.green('Locale Detection: ') + chalk.cyan(language('ZH-CN', 'EN-US')),
|
|
57
|
+
chalk.white(' [System] ') + chalk.green('YoRHa No.2 Type B Unit: ') + chalk.cyan('Online'),
|
|
58
|
+
chalk.white(' [System] ') + chalk.green('Scanner Type 9S Unit: ') + chalk.cyan('Standby'),
|
|
59
|
+
chalk.white(' [System] ') + chalk.green('Full-Channel Link: ') + chalk.cyan('Established'),
|
|
60
|
+
chalk.white(' [Mission] ') + chalk.yellow('Bunker Construction Protocol: ') + chalk.cyan('v' + version),
|
|
61
|
+
chalk.white(' [Bunker] ') + chalk.magenta('Glory to mankind. (人类荣光永存)'),
|
|
62
|
+
chalk.gray('--------------------------------------------------\n')
|
|
63
|
+
]
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
console.log(line)
|
|
66
|
+
await sleep(line.includes('AutoDev') ? 300 : 80)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
44
70
|
/**
|
|
45
71
|
* 矩阵效果
|
|
46
72
|
* 模拟数据物理封存过程中的矩阵效果
|
|
@@ -151,4 +177,4 @@ const copyTemplateDir = (options, templateSubDir, targetSubDir) => {
|
|
|
151
177
|
})
|
|
152
178
|
}
|
|
153
179
|
|
|
154
|
-
module.exports = { language, getConfig, cleanCode, matrixEffect, getExistingMenus, copyTemplateDir, generateSmartImports }
|
|
180
|
+
module.exports = { language, getConfig, cleanCode, matrixEffect, bootSequence, getExistingMenus, copyTemplateDir, generateSmartImports }
|