auramaxx 0.1.5 → 0.1.6
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/package.json
CHANGED
|
@@ -9,6 +9,7 @@ const TEMPLATE_OPTIONS = [
|
|
|
9
9
|
{ value: '2d', label: '[2D] Adventure', aliases: ['1', '2', '2d', '2d-adventure', 'adventure-2d'] },
|
|
10
10
|
{ value: '3d', label: '[3D] Adventure', aliases: ['3', '3d', '3d-adventure', 'adventure-3d'] },
|
|
11
11
|
{ value: 'multiplayer', label: '[MP] Multiplayer', aliases: ['4', 'mp', 'multiplayer', 'room', 'room-code', 'local-multiplayer'] },
|
|
12
|
+
{ value: 'custom', label: '[Custom] Enter AuraJS template id', aliases: ['5', 'c', 'custom', 'other'] },
|
|
12
13
|
];
|
|
13
14
|
const TEMPLATE_ALIASES: Record<string, string> = {
|
|
14
15
|
'2d': '2d',
|
|
@@ -99,7 +100,17 @@ async function resolveTemplate(initialTemplate: string | null): Promise<string>
|
|
|
99
100
|
if (normalized) {
|
|
100
101
|
return normalized;
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
+
|
|
104
|
+
const selected = await promptSelect(' Starter template', TEMPLATE_OPTIONS, '2d');
|
|
105
|
+
if (selected !== 'custom') {
|
|
106
|
+
return selected;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
while (true) {
|
|
110
|
+
const answer = normalizeTemplate(await promptInput(' AuraJS template id'));
|
|
111
|
+
if (answer) return answer;
|
|
112
|
+
console.error(' Template id is required.');
|
|
113
|
+
}
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
async function main() {
|
|
@@ -107,13 +118,16 @@ async function main() {
|
|
|
107
118
|
|
|
108
119
|
if (parsed.help) {
|
|
109
120
|
printBanner('CREATE');
|
|
110
|
-
console.log(` ${paint('Usage:', ANSI.bold)} auramaxx create [name] [--template <
|
|
121
|
+
console.log(` ${paint('Usage:', ANSI.bold)} auramaxx create [name] [--template <slug>] [--skip-install]`);
|
|
111
122
|
console.log('');
|
|
112
123
|
console.log(' Styled wrapper around AuraJS create scaffolding.');
|
|
113
124
|
console.log(` ${paint('Examples:', ANSI.dim)}`);
|
|
114
125
|
console.log(' auramaxx create my-game --template 2d');
|
|
115
126
|
console.log(' auramaxx create my-game --template 3d');
|
|
116
127
|
console.log(' auramaxx create my-room-game --template multiplayer');
|
|
128
|
+
console.log(' auramaxx create my-retro --template retro-topdown-adventure');
|
|
129
|
+
console.log('');
|
|
130
|
+
console.log(' The starter prompt shows common presets and also supports a custom AuraJS template id.');
|
|
117
131
|
console.log('');
|
|
118
132
|
return;
|
|
119
133
|
}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
1
|
import { printBanner, paint, ANSI } from '../lib/theme';
|
|
6
|
-
|
|
7
|
-
const COMMAND_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const LOCAL_AURAJS_CLI = path.resolve(
|
|
9
|
-
COMMAND_DIR,
|
|
10
|
-
'../../../../../packages/aurascript/src/cli/src/cli.mjs',
|
|
11
|
-
);
|
|
2
|
+
import { delegateToAuraJsProjectCommand } from '../lib/aurajs-project';
|
|
12
3
|
|
|
13
4
|
function parseArgs(argv: string[]) {
|
|
14
5
|
for (const arg of argv) {
|
|
@@ -22,19 +13,6 @@ function parseArgs(argv: string[]) {
|
|
|
22
13
|
};
|
|
23
14
|
}
|
|
24
15
|
|
|
25
|
-
function resolveInvocationCwd(): string {
|
|
26
|
-
const forwardedCwd = process.env.AURA_INVOKE_CWD;
|
|
27
|
-
if (forwardedCwd && path.isAbsolute(forwardedCwd)) {
|
|
28
|
-
return forwardedCwd;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const shellPwd = process.env.PWD;
|
|
32
|
-
if (shellPwd && path.isAbsolute(shellPwd)) {
|
|
33
|
-
return shellPwd;
|
|
34
|
-
}
|
|
35
|
-
return process.cwd();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
16
|
async function main() {
|
|
39
17
|
const parsed = parseArgs(process.argv.slice(2));
|
|
40
18
|
|
|
@@ -56,32 +34,7 @@ async function main() {
|
|
|
56
34
|
return;
|
|
57
35
|
}
|
|
58
36
|
|
|
59
|
-
|
|
60
|
-
const auraArgs = ['make', ...parsed.passthrough];
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
if (existsSync(LOCAL_AURAJS_CLI)) {
|
|
64
|
-
execFileSync(process.execPath, [LOCAL_AURAJS_CLI, ...auraArgs], {
|
|
65
|
-
cwd: invocationCwd,
|
|
66
|
-
stdio: 'inherit',
|
|
67
|
-
env: process.env,
|
|
68
|
-
});
|
|
69
|
-
} else {
|
|
70
|
-
execFileSync(
|
|
71
|
-
'npm',
|
|
72
|
-
['exec', '--yes', '--package', '@auraindustry/aurajs', '--', 'aura', ...auraArgs],
|
|
73
|
-
{
|
|
74
|
-
cwd: invocationCwd,
|
|
75
|
-
stdio: 'inherit',
|
|
76
|
-
env: process.env,
|
|
77
|
-
},
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
} catch (error: unknown) {
|
|
81
|
-
const status = (error as { status?: number }).status;
|
|
82
|
-
if (status) process.exit(status);
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
37
|
+
delegateToAuraJsProjectCommand('make', parsed.passthrough);
|
|
85
38
|
}
|
|
86
39
|
|
|
87
40
|
main().catch((err) => {
|
|
@@ -406,7 +406,10 @@ export async function main(argv: string[] = process.argv.slice(2)) {
|
|
|
406
406
|
});
|
|
407
407
|
const env = buildPublishedGameLaunchEnv(
|
|
408
408
|
process.env,
|
|
409
|
-
|
|
409
|
+
{
|
|
410
|
+
...(plan.forwardedArgs[0] === 'join' ? { AURA_GAME_JOIN_MODE: 'play' } : {}),
|
|
411
|
+
AURAMAXX_CLI_AVAILABLE: '1',
|
|
412
|
+
},
|
|
410
413
|
);
|
|
411
414
|
progress.update(4, 'Launching game', plan.forwardedArgs[0] || 'play');
|
|
412
415
|
execFileSync(process.execPath, [install.binAbsolutePath, ...plan.forwardedArgs], {
|