auramaxx 0.1.4 → 0.1.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/auramaxx.js
CHANGED
|
@@ -1440,8 +1440,7 @@ async function main() {
|
|
|
1440
1440
|
|
|
1441
1441
|
const inferredStartFlags = new Set(['--debug', '--terminal', '--headless', '--background', '--daemon', '-d']);
|
|
1442
1442
|
if (cmd && inferredStartFlags.has(cmd)) {
|
|
1443
|
-
|
|
1444
|
-
if (defaultCommand === 'start') {
|
|
1443
|
+
if (isCommandAvailable('start')) {
|
|
1445
1444
|
inferredCommand = true;
|
|
1446
1445
|
args.unshift(cmd);
|
|
1447
1446
|
cmd = 'start';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auramaxx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "AuraJS CLI for creating, playing, and publishing JavaScript-first games.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aurajs",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"src/server/cli/commands/make.ts",
|
|
31
31
|
"src/server/cli/commands/play.ts",
|
|
32
32
|
"src/server/cli/commands/publish.ts",
|
|
33
|
+
"src/server/cli/lib/aurajs-project.ts",
|
|
33
34
|
"src/server/cli/lib/published-game-integrity.ts",
|
|
34
35
|
"src/server/cli/lib/prompt.ts",
|
|
35
36
|
"src/server/cli/lib/theme.ts"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
const LIB_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
export const LOCAL_AURAJS_CLI = path.resolve(
|
|
8
|
+
LIB_DIR,
|
|
9
|
+
'../../../../../packages/aurascript/src/cli/src/cli.mjs',
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export function resolveInvocationCwd(): string {
|
|
13
|
+
const forwardedCwd = process.env.AURA_INVOKE_CWD;
|
|
14
|
+
if (forwardedCwd && path.isAbsolute(forwardedCwd)) {
|
|
15
|
+
return forwardedCwd;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const shellPwd = process.env.PWD;
|
|
19
|
+
if (shellPwd && path.isAbsolute(shellPwd)) {
|
|
20
|
+
return shellPwd;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return process.cwd();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function resolveAuraJsProjectRoot(startDir: string): string | null {
|
|
27
|
+
let current = path.resolve(startDir);
|
|
28
|
+
|
|
29
|
+
while (true) {
|
|
30
|
+
const auraConfigPath = path.join(current, 'aura.config.json');
|
|
31
|
+
const packageJsonPath = path.join(current, 'package.json');
|
|
32
|
+
if (existsSync(auraConfigPath) && existsSync(packageJsonPath)) {
|
|
33
|
+
return current;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const parent = path.dirname(current);
|
|
37
|
+
if (parent === current) break;
|
|
38
|
+
current = parent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function requireAuraJsProjectRoot(startDir: string): string {
|
|
45
|
+
const projectRoot = resolveAuraJsProjectRoot(startDir);
|
|
46
|
+
if (projectRoot) {
|
|
47
|
+
return projectRoot;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
throw new Error('Not an AuraJS project. Run `auramaxx create my-game` first.');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function delegateToAuraJsCommand(auraArgs: string[], cwd: string): never {
|
|
54
|
+
try {
|
|
55
|
+
if (existsSync(LOCAL_AURAJS_CLI)) {
|
|
56
|
+
execFileSync(process.execPath, [LOCAL_AURAJS_CLI, ...auraArgs], {
|
|
57
|
+
cwd,
|
|
58
|
+
stdio: 'inherit',
|
|
59
|
+
env: process.env,
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
execFileSync(
|
|
63
|
+
'npm',
|
|
64
|
+
['exec', '--yes', '--package', '@auraindustry/aurajs', '--', 'aura', ...auraArgs],
|
|
65
|
+
{
|
|
66
|
+
cwd,
|
|
67
|
+
stdio: 'inherit',
|
|
68
|
+
env: process.env,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
process.exit(0);
|
|
74
|
+
} catch (error: unknown) {
|
|
75
|
+
const status = (error as { status?: number }).status;
|
|
76
|
+
process.exit(status || 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function delegateToAuraJsProjectCommand(commandName: string, commandArgs: string[] = []): never {
|
|
81
|
+
const invocationCwd = resolveInvocationCwd();
|
|
82
|
+
const projectRoot = requireAuraJsProjectRoot(invocationCwd);
|
|
83
|
+
delegateToAuraJsCommand([commandName, ...commandArgs], projectRoot);
|
|
84
|
+
}
|