alemonjs 1.0.12 → 1.0.14

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.
@@ -18,8 +18,8 @@ export const setAuthenticationByNtqq = ClientByNTQQ.setAuthentication;
18
18
  export function ApplicationTools(AppName, name = 'apps') {
19
19
  const appDir = getAppDir();
20
20
  return compilationTools({
21
- aInput: `${appDir}/${AppName}/${name}/**/*.ts`,
22
- aOutput: `${appDir}/${AppName}/apps.js`
21
+ aInput: `${appDir.replace(/^\//, '')}/${AppName}/${name}/**/*.ts`,
22
+ aOutput: `${appDir.replace(/^\//, '')}/${AppName}/apps.js`
23
23
  });
24
24
  }
25
25
  let OptionsCache;
@@ -168,8 +168,8 @@ export async function defineAlemonConfig(Options) {
168
168
  }
169
169
  if (Options?.app?.module) {
170
170
  const word = await compilationTools({
171
- aInput: Options?.app?.module?.input ?? 'apps/**/*.ts',
172
- aOutput: Options?.app?.module?.input ?? '.apps/index.js'
171
+ aInput: Options?.app?.module?.input?.replace(/^\//, '') ?? 'apps/**/*.ts',
172
+ aOutput: Options?.app?.module?.output.replace(/^\//, '') ?? '.apps/index.js'
173
173
  });
174
174
  app.component(word);
175
175
  }
package/package.json CHANGED
@@ -1,15 +1,10 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "阿柠檬框架",
5
5
  "author": "ningmengchongshui",
6
- "main": "lib/index.js",
7
6
  "license": "GPL-2.0",
8
7
  "type": "module",
9
- "exports": {
10
- "./run": "./src/run.js",
11
- "./core": "./src/core/index.js"
12
- },
13
8
  "scripts": {
14
9
  "app": "alemonjs",
15
10
  "dev": "alemonjs dev",
@@ -22,6 +17,7 @@
22
17
  "@discordjs/core": "^0.6.0",
23
18
  "@discordjs/rest": "^1.7.1",
24
19
  "alemon-rollup": "^1.0.2",
20
+ "alemonjs": "^1.0.13",
25
21
  "axios": "^1.4.0",
26
22
  "discord.js": "^14.11.0",
27
23
  "image-size": "^1.0.2",
@@ -49,11 +45,21 @@
49
45
  "typescript": ">=5.0.4 <5.1.0"
50
46
  },
51
47
  "types": "types",
48
+ "main": "lib/index.js",
52
49
  "files": [
53
50
  "bin",
54
51
  "lib",
55
- "types"
52
+ "types",
53
+ "run.js",
54
+ "run.d.ts"
56
55
  ],
56
+ "exports": {
57
+ ".": "./lib/index.js",
58
+ "./run": {
59
+ "import": "./run.js",
60
+ "types": "./run.d.ts"
61
+ }
62
+ },
57
63
  "bin": {
58
64
  "alemonjs": "bin/main.js"
59
65
  },
package/run.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function commandRun(ars: string[]): void
package/run.js ADDED
@@ -0,0 +1,19 @@
1
+ import { spawn } from 'child_process'
2
+ export function commandRun(ars) {
3
+ const msg = ars.join(' ')
4
+ const files = msg.match(/(\S+\.js|\S+\.ts)/g) ?? ['alemon.config.ts']
5
+ const argsWithoutFiles = msg.replace(/(\S+\.js|\S+\.ts)/g, '')
6
+ for (const item of files) {
7
+ const isTypeScript = item.endsWith('.ts')
8
+ const command = isTypeScript ? 'npx ts-node' : 'node'
9
+ const cmd = `${command} ${item} ${argsWithoutFiles}`
10
+ console.log('[alemonjs]', cmd)
11
+ const childProcess = spawn(cmd, { shell: true })
12
+ childProcess.stdout.on('data', data => {
13
+ process.stdout.write(data.toString())
14
+ })
15
+ childProcess.stderr.on('data', data => {
16
+ process.stderr.write(data.toString())
17
+ })
18
+ }
19
+ }
package/lib/run.js DELETED
@@ -1,19 +0,0 @@
1
- import { spawn } from 'child_process';
2
- export function commandRun(ars) {
3
- const msg = ars.join(' ');
4
- const files = msg.match(/(\S+\.js|\S+\.ts)/g) ?? ['alemon.config.ts'];
5
- const argsWithoutFiles = msg.replace(/(\S+\.js|\S+\.ts)/g, '');
6
- for (const item of files) {
7
- const isTypeScript = item.endsWith('.ts');
8
- const command = isTypeScript ? 'npx ts-node' : 'node';
9
- const cmd = `${command} ${item} ${argsWithoutFiles}`;
10
- console.log('[alemonjs]', cmd);
11
- const childProcess = spawn(cmd, { shell: true });
12
- childProcess.stdout.on('data', data => {
13
- process.stdout.write(data.toString());
14
- });
15
- childProcess.stderr.on('data', data => {
16
- process.stderr.write(data.toString());
17
- });
18
- }
19
- }
package/types/run.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function commandRun(ars: any): void;