create-remix-game 1.0.6 → 1.0.9

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/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import chalk from 'chalk';
3
3
  import path from 'path';
4
4
  import prompts from 'prompts';
5
5
  import { initGitRepo } from './git.js';
6
- import { installDependencies } from './install.js';
6
+ import { installDependencies, installLatestPackages } from './install.js';
7
7
  import { scaffold } from './scaffold.js';
8
8
  async function main() {
9
9
  console.log(chalk.bold.blue('\nšŸŽ® Create Remix Game\n'));
@@ -71,6 +71,8 @@ async function main() {
71
71
  // Install dependencies
72
72
  console.log(chalk.cyan('\nāœ“ Installing dependencies...'));
73
73
  await installDependencies(projectPath, config.packageManager);
74
+ // Install packages that need @latest (0.x versions, etc.)
75
+ await installLatestPackages(projectPath, config.packageManager, ['@farcade/game-sdk@latest']);
74
76
  // Initialize git
75
77
  if (config.initGit) {
76
78
  await initGitRepo(projectPath);
package/dist/install.d.ts CHANGED
@@ -1 +1,6 @@
1
1
  export declare function installDependencies(projectPath: string, packageManager: string): Promise<void>;
2
+ /**
3
+ * Install additional packages that need to be at @latest
4
+ * (e.g., 0.x versions that won't auto-update with caret ranges)
5
+ */
6
+ export declare function installLatestPackages(projectPath: string, packageManager: string, packages: string[]): Promise<void>;
package/dist/install.js CHANGED
@@ -23,3 +23,34 @@ export async function installDependencies(projectPath, packageManager) {
23
23
  });
24
24
  });
25
25
  }
26
+ /**
27
+ * Install additional packages that need to be at @latest
28
+ * (e.g., 0.x versions that won't auto-update with caret ranges)
29
+ */
30
+ export async function installLatestPackages(projectPath, packageManager, packages) {
31
+ if (packages.length === 0)
32
+ return;
33
+ return new Promise((resolve, reject) => {
34
+ const command = packageManager === 'yarn' ? 'yarn' : packageManager;
35
+ const addCmd = packageManager === 'yarn' ? 'add' : packageManager === 'pnpm' ? 'add' : 'install';
36
+ const args = packageManager === 'yarn' ? [addCmd, '-D', ...packages] : [addCmd, '-D', ...packages];
37
+ console.log(chalk.cyan(`āœ“ Installing latest versions: ${packages.join(', ')}`));
38
+ const child = spawn(command, args, {
39
+ cwd: projectPath,
40
+ stdio: 'inherit',
41
+ shell: true,
42
+ });
43
+ child.on('close', (code) => {
44
+ if (code !== 0) {
45
+ reject(new Error(`Failed to install ${packages.join(', ')}`));
46
+ }
47
+ else {
48
+ console.log(chalk.cyan('āœ“ Latest packages installed'));
49
+ resolve();
50
+ }
51
+ });
52
+ child.on('error', (error) => {
53
+ reject(error);
54
+ });
55
+ });
56
+ }
package/dist/scaffold.js CHANGED
@@ -3,6 +3,35 @@ import fs from 'fs-extra';
3
3
  import path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ // Get the published remix-dev version to inject into template
7
+ function getRemixDevVersion() {
8
+ try {
9
+ // Try multiple paths to find remix-dev package.json
10
+ // In production (compiled): __dirname is dist, so go up to packages/remix-game/dist -> packages/remix-dev
11
+ // In dev/test: __dirname is src, so go up to packages/remix-game/src -> packages/remix-dev
12
+ const possiblePaths = [
13
+ path.join(__dirname, '../../remix-dev/package.json'), // From src or dist
14
+ path.join(__dirname, '../../../remix-dev/package.json'), // From nested dir
15
+ ];
16
+ for (const packageJsonPath of possiblePaths) {
17
+ if (fs.existsSync(packageJsonPath)) {
18
+ const content = fs.readFileSync(packageJsonPath, 'utf-8');
19
+ if (content) {
20
+ const packageJson = JSON.parse(content);
21
+ return packageJson.version;
22
+ }
23
+ }
24
+ }
25
+ throw new Error('Could not find remix-dev package.json');
26
+ }
27
+ catch (error) {
28
+ // Fallback: Use CLI's own version (they're synced, so this works)
29
+ const cliPackageJsonPath = path.join(__dirname, '../package.json');
30
+ const cliPackageJson = JSON.parse(fs.readFileSync(cliPackageJsonPath, 'utf-8'));
31
+ console.warn('Could not read remix-dev version, using CLI version as fallback:', cliPackageJson.version);
32
+ return cliPackageJson.version;
33
+ }
34
+ }
6
35
  export async function scaffold(targetPath, config) {
7
36
  const templateBase = path.join(__dirname, '../templates/base');
8
37
  // Ensure target directory doesn't exist or is empty
@@ -35,19 +64,18 @@ async function processTemplates(targetPath, config) {
35
64
  'README.md.template',
36
65
  'index.html.template',
37
66
  ];
67
+ // Get remix-dev version for dependency injection
68
+ const remixDevVersion = config.useLocalDeps ? 'workspace:*' : `^${getRemixDevVersion()}`;
38
69
  for (const templateFile of templateFiles) {
39
70
  const filePath = path.join(targetPath, templateFile);
40
71
  const content = await fs.readFile(filePath, 'utf-8');
41
72
  // Replace template variables
42
- let processed = content
73
+ const processed = content
43
74
  .replace(/\{\{GAME_NAME\}\}/g, config.gameName)
44
75
  .replace(/\{\{PROJECT_NAME\}\}/g, config.projectName)
45
76
  .replace(/\{\{MULTIPLAYER\}\}/g, String(config.multiplayer))
46
- .replace(/\{\{PACKAGE_MANAGER\}\}/g, config.packageManager);
47
- // If using local deps and this is package.json, replace version with workspace:*
48
- if (config.useLocalDeps && templateFile === 'package.json.template') {
49
- processed = processed.replace('"@insidethesim/remix-dev": "^1.0.2"', '"@insidethesim/remix-dev": "workspace:*"');
50
- }
77
+ .replace(/\{\{PACKAGE_MANAGER\}\}/g, config.packageManager)
78
+ .replace(/\{\{REMIX_DEV_VERSION\}\}/g, remixDevVersion);
51
79
  // Write to actual file (remove .template)
52
80
  const outputPath = filePath.replace('.template', '');
53
81
  await fs.writeFile(outputPath, processed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-remix-game",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "CLI for scaffolding Remix games",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "@types/fs-extra": "^11.0.4",
31
31
  "@types/node": "^22.18.6",
32
32
  "@types/prompts": "^2.4.9",
33
- "typescript": "^5.9.2"
33
+ "typescript": "^5.9.3"
34
34
  },
35
35
  "scripts": {
36
36
  "dev": "tsc --watch",
@@ -17,10 +17,9 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "devDependencies": {
20
- "@farcade/game-sdk": "^0.2",
21
- "@insidethesim/remix-dev": "^1.0.2",
22
- "react": "19.2.0",
23
- "react-dom": "19.2.0",
20
+ "@insidethesim/remix-dev": "{{REMIX_DEV_VERSION}}",
21
+ "react": "^19.0.0",
22
+ "react-dom": "^19.0.0",
24
23
  "typescript": "^5.9.2",
25
24
  "vite": "^7.0.0"
26
25
  },