create-exo-app 0.1.0 → 0.19.0

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.
Files changed (57) hide show
  1. package/README.md +30 -29
  2. package/bin/create-exo-app.js +3 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +2 -118
  5. package/dist/scaffold.d.ts +44 -0
  6. package/dist/scaffold.js +190 -0
  7. package/package.json +25 -8
  8. package/templates/audio-reactive/index.html +13 -3
  9. package/templates/audio-reactive/package.json +7 -3
  10. package/templates/audio-reactive/src/main.ts +4 -3
  11. package/templates/audio-reactive/src/scenes/AudioReactiveScene.ts +3 -3
  12. package/templates/game-starter/index.html +13 -3
  13. package/templates/game-starter/package.json +6 -3
  14. package/templates/game-starter/src/main.ts +5 -3
  15. package/templates/game-starter/src/objects/Player.ts +1 -1
  16. package/templates/game-starter/src/scenes/GameOverScene.ts +11 -17
  17. package/templates/game-starter/src/scenes/GameScene.ts +59 -26
  18. package/templates/minimal/index.html +13 -3
  19. package/templates/minimal/package.json +6 -3
  20. package/templates/minimal/src/main.ts +5 -4
  21. package/templates/minimal/src/scenes/MainScene.ts +3 -8
  22. package/templates/platformer/README.md +13 -0
  23. package/templates/platformer/index.html +25 -0
  24. package/templates/platformer/package.json +21 -0
  25. package/templates/platformer/public/assets/ART-LICENSE.txt +28 -0
  26. package/templates/platformer/public/assets/platformer-characters.json +1093 -0
  27. package/templates/platformer/public/assets/platformer-characters.png +0 -0
  28. package/templates/platformer/public/assets/platformer-tiles.json +7549 -0
  29. package/templates/platformer/public/assets/platformer-tiles.png +0 -0
  30. package/templates/platformer/src/main.ts +19 -0
  31. package/templates/platformer/src/objects/Player.ts +139 -0
  32. package/templates/platformer/src/scenes/PlatformerScene.ts +237 -0
  33. package/templates/platformer/tsconfig.json +12 -0
  34. package/templates/platformer/vite.config.ts +5 -0
  35. package/templates/top-down/README.md +27 -0
  36. package/templates/top-down/index.html +25 -0
  37. package/templates/top-down/package.json +24 -0
  38. package/templates/top-down/public/assets/ART-LICENSE.txt +21 -0
  39. package/templates/top-down/public/assets/characters.json +1093 -0
  40. package/templates/top-down/public/assets/characters.png +0 -0
  41. package/templates/top-down/public/assets/map-pack.png +0 -0
  42. package/templates/top-down/public/assets/town-square.tmj +689 -0
  43. package/templates/top-down/src/level.ts +59 -0
  44. package/templates/top-down/src/main.ts +29 -0
  45. package/templates/top-down/src/scenes/ProceduralMapScene.ts +74 -0
  46. package/templates/top-down/src/scenes/TiledMapScene.ts +33 -0
  47. package/templates/top-down/src/scenes/TopDownScene.ts +208 -0
  48. package/templates/top-down/tsconfig.json +12 -0
  49. package/templates/top-down/vite.config.ts +5 -0
  50. package/templates/ui-app/README.md +17 -0
  51. package/templates/ui-app/index.html +25 -0
  52. package/templates/ui-app/package.json +20 -0
  53. package/templates/ui-app/public/assets/.gitkeep +0 -0
  54. package/templates/ui-app/src/main.ts +18 -0
  55. package/templates/ui-app/src/scenes/SettingsScene.ts +136 -0
  56. package/templates/ui-app/tsconfig.json +12 -0
  57. package/templates/ui-app/vite.config.ts +5 -0
package/README.md CHANGED
@@ -1,48 +1,49 @@
1
1
  # create-exo-app
2
2
 
3
- Official starter for [ExoJS](https://github.com/Exoridus/ExoJS).
3
+ Create an ExoJS application with Vite, TypeScript, and a working scene. Use `minimal` to learn the runtime before adding optional systems.
4
4
 
5
- ## Usage
6
-
7
- ```bash
8
- npm create exo-app@latest my-game
9
- ```
10
-
11
- Or pick a template:
12
-
13
- ```bash
5
+ ```sh
14
6
  npm create exo-app@latest my-game -- --template minimal
15
- npm create exo-app@latest my-game -- --template game-starter
16
- npm create exo-app@latest my-game -- --template audio-reactive
17
- ```
18
-
19
- Then:
20
-
21
- ```bash
22
7
  cd my-game
23
8
  npm install
24
9
  npm run dev
25
10
  ```
26
11
 
12
+ Omit `--template` to choose interactively. The generated project belongs to you: edit its source, commit its lockfile, and keep compatible ExoJS package versions pinned.
13
+
14
+ ## Engine version
15
+
16
+ A generated project asks for the engine release the scaffolder belongs to. `create-exo-app@0.19` writes `"@codexo/exojs": "0.19.x"`, so the project you get matches the scaffolder you ran and a later `latest` never moves it to a different engine API. Pin `create-exo-app` the same way you pin the engine.
17
+
18
+ Only ExoJS packages move together. Vite, TypeScript and the rest of the build toolchain keep ordinary semver ranges in the template and are not tied to the engine's release line.
19
+
27
20
  ## Templates
28
21
 
29
- | Template | Description |
30
- |---|---|
31
- | `minimal` | Smallest TypeScript ExoJS app — one `Scene`, one rotating box |
32
- | `game-starter` | Keyboard-controlled player, `GameScene` + `GameOverScene`, score HUD |
33
- | `audio-reactive` | `AudioAnalyser`-driven frequency bar visualiser; click-to-start gesture |
22
+ | Template | Starting point |
23
+ | ---------------- | ------------------------------------------------------------------------------ |
24
+ | `minimal` | One visible animated object in one scene. |
25
+ | `game-starter` | Keyboard-controlled gameplay and a game-over scene. |
26
+ | `platformer` | Side-scrolling physics, camera follow, and jump handling. |
27
+ | `top-down` | Tilemaps, collision, and click-to-move pathfinding; procedural or Tiled input. |
28
+ | `ui-app` | A settings interface built from Core UI widgets. |
29
+ | `audio-reactive` | Shapes driven by live audio analysis. |
34
30
 
35
- ## CLI options
31
+ Availability follows the scaffolder version you run. The repository's `next` branch can contain a template that is not yet in an older npm release. A specialized template includes more systems; it is not a prerequisite for using the engine.
36
32
 
37
- ```
38
- create-exo-app <project-name> [--template <name>] [--force]
33
+ ## Locate the application code
39
34
 
40
- --template minimal | game-starter | audio-reactive (default: minimal)
41
- --force overwrite an existing non-empty directory
35
+ `src/main.ts` creates the application, registers scene classes, mounts the canvas, and awaits startup. Scene behavior lives in `src/scenes/`. Files under `public/assets/` are served unchanged; `public/` is not part of their request URL.
36
+
37
+ ```sh
38
+ npm run build
39
+ npm run preview
42
40
  ```
43
41
 
44
- When run interactively (TTY) without `--template`, the CLI prompts for a template choice.
45
- In non-TTY / CI environments it defaults to `minimal` automatically.
42
+ The build writes the static application to `dist/`. Preview checks that output locally; verify the actual hosted output as well, especially loader base paths and optional browser capabilities.
43
+
44
+ ## Documentation
45
+
46
+ [Setup and project layout](https://exoridus.github.io/ExoJS/en/guide/getting-started/setup/) · [Your first scene](https://exoridus.github.io/ExoJS/en/guide/getting-started/your-first-scene/) · [Build and deploy](https://exoridus.github.io/ExoJS/en/guide/shipping/deployment/)
46
47
 
47
48
  ## License
48
49
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ await import(new URL('../dist/index.js', import.meta.url).href);
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -1,122 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
3
- import { basename, join, resolve } from 'node:path';
4
- import { createInterface } from 'node:readline';
5
- import { fileURLToPath } from 'node:url';
6
- const __dirname = fileURLToPath(new URL('.', import.meta.url));
7
- const TEMPLATES = ['minimal', 'game-starter', 'audio-reactive'];
8
- const TEMPLATE_DESCRIPTIONS = {
9
- 'minimal': 'smallest TypeScript ExoJS app with one Scene and one visible object',
10
- 'game-starter': 'keyboard-controlled game loop starter with Scene structure',
11
- 'audio-reactive': 'AudioAnalyser-driven shapes and animations',
12
- };
13
- function isInteractive() {
14
- return process.stdin.isTTY === true;
15
- }
16
- function prompt(question) {
17
- return new Promise(resolve => {
18
- const rl = createInterface({ input: process.stdin, output: process.stdout });
19
- rl.question(question, answer => {
20
- rl.close();
21
- resolve(answer.trim());
22
- });
23
- });
24
- }
25
- async function promptProjectName() {
26
- const answer = await prompt('Project name: ');
27
- if (!answer) {
28
- console.error('Error: project name cannot be empty.');
29
- process.exit(1);
30
- }
31
- return answer;
32
- }
33
- async function promptTemplate() {
34
- console.log('\nWhich template?');
35
- for (let i = 0; i < TEMPLATES.length; i++) {
36
- const t = TEMPLATES[i];
37
- const marker = i === 0 ? '❯' : ' ';
38
- console.log(` ${marker} ${(i + 1).toString()}) ${t.padEnd(16)} — ${TEMPLATE_DESCRIPTIONS[t]}`);
39
- }
40
- const answer = await prompt('\nEnter number or name [1]: ');
41
- if (!answer || answer === '1')
42
- return 'minimal';
43
- const num = parseInt(answer, 10);
44
- if (!Number.isNaN(num) && num >= 1 && num <= TEMPLATES.length) {
45
- return TEMPLATES[num - 1];
46
- }
47
- const matched = TEMPLATES.find(t => t === answer);
48
- if (matched)
49
- return matched;
50
- console.error(`Unknown template: "${answer}". Using "minimal".`);
51
- return 'minimal';
52
- }
53
- async function main() {
54
- const args = process.argv.slice(2);
55
- let projectName = '';
56
- let templateArg = null;
57
- let force = false;
58
- for (let i = 0; i < args.length; i++) {
59
- const arg = args[i];
60
- if (arg === '--template' || arg === '-t') {
61
- templateArg = args[++i] ?? null;
62
- }
63
- else if (arg === '--force' || arg === '-f') {
64
- force = true;
65
- }
66
- else if (!arg.startsWith('-')) {
67
- projectName = arg;
68
- }
69
- }
70
- if (!projectName) {
71
- if (!isInteractive()) {
72
- console.error('Error: project name is required in non-interactive mode.');
73
- console.error('Usage: create-exo-app <project-name> [--template minimal|game-starter|audio-reactive]');
74
- process.exit(1);
75
- }
76
- projectName = await promptProjectName();
77
- }
78
- let template;
79
- if (templateArg !== null) {
80
- if (!TEMPLATES.includes(templateArg)) {
81
- console.error(`Error: unknown template "${templateArg}".`);
82
- console.error(`Valid templates: ${TEMPLATES.join(', ')}`);
83
- process.exit(1);
84
- }
85
- template = templateArg;
86
- }
87
- else if (isInteractive()) {
88
- template = await promptTemplate();
89
- }
90
- else {
91
- template = 'minimal';
92
- }
93
- const destDir = resolve(process.cwd(), projectName);
94
- if (existsSync(destDir)) {
95
- const entries = readdirSync(destDir);
96
- if (entries.length > 0 && !force) {
97
- console.error(`Error: directory "${projectName}" already exists and is not empty.`);
98
- console.error('Use --force to overwrite.');
99
- process.exit(1);
100
- }
101
- }
102
- // Locate templates relative to dist/index.js (one level up)
103
- const templateDir = join(__dirname, '..', 'templates', template);
104
- mkdirSync(destDir, { recursive: true });
105
- cpSync(templateDir, destDir, { recursive: true });
106
- // Set package name to the project directory's basename
107
- const pkgPath = join(destDir, 'package.json');
108
- const pkgContent = readFileSync(pkgPath, 'utf-8');
109
- const pkgJson = JSON.parse(pkgContent);
110
- pkgJson['name'] = basename(projectName);
111
- writeFileSync(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
112
- console.log(`\nDone.\n`);
113
- console.log(`Next steps:`);
114
- console.log(` cd ${projectName}`);
115
- console.log(` npm install`);
116
- console.log(` npm run dev`);
117
- console.log('');
118
- }
119
- main().catch((err) => {
2
+ import { runScaffolder } from './scaffold.js';
3
+ runScaffolder(process.argv.slice(2)).catch((err) => {
120
4
  console.error('Error:', err instanceof Error ? err.message : String(err));
121
5
  process.exit(1);
122
6
  });
@@ -0,0 +1,44 @@
1
+ /** Template names in the order the interactive picker lists them; the first is the default. */
2
+ export declare const TEMPLATES: readonly ['minimal', 'game-starter', 'platformer', 'top-down', 'ui-app', 'audio-reactive'];
3
+ export type TemplateName = (typeof TEMPLATES)[number];
4
+ /** One-line summary per template, as shown by the interactive picker. */
5
+ export declare const TEMPLATE_DESCRIPTIONS: Record<TemplateName, string>;
6
+ /** Absolute path of a template's source directory inside this package. */
7
+ export declare const templateDirectory: (template: TemplateName) => string;
8
+ /** What {@link scaffoldApp} needs: where to write, which template, and whether a non-empty target is allowed. */
9
+ export interface ScaffoldOptions {
10
+ /** Project directory, resolved against the current working directory. */
11
+ readonly projectName: string;
12
+ readonly template: TemplateName;
13
+ /** Overwrite into a directory that already has files in it. */
14
+ readonly force?: boolean;
15
+ }
16
+ /**
17
+ * Copy a template into `projectName` and set the generated `package.json` name
18
+ * to the target directory's basename.
19
+ *
20
+ * Every `@codexo/*` dependency is rewritten to this scaffolder's own release
21
+ * line. A template therefore never carries an engine version: the version that
22
+ * scaffolds the project is the version of the project, so `create-exo-app@0.19`
23
+ * always produces an app on `0.19.x` and a later `latest` never silently moves
24
+ * a generated project to a different engine API. That also keeps templates from
25
+ * needing an edit per release.
26
+ *
27
+ * Third-party tooling is left exactly as the template declares it - Vite,
28
+ * TypeScript and friends carry ordinary semver ranges and are not tied to the
29
+ * engine's release line.
30
+ *
31
+ * Exits the process with a message when the target exists, is not empty and
32
+ * `force` is not set.
33
+ *
34
+ * @returns The absolute path of the created project directory.
35
+ */
36
+ export declare const scaffoldApp: (options: ScaffoldOptions) => string;
37
+ /**
38
+ * Run the scaffolder end to end: parse `argv`, prompt for anything missing when
39
+ * attached to a TTY, copy the template and print the next steps.
40
+ *
41
+ * `argv` excludes the executable and script path. Exits the process on a usage
42
+ * error rather than throwing, so a caller does not have to translate one.
43
+ */
44
+ export declare const runScaffolder: (argv: readonly string[]) => Promise<void>;
@@ -0,0 +1,190 @@
1
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { basename, join, resolve } from 'node:path';
3
+ import { createInterface } from 'node:readline';
4
+ import { fileURLToPath } from 'node:url';
5
+ /**
6
+ * The scaffolder behind `npm create exo-app` and `exo create`.
7
+ *
8
+ * Both entry points call {@link runScaffolder}, so they cannot drift: there is
9
+ * one argument grammar, one prompt sequence and one set of templates, shipped
10
+ * in this package.
11
+ */
12
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
13
+ /** Template names in the order the interactive picker lists them; the first is the default. */
14
+ export const TEMPLATES = ['minimal', 'game-starter', 'platformer', 'top-down', 'ui-app', 'audio-reactive'];
15
+ /** One-line summary per template, as shown by the interactive picker. */
16
+ export const TEMPLATE_DESCRIPTIONS = {
17
+ minimal: 'smallest TypeScript ExoJS app with one Scene and one visible object',
18
+ 'game-starter': 'keyboard-controlled game loop starter with Scene structure',
19
+ platformer: 'side-scroller with physics bodies, camera follow and a forgiving jump',
20
+ 'top-down': 'tilemap, physics and click-to-move pathfinding, procedural or from Tiled',
21
+ 'ui-app': 'settings screen built from the UI widgets in core',
22
+ 'audio-reactive': 'AudioAnalyser-driven shapes and animations',
23
+ };
24
+ /** Absolute path of a template's source directory inside this package. */
25
+ export const templateDirectory = (template) => join(__dirname, '..', 'templates', template);
26
+ const isInteractive = () => {
27
+ return process.stdin.isTTY === true;
28
+ };
29
+ const prompt = (question) => {
30
+ return new Promise(resolve => {
31
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
32
+ rl.question(question, answer => {
33
+ rl.close();
34
+ resolve(answer.trim());
35
+ });
36
+ });
37
+ };
38
+ const promptProjectName = async () => {
39
+ const answer = await prompt('Project name: ');
40
+ if (!answer) {
41
+ console.error('Error: project name cannot be empty.');
42
+ process.exit(1);
43
+ }
44
+ return answer;
45
+ };
46
+ /**
47
+ * The engine range a generated project asks for. Read from this package's own
48
+ * manifest, so the version lives in exactly one place: the scaffolder's own
49
+ * `version`, which the release cut bumps alongside every engine package. A
50
+ * caret range on the minor keeps patch upgrades of the engine inside the same
51
+ * release line without floating the project onto the next minor.
52
+ */
53
+ const engineRange = () => {
54
+ const own = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
55
+ const match = /^(\d+)\.(\d+)\./.exec(own.version);
56
+ if (!match) {
57
+ throw new Error(`create-exo-app has an unparseable version "${own.version}"; expected <major>.<minor>.<patch>.`);
58
+ }
59
+ return `${match[1]}.${match[2]}.x`;
60
+ };
61
+ /** Rewrites every `@codexo/*` dependency in the manifest to the engine range. */
62
+ const pinEngineDependencies = (manifest) => {
63
+ const range = engineRange();
64
+ for (const bucket of ['dependencies', 'devDependencies']) {
65
+ const deps = manifest[bucket];
66
+ if (typeof deps !== 'object' || deps === null)
67
+ continue;
68
+ for (const [name, value] of Object.entries(deps)) {
69
+ if (!name.startsWith('@codexo/'))
70
+ continue;
71
+ if (typeof value !== 'string')
72
+ continue;
73
+ deps[name] = range;
74
+ }
75
+ }
76
+ };
77
+ const promptTemplate = async () => {
78
+ console.log('\nWhich template?');
79
+ TEMPLATES.forEach((t, i) => {
80
+ const marker = i === 0 ? '❯' : ' ';
81
+ console.log(` ${marker} ${(i + 1).toString()}) ${t.padEnd(16)} — ${TEMPLATE_DESCRIPTIONS[t]}`);
82
+ });
83
+ const answer = await prompt('\nEnter number or name [1]: ');
84
+ if (!answer || answer === '1')
85
+ return 'minimal';
86
+ const num = parseInt(answer, 10);
87
+ const byNumber = Number.isNaN(num) ? undefined : TEMPLATES[num - 1];
88
+ if (byNumber)
89
+ return byNumber;
90
+ const matched = TEMPLATES.find(t => t === answer);
91
+ if (matched)
92
+ return matched;
93
+ console.error(`Unknown template: "${answer}". Using "minimal".`);
94
+ return 'minimal';
95
+ };
96
+ /**
97
+ * Copy a template into `projectName` and set the generated `package.json` name
98
+ * to the target directory's basename.
99
+ *
100
+ * Every `@codexo/*` dependency is rewritten to this scaffolder's own release
101
+ * line. A template therefore never carries an engine version: the version that
102
+ * scaffolds the project is the version of the project, so `create-exo-app@0.19`
103
+ * always produces an app on `0.19.x` and a later `latest` never silently moves
104
+ * a generated project to a different engine API. That also keeps templates from
105
+ * needing an edit per release.
106
+ *
107
+ * Third-party tooling is left exactly as the template declares it - Vite,
108
+ * TypeScript and friends carry ordinary semver ranges and are not tied to the
109
+ * engine's release line.
110
+ *
111
+ * Exits the process with a message when the target exists, is not empty and
112
+ * `force` is not set.
113
+ *
114
+ * @returns The absolute path of the created project directory.
115
+ */
116
+ export const scaffoldApp = (options) => {
117
+ const { projectName, template, force = false } = options;
118
+ const destDir = resolve(process.cwd(), projectName);
119
+ if (existsSync(destDir)) {
120
+ const entries = readdirSync(destDir);
121
+ if (entries.length > 0 && !force) {
122
+ console.error(`Error: directory "${projectName}" already exists and is not empty.`);
123
+ console.error('Use --force to overwrite.');
124
+ process.exit(1);
125
+ }
126
+ }
127
+ mkdirSync(destDir, { recursive: true });
128
+ cpSync(templateDirectory(template), destDir, { recursive: true });
129
+ const pkgPath = join(destDir, 'package.json');
130
+ const pkgContent = readFileSync(pkgPath, 'utf-8');
131
+ const pkgJson = JSON.parse(pkgContent);
132
+ pkgJson.name = basename(projectName);
133
+ pinEngineDependencies(pkgJson);
134
+ writeFileSync(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
135
+ return destDir;
136
+ };
137
+ /**
138
+ * Run the scaffolder end to end: parse `argv`, prompt for anything missing when
139
+ * attached to a TTY, copy the template and print the next steps.
140
+ *
141
+ * `argv` excludes the executable and script path. Exits the process on a usage
142
+ * error rather than throwing, so a caller does not have to translate one.
143
+ */
144
+ export const runScaffolder = async (argv) => {
145
+ let projectName = '';
146
+ let templateArg = null;
147
+ let force = false;
148
+ for (let i = 0; i < argv.length; i++) {
149
+ const arg = argv[i] ?? '';
150
+ if (arg === '--template' || arg === '-t') {
151
+ templateArg = argv[++i] ?? null;
152
+ }
153
+ else if (arg === '--force' || arg === '-f') {
154
+ force = true;
155
+ }
156
+ else if (!arg.startsWith('-')) {
157
+ projectName = arg;
158
+ }
159
+ }
160
+ if (!projectName) {
161
+ if (!isInteractive()) {
162
+ console.error('Error: project name is required in non-interactive mode.');
163
+ console.error(`Usage: create-exo-app <project-name> [--template ${TEMPLATES.join('|')}]`);
164
+ process.exit(1);
165
+ }
166
+ projectName = await promptProjectName();
167
+ }
168
+ let template;
169
+ if (templateArg !== null) {
170
+ if (!TEMPLATES.includes(templateArg)) {
171
+ console.error(`Error: unknown template "${templateArg}".`);
172
+ console.error(`Valid templates: ${TEMPLATES.join(', ')}`);
173
+ process.exit(1);
174
+ }
175
+ template = templateArg;
176
+ }
177
+ else if (isInteractive()) {
178
+ template = await promptTemplate();
179
+ }
180
+ else {
181
+ template = 'minimal';
182
+ }
183
+ scaffoldApp({ projectName, template, force });
184
+ console.log(`\nDone.\n`);
185
+ console.log(`Next steps:`);
186
+ console.log(` cd ${projectName}`);
187
+ console.log(` npm install`);
188
+ console.log(` npm run dev`);
189
+ console.log('');
190
+ };
package/package.json CHANGED
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "name": "create-exo-app",
3
- "version": "0.1.0",
3
+ "version": "0.19.0",
4
4
  "description": "Official starter for ExoJS — scaffold a new app with npm create exo-app",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "sideEffects": false,
7
8
  "bin": {
8
- "create-exo-app": "./dist/index.js"
9
+ "create-exo-app": "./bin/create-exo-app.js"
10
+ },
11
+ "main": "./dist/scaffold.js",
12
+ "types": "./dist/scaffold.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/scaffold.d.ts",
16
+ "import": "./dist/scaffold.js",
17
+ "default": "./dist/scaffold.js"
18
+ },
19
+ "./package.json": "./package.json"
9
20
  },
10
21
  "files": [
22
+ "bin/",
11
23
  "dist/",
12
- "templates/"
24
+ "templates/",
25
+ "README.md",
26
+ "LICENSE"
13
27
  ],
14
28
  "publishConfig": {
15
29
  "access": "public"
@@ -20,13 +34,16 @@
20
34
  "url": "git+https://github.com/Exoridus/ExoJS.git"
21
35
  },
22
36
  "devDependencies": {
23
- "@types/node": "^25.6.0",
24
- "tsx": "^4.21.0",
25
- "typescript": "^6.0.3"
37
+ "@types/node": "^26.6.2",
38
+ "tsx": "^4.23.15",
39
+ "typescript": "~6.0.3"
40
+ },
41
+ "engines": {
42
+ "node": ">=24"
26
43
  },
27
44
  "scripts": {
28
- "build": "tsc && node --input-type=module --eval \"import{readFileSync,writeFileSync}from'node:fs';const f='dist/index.js';writeFileSync(f,'#!/usr/bin/env node\\n'+readFileSync(f,'utf-8'));\"",
29
- "dev": "tsc --watch",
45
+ "build": "exo-tsc && node --input-type=module --eval \"import{readFileSync,writeFileSync}from'node:fs';const f='dist/index.js';writeFileSync(f,'#!/usr/bin/env node\\n'+readFileSync(f,'utf-8'));\"",
46
+ "dev": "exo-tsc --watch",
30
47
  "start": "tsx src/index.ts"
31
48
  }
32
49
  }
@@ -1,12 +1,22 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>ExoJS Audio Reactive</title>
7
7
  <style>
8
- * { margin: 0; padding: 0; box-sizing: border-box; }
9
- body { background: #000; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+ body {
14
+ background: #000;
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ min-height: 100vh;
19
+ }
10
20
  </style>
11
21
  </head>
12
22
  <body>
@@ -2,16 +2,20 @@
2
2
  "name": "exo-audio-reactive",
3
3
  "version": "0.0.1",
4
4
  "type": "module",
5
+ "engines": {
6
+ "node": ">=24"
7
+ },
5
8
  "scripts": {
6
9
  "dev": "vite",
7
10
  "build": "tsc && vite build",
8
11
  "preview": "vite preview"
9
12
  },
10
13
  "dependencies": {
11
- "@codexo/exojs": "^0.12.0"
14
+ "@codexo/exojs": "lockstep",
15
+ "@codexo/exojs-audio-fx": "lockstep"
12
16
  },
13
17
  "devDependencies": {
14
- "typescript": "^5.8.0",
15
- "vite": "^6.0.0"
18
+ "typescript": "^7.0.2",
19
+ "vite": "^8.3.1"
16
20
  }
17
21
  }
@@ -1,14 +1,15 @@
1
1
  import { Application, Color } from '@codexo/exojs';
2
+
2
3
  import { AudioReactiveScene } from './scenes/AudioReactiveScene';
3
4
 
4
5
  const app = new Application({
6
+ scenes: { AudioReactiveScene },
5
7
  canvas: {
6
8
  width: 800,
7
9
  height: 600,
10
+ mount: 'body',
8
11
  },
9
12
  clearColor: new Color(8, 8, 16),
10
13
  });
11
14
 
12
- document.body.append(app.canvas);
13
-
14
- app.start(new AudioReactiveScene());
15
+ await app.start(AudioReactiveScene);
@@ -1,5 +1,6 @@
1
- import { AudioAnalyser, Color, getAudioContext, Graphics, Scene, Text } from '@codexo/exojs';
2
1
  import type { RenderingContext } from '@codexo/exojs';
2
+ import { Color, getAudioContext, Graphics, Scene, Text } from '@codexo/exojs';
3
+ import { AudioAnalyser } from '@codexo/exojs-audio-fx';
3
4
 
4
5
  const BAR_COUNT = 32;
5
6
 
@@ -31,7 +32,7 @@ export class AudioReactiveScene extends Scene {
31
32
  this._started = true;
32
33
  this._prompt.visible = false;
33
34
 
34
- // Use the shared audio context — the pointer gesture unlocks it.
35
+ // Use the shared audio context - the pointer gesture unlocks it.
35
36
  const ctx = getAudioContext();
36
37
 
37
38
  // Sawtooth oscillator as an always-on audio source for the analyser.
@@ -56,7 +57,6 @@ export class AudioReactiveScene extends Scene {
56
57
 
57
58
  public override draw(context: RenderingContext): void {
58
59
  const { width, height } = this.app!.canvas;
59
- context.backend.clear(new Color(8, 8, 16));
60
60
 
61
61
  if (this._started) {
62
62
  const spectrum = this._analyser.getSpectrum();
@@ -1,12 +1,22 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>ExoJS Game Starter</title>
7
7
  <style>
8
- * { margin: 0; padding: 0; box-sizing: border-box; }
9
- body { background: #000; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+ body {
14
+ background: #000;
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ min-height: 100vh;
19
+ }
10
20
  </style>
11
21
  </head>
12
22
  <body>
@@ -2,16 +2,19 @@
2
2
  "name": "exo-game",
3
3
  "version": "0.0.1",
4
4
  "type": "module",
5
+ "engines": {
6
+ "node": ">=24"
7
+ },
5
8
  "scripts": {
6
9
  "dev": "vite",
7
10
  "build": "tsc && vite build",
8
11
  "preview": "vite preview"
9
12
  },
10
13
  "dependencies": {
11
- "@codexo/exojs": "^0.12.0"
14
+ "@codexo/exojs": "lockstep"
12
15
  },
13
16
  "devDependencies": {
14
- "typescript": "^5.8.0",
15
- "vite": "^6.0.0"
17
+ "typescript": "^7.0.2",
18
+ "vite": "^8.3.1"
16
19
  }
17
20
  }
@@ -1,14 +1,16 @@
1
1
  import { Application, Color } from '@codexo/exojs';
2
+
3
+ import { GameOverScene } from './scenes/GameOverScene';
2
4
  import { GameScene } from './scenes/GameScene';
3
5
 
4
6
  const app = new Application({
7
+ scenes: { GameScene, GameOverScene },
5
8
  canvas: {
6
9
  width: 800,
7
10
  height: 600,
11
+ mount: 'body',
8
12
  },
9
13
  clearColor: new Color(18, 28, 48),
10
14
  });
11
15
 
12
- document.body.append(app.canvas);
13
-
14
- app.start(new GameScene());
16
+ await app.start(GameScene);