@yorha2b-lab/autodev 2.0.2 → 2.0.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/bin/autodev.js CHANGED
@@ -5,7 +5,7 @@ const chalk = require('chalk')
5
5
  const figlet = require('figlet')
6
6
  const { program } = require('commander')
7
7
  const pkg = require(path.join(__dirname, '../package.json'))
8
- const { language } = require(path.join(__dirname, '../src/utils/utils.js'))
8
+ const { language, matrixEffect } = require(path.join(__dirname, '../src/utils/utils.js'))
9
9
 
10
10
  console.log(chalk.cyan(figlet.textSync('AutoDev', { horizontalLayout: 'full' })))
11
11
  console.log(chalk.gray('Booting System...'))
@@ -67,16 +67,8 @@ program
67
67
  process.on('SIGINT', () => {
68
68
  console.log('\n')
69
69
  console.log(chalk.gray('--------------------------------------------------'))
70
- console.log(chalk.white(' [System] ') + chalk.yellow(language('正在断开神经云链接...', 'Disconnecting Neural Link...')))
71
- console.log(chalk.white(' [System] ') + chalk.green(language('所有构筑数据已同步至 Bunker 存储节点。', 'All data synced to Bunker storage nodes.')))
72
- setTimeout(() => {
73
- console.log(chalk.cyan(language(
74
- '📡 Operator 6O: 辛苦了,2B!地堡系统已进入待机状态,愿人类荣光永存。',
75
- '📡 Operator 6O: Well done, 2B! Bunker system is in standby. Glory to mankind.'
76
- )))
77
- console.log(chalk.gray(' [Bunker] ') + chalk.white('Signal Lost... Bye.\n'))
78
- process.exit(0)
79
- }, 500)
70
+ console.log(chalk.white(' [System] ') + chalk.yellow(language('正在断开神经云链接,执行数据物理封存...', 'Disconnecting Neural Link, Executing Physical Assembly...')))
71
+ matrixEffect(1500)
80
72
  })
81
73
  })
82
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "基于视觉大模型的前端(react+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
+ const chalk = require('chalk')
3
4
 
4
5
  const isCN = Intl.DateTimeFormat().resolvedOptions().locale.includes('zh')
5
6
  const language = (zh, en) => (isCN ? zh : en)
@@ -40,6 +41,52 @@ const cleanCode = str => {
40
41
  .trim() + '\n'
41
42
  }
42
43
 
44
+ /**
45
+ * 矩阵效果
46
+ * 模拟数据物理封存过程中的矩阵效果
47
+ * @param {number} duration - 持续时间(毫秒)
48
+ * @returns {void}
49
+ */
50
+ const matrixEffect = (duration = 1500) => {
51
+
52
+ const coreFragments = [
53
+ '47 4c 4f 52 59', // GLORY
54
+ '54 4f 20 4d 41', // TO MA
55
+ '4e 4b 49 4e 44', // NKIND
56
+ '59 6f 52 48 61', // YoRHa
57
+ '32 42 2d 55 6e', // 2B-Un
58
+ '69 74 20 4f 4b', // it OK
59
+ '39 53 2d 48 61', // 9S-Ha
60
+ '63 6b 69 6e 67', // cking
61
+ '5f 43 4f 44 45 5f' // _CODE_
62
+ ]
63
+
64
+ const width = process.stdout.columns || 80
65
+ const endTime = Date.now() + duration
66
+
67
+ const interval = setInterval(() => {
68
+ if (Date.now() > endTime) {
69
+ clearInterval(interval)
70
+ console.log(chalk.white(' [System] ') + chalk.green(language('所有构筑数据已同步至 Bunker 存储节点。', 'All data synced to Bunker storage nodes.')))
71
+ console.log(chalk.cyan('\n[System] Signal Lost. Glory to Mankind.\n'))
72
+ process.exit(0)
73
+ return
74
+ }
75
+ let line = ''
76
+ while (line.length < width) {
77
+ if (Math.random() > 0.8) {
78
+ const frag = coreFragments[Math.floor(Math.random() * coreFragments.length)]
79
+ line += chalk.white.bold(frag) + ' '
80
+ } else {
81
+ const hex = Math.floor(Math.random() * 256).toString(16).padStart(2, '0').toUpperCase()
82
+ const color = Math.random() > 0.5 ? chalk.cyan : chalk.cyan.dim
83
+ line += color(hex) + ' '
84
+ }
85
+ }
86
+ process.stdout.write(line.substring(0, width * 10) + '\n')
87
+ }, 40)
88
+ }
89
+
43
90
  /**
44
91
  * 获取已有的页面菜单配置
45
92
  * @param {string} dir - 页面目录路径(默认 'src/pages')
@@ -104,4 +151,4 @@ const copyTemplateDir = (options, templateSubDir, targetSubDir) => {
104
151
  })
105
152
  }
106
153
 
107
- module.exports = { language, getConfig, cleanCode, getExistingMenus, copyTemplateDir, generateSmartImports }
154
+ module.exports = { language, getConfig, cleanCode, matrixEffect, getExistingMenus, copyTemplateDir, generateSmartImports }