alemonjs 1.0.16 → 1.0.18

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/build.js CHANGED
@@ -1,100 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { existsSync, mkdirSync } from 'fs'
4
- import { execSync, exec, spawn } from 'child_process'
5
3
  import { compilationTools } from 'alemon-rollup'
6
- import { join } from 'path'
7
-
8
- /**
9
- * 执行指令
10
- * @param {*} cess
11
- * @param {*} cmd
12
- * @returns
13
- */
14
- async function command(cess, cmd) {
15
- // 错误参数
16
- if (!cmd) process.exit()
17
- // 锁定位置
18
- const dirPath = `./`
19
- // 没有存在
20
- mkdirSync(dirPath, { recursive: true })
21
- console.info('\n')
22
- try {
23
- // 切换目录
24
- process.chdir(dirPath)
25
- console.info(`[command] ${cmd}`)
26
- if (cess == 'execSync') {
27
- execSync(cmd, { stdio: 'inherit' })
28
- } else if (cess == 'exec') {
29
- exec(cmd)
30
- }
31
- } catch (error) {
32
- console.info(`${error}`)
33
- return
34
- }
35
- }
36
-
37
- /**
38
- * 执行脚本
39
- * @param {*} name
40
- * @param {*} file
41
- * @param {*} ars
42
- */
43
- function nodeScripts(name = 'node', file = '', ars = []) {
44
- const command = spawn(`${name} ${file} ${ars.join(' ')}`, { shell: true })
45
- command.stdout.on('data', data => {
46
- process.stdout.write(data.toString())
47
- })
48
- command.stderr.on('data', data => {
49
- process.stderr.write(data.toString())
50
- })
51
- }
52
-
53
4
  ;(async function run() {
54
- /**
55
- * 得到配置
56
- */
57
5
  const ars = process.argv.slice(2)
58
- const msg = ars.join(' ')
59
- const files = msg.match(/(\S+\.js|\S+\.ts)/g) ?? ['alemon.build.js']
60
- /**
61
- * 判断是文件是否存在
62
- */
63
- let Options = {}
64
-
65
- if (existsSync(join(process.cwd(), files[0]))) {
66
- console.log('[CONFIG]', files[0])
67
- Options = await import(`../${files[0]}`)
6
+ let Options = {
7
+ input: 'apps/**/*.ts',
8
+ output: 'alemon.app.js'
68
9
  }
69
-
70
- /**
71
- * 开始打包
72
- */
73
- await compilationTools({
74
- aInput: Options?.input ?? 'apps/**/*.ts',
75
- aOutput: Options?.output ?? 'app.alemon.js'
76
- })
77
-
78
- /**
79
- * 附加指令
80
- */
81
- if (Options?.command) {
82
- for await (const item of Options.command) {
83
- if (item?.cmd) {
84
- await command(item?.cess ?? 'execSync', item?.cmd)
85
- }
86
- }
10
+ const i = ars.indexOf('--i')
11
+ if (i != -1) {
12
+ Options.input = ars[i + 1]
87
13
  }
88
-
89
- /**
90
- * **********
91
- * 附加脚本
92
- * **********
93
- */
94
- if (Options?.scripts) {
95
- for await (const item of Options.scripts) {
96
- const name = item?.name ?? 'node'
97
- nodeScripts(name, item?.file, item?.ars ?? [])
98
- }
14
+ const o = ars.indexOf('--o')
15
+ if (ars.indexOf('--o') != -1) {
16
+ Options.output = ars[o + 1]
99
17
  }
18
+ await compilationTools({
19
+ aInput: Options.input,
20
+ aOutput: Options.output
21
+ })
100
22
  })()
package/lib/config/pup.js CHANGED
@@ -12,7 +12,6 @@ if (process.platform == 'win32' && existsSync(win32Edge)) {
12
12
  // win32 Edge
13
13
  skipDownload = true;
14
14
  executablePath = win32Edge;
15
- console.info('[Win32 Edge] start');
16
15
  }
17
16
  else if (platform == 'linux' || platform == 'android') {
18
17
  // linux | android
@@ -30,12 +29,10 @@ else if (platform == 'linux' || platform == 'android') {
30
29
  if (chromiumPath) {
31
30
  skipDownload = true;
32
31
  executablePath = realpathSync(chromiumPath);
33
- console.info('[Chromium] start');
34
32
  break;
35
33
  }
36
34
  }
37
35
  catch (error) {
38
- console.error('Failed to get Chromium path:', error);
39
36
  continue;
40
37
  }
41
38
  }
@@ -53,14 +50,12 @@ else if (platform == 'linux' || platform == 'android') {
53
50
  if (existsSync(item)) {
54
51
  skipDownload = true;
55
52
  executablePath = item;
56
- console.info('[Chromium] start');
57
53
  break;
58
54
  }
59
55
  }
60
56
  }
61
57
  // arm64/arrch64
62
58
  if (isArch == 'arm64' || isArch == 'aarch64') {
63
- console.info('[arm64/aarch64] system');
64
59
  skipDownload = true;
65
60
  }
66
61
  }
@@ -7,7 +7,7 @@ const ApplicationProcessingConfiguration = {
7
7
  // 打开正则
8
8
  openRegex: /./,
9
9
  // 屏蔽正则
10
- closeRegex: /./,
10
+ closeRegex: undefined,
11
11
  // 指令生成地址
12
12
  route: '/public/defset'
13
13
  };
@@ -219,7 +219,7 @@ export async function defineAlemonConfig(Options) {
219
219
  * 开始解析
220
220
  * ************
221
221
  */
222
- if (Options?.mount) {
222
+ if (Options?.mount !== false) {
223
223
  await appsInit();
224
224
  }
225
225
  setTimeout(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "阿柠檬框架",
5
5
  "author": "ningmengchongshui",
6
6
  "license": "GPL-2.0",
@@ -17,7 +17,6 @@
17
17
  "@discordjs/core": "^0.6.0",
18
18
  "@discordjs/rest": "^1.7.1",
19
19
  "alemon-rollup": "^1.0.3",
20
- "alemonjs": "^1.0.13",
21
20
  "axios": "^1.4.0",
22
21
  "discord.js": "^14.11.0",
23
22
  "image-size": "^1.0.2",
@@ -3,7 +3,7 @@ interface ApplicationProcessingOpsion {
3
3
  main: string;
4
4
  type: 'ts' | 'js';
5
5
  openRegex: RegExp;
6
- closeRegex: RegExp;
6
+ closeRegex: RegExp | undefined;
7
7
  route: string;
8
8
  }
9
9
  export declare function setAppProCoinfg<T extends keyof ApplicationProcessingOpsion>(key: T, val: ApplicationProcessingOpsion[T]): void;