auramaxx 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -7,7 +7,7 @@ Create, play, and publish from your terminal.
7
7
 
8
8
  > Alpha status: AuraJS is still in alpha and not ready for production use.
9
9
 
10
- ![AuraJS](https://aurajs.gg/og.webp)
10
+ ![Auracraft demo](https://aurajs.gg/auracraft-demo.gif)
11
11
 
12
12
  Website: [aurajs.gg](https://aurajs.gg)
13
13
 
@@ -39,8 +39,6 @@ auramaxx play auracraft
39
39
  npx auracraft play
40
40
  ```
41
41
 
42
- ![Auracraft demo](https://aurajs.gg/auracraft-demo.gif)
43
-
44
42
  ## Fork a Game
45
43
 
46
44
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auramaxx",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "AuraJS CLI for creating, playing, and publishing JavaScript-first games.",
5
5
  "keywords": [
6
6
  "aurajs",
@@ -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',
@@ -94,12 +95,26 @@ async function resolveGameName(initialName: string | null): Promise<string> {
94
95
  }
95
96
  }
96
97
 
97
- async function resolveTemplate(initialTemplate: string | null): Promise<string> {
98
+ async function resolveTemplate(initialTemplate: string | null, options: { allowPrompt?: boolean } = {}): Promise<string> {
98
99
  const normalized = normalizeTemplate(initialTemplate);
99
100
  if (normalized) {
100
101
  return normalized;
101
102
  }
102
- return promptSelect(' Starter template', TEMPLATE_OPTIONS, '2d');
103
+
104
+ if (options.allowPrompt === false) {
105
+ return '2d';
106
+ }
107
+
108
+ const selected = await promptSelect(' Starter template', TEMPLATE_OPTIONS, '2d');
109
+ if (selected !== 'custom') {
110
+ return selected;
111
+ }
112
+
113
+ while (true) {
114
+ const answer = normalizeTemplate(await promptInput(' AuraJS template id'));
115
+ if (answer) return answer;
116
+ console.error(' Template id is required.');
117
+ }
103
118
  }
104
119
 
105
120
  async function main() {
@@ -107,13 +122,16 @@ async function main() {
107
122
 
108
123
  if (parsed.help) {
109
124
  printBanner('CREATE');
110
- console.log(` ${paint('Usage:', ANSI.bold)} auramaxx create [name] [--template <2d|3d|multiplayer>] [--skip-install]`);
125
+ console.log(` ${paint('Usage:', ANSI.bold)} auramaxx create [name] [--template <slug>] [--skip-install]`);
111
126
  console.log('');
112
127
  console.log(' Styled wrapper around AuraJS create scaffolding.');
113
128
  console.log(` ${paint('Examples:', ANSI.dim)}`);
114
129
  console.log(' auramaxx create my-game --template 2d');
115
130
  console.log(' auramaxx create my-game --template 3d');
116
131
  console.log(' auramaxx create my-room-game --template multiplayer');
132
+ console.log(' auramaxx create my-retro --template retro-topdown-adventure');
133
+ console.log('');
134
+ console.log(' The starter prompt shows common presets and also supports a custom AuraJS template id.');
117
135
  console.log('');
118
136
  return;
119
137
  }
@@ -122,7 +140,9 @@ async function main() {
122
140
  printSection('New AuraJS Game', 'AuraMaxx styling + prompts, delegated to AuraJS scaffolder.');
123
141
 
124
142
  const name = await resolveGameName(parsed.name);
125
- const template = await resolveTemplate(parsed.template);
143
+ const template = await resolveTemplate(parsed.template, {
144
+ allowPrompt: !parsed.name,
145
+ });
126
146
  const invocationCwd = resolveInvocationCwd();
127
147
 
128
148
  printSection('Scaffolding', `Delegating to AuraJS (${template})...`);
@@ -3,6 +3,7 @@ import { rmSync } from 'fs';
3
3
  import { pathToFileURL } from 'url';
4
4
 
5
5
  import { printBanner, printSection, paint, ANSI } from '../lib/theme';
6
+ import { resolveInvocationCwd } from '../lib/aurajs-project';
6
7
  import {
7
8
  buildPublishedGameLaunchEnv,
8
9
  installVerifiedGamePackage,
@@ -32,6 +33,7 @@ export function buildForkPlan(argv: string[]): ForkCommandPlan {
32
33
 
33
34
  export async function main(argv: string[] = process.argv.slice(2)) {
34
35
  const plan = buildForkPlan(argv);
36
+ const invocationCwd = resolveInvocationCwd();
35
37
 
36
38
  if (plan.help || !plan.name) {
37
39
  printBanner('FORK');
@@ -57,7 +59,10 @@ export async function main(argv: string[] = process.argv.slice(2)) {
57
59
  let install: Awaited<ReturnType<typeof installVerifiedGamePackage>> | null = null;
58
60
  try {
59
61
  install = await installVerifiedGamePackage(plan);
60
- const env = buildPublishedGameLaunchEnv(process.env);
62
+ const env = buildPublishedGameLaunchEnv(process.env, {
63
+ AURA_INVOKE_CWD: invocationCwd,
64
+ AURAMAXX_CLI_AVAILABLE: '1',
65
+ });
61
66
  execFileSync(process.execPath, [install.binAbsolutePath, ...plan.forwardedArgs], {
62
67
  stdio: 'inherit',
63
68
  cwd: install.packageRoot,
@@ -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
- const invocationCwd = resolveInvocationCwd();
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,11 @@ export async function main(argv: string[] = process.argv.slice(2)) {
406
406
  });
407
407
  const env = buildPublishedGameLaunchEnv(
408
408
  process.env,
409
- plan.forwardedArgs[0] === 'join' ? { AURA_GAME_JOIN_MODE: 'play' } : {},
409
+ {
410
+ ...(plan.forwardedArgs[0] === 'join' ? { AURA_GAME_JOIN_MODE: 'play' } : {}),
411
+ AURAMAXX_CLI_AVAILABLE: '1',
412
+ AURA_INVOKE_CWD: invocationCwd,
413
+ },
410
414
  );
411
415
  progress.update(4, 'Launching game', plan.forwardedArgs[0] || 'play');
412
416
  execFileSync(process.execPath, [install.binAbsolutePath, ...plan.forwardedArgs], {