create-remix-game 1.0.9 → 1.1.2

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
@@ -6,29 +6,51 @@ import { initGitRepo } from './git.js';
6
6
  import { installDependencies, installLatestPackages } from './install.js';
7
7
  import { scaffold } from './scaffold.js';
8
8
  async function main() {
9
- console.log(chalk.bold.blue('\nšŸŽ® Create Remix Game\n'));
9
+ console.log(chalk.greenBright(`
10
+
11
+
12
+
13
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
14
+ ā–’ā–’ ā–’ā–’ ā–’ā–’ ā–’ā–’
15
+ ā–’ā–’ ā–’ā–’ ā–’ā–’ ā–’ā–’
16
+ ā–’ā–’ ā–’ā–’ ā–’ā–’ ā–’ā–’
17
+ ā–’ā–’ ā–’ā–’ ā–’ā–’ ā–’ā–’
18
+ ā–’ā–’ ā–’ā–’ ā–’ā–’ ā–’ā–’
19
+ ā–’ā–’ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ ā–’ā–’
20
+ ā–’ā–’ ā–’ā–’
21
+ ā–’ā–’ ā–’ā–’
22
+ ā–’ā–’ ā–’ā–’
23
+ ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’
24
+ ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’
25
+ ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’
26
+ ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’ā–’ā–’ ā–’ā–’
27
+ ā–’ā–’ ā–’ā–’
28
+ ā–’ā–’ ā–’ā–’
29
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
30
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
31
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
32
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
33
+ ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’ā–’
34
+
35
+
36
+
37
+ `));
10
38
  const args = process.argv.slice(2);
11
- let targetDir = args[0];
39
+ const targetDir = args[0];
12
40
  // Get project configuration
13
41
  const config = await prompts([
14
42
  {
15
- type: targetDir ? null : 'text',
16
- name: 'projectName',
17
- message: 'Project name:',
18
- initial: 'my-remix-game',
43
+ type: 'text',
44
+ name: 'gameName',
45
+ message: 'Game name:',
46
+ initial: 'My Remix Game',
19
47
  validate: (name) => {
20
- if (!/^[a-z0-9-_]+$/i.test(name)) {
21
- return 'Project name can only contain letters, numbers, dashes, and underscores';
48
+ if (!name || name.trim().length === 0) {
49
+ return 'Game name is required';
22
50
  }
23
51
  return true;
24
52
  },
25
53
  },
26
- {
27
- type: 'text',
28
- name: 'gameName',
29
- message: 'Game display name:',
30
- initial: 'My Remix Game',
31
- },
32
54
  {
33
55
  type: 'confirm',
34
56
  name: 'multiplayer',
@@ -63,13 +85,21 @@ async function main() {
63
85
  console.log('Cancelled');
64
86
  process.exit(0);
65
87
  }
66
- targetDir = targetDir || config.projectName;
67
- const projectPath = path.resolve(process.cwd(), targetDir);
88
+ // Generate a safe package name from the game name
89
+ const projectName = targetDir ||
90
+ config.gameName
91
+ .toLowerCase()
92
+ .replace(/[^a-z0-9]+/g, '-')
93
+ .replace(/^-+|-+$/g, '');
94
+ const projectPath = path.resolve(process.cwd(), projectName);
68
95
  console.log(chalk.cyan(`\nāœ“ Creating project in ${projectPath}`));
69
96
  // Scaffold the project
70
- await scaffold(projectPath, config);
97
+ await scaffold(projectPath, {
98
+ ...config,
99
+ projectName,
100
+ });
71
101
  // Install dependencies
72
- console.log(chalk.cyan('\nāœ“ Installing dependencies...'));
102
+ console.log(chalk.cyan('āœ“ Installing dependencies...'));
73
103
  await installDependencies(projectPath, config.packageManager);
74
104
  // Install packages that need @latest (0.x versions, etc.)
75
105
  await installLatestPackages(projectPath, config.packageManager, ['@farcade/game-sdk@latest']);
@@ -77,10 +107,11 @@ async function main() {
77
107
  if (config.initGit) {
78
108
  await initGitRepo(projectPath);
79
109
  }
80
- console.log(chalk.bold.green('\nāœ… Done!\n'));
110
+ console.log(chalk.bold.green('\nšŸŽ‰ Done!\n'));
81
111
  console.log('Get started with:\n');
82
- console.log(chalk.cyan(` cd ${targetDir}`));
83
- console.log(chalk.cyan(` ${config.packageManager} dev\n`));
112
+ console.log(chalk.cyan(` cd ${projectName}`));
113
+ const devCommand = config.packageManager === 'npm' ? 'npm run dev' : `${config.packageManager} dev`;
114
+ console.log(chalk.cyan(` ${devCommand}\n`));
84
115
  }
85
116
  main().catch((error) => {
86
117
  console.error(chalk.red('Error creating project:'), error);
package/dist/install.js CHANGED
@@ -6,11 +6,17 @@ export async function installDependencies(projectPath, packageManager) {
6
6
  const args = packageManager === 'yarn' ? [] : ['install'];
7
7
  const child = spawn(command, args, {
8
8
  cwd: projectPath,
9
- stdio: 'inherit',
9
+ stdio: 'pipe',
10
10
  shell: true,
11
11
  });
12
+ let errorOutput = '';
13
+ child.stderr?.on('data', (data) => {
14
+ errorOutput += data.toString();
15
+ });
12
16
  child.on('close', (code) => {
13
17
  if (code !== 0) {
18
+ console.error(chalk.red('\nāœ— Installation failed:'));
19
+ console.error(errorOutput);
14
20
  reject(new Error(`${packageManager} install failed with code ${code}`));
15
21
  }
16
22
  else {
@@ -34,14 +40,19 @@ export async function installLatestPackages(projectPath, packageManager, package
34
40
  const command = packageManager === 'yarn' ? 'yarn' : packageManager;
35
41
  const addCmd = packageManager === 'yarn' ? 'add' : packageManager === 'pnpm' ? 'add' : 'install';
36
42
  const args = packageManager === 'yarn' ? [addCmd, '-D', ...packages] : [addCmd, '-D', ...packages];
37
- console.log(chalk.cyan(`āœ“ Installing latest versions: ${packages.join(', ')}`));
38
43
  const child = spawn(command, args, {
39
44
  cwd: projectPath,
40
- stdio: 'inherit',
45
+ stdio: 'pipe',
41
46
  shell: true,
42
47
  });
48
+ let errorOutput = '';
49
+ child.stderr?.on('data', (data) => {
50
+ errorOutput += data.toString();
51
+ });
43
52
  child.on('close', (code) => {
44
53
  if (code !== 0) {
54
+ console.error(chalk.red('\nāœ— Failed to install latest packages:'));
55
+ console.error(errorOutput);
45
56
  reject(new Error(`Failed to install ${packages.join(', ')}`));
46
57
  }
47
58
  else {
package/dist/scaffold.js CHANGED
@@ -7,11 +7,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  function getRemixDevVersion() {
8
8
  try {
9
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
10
+ // In production (compiled): __dirname is dist, so go up to packages/create-remix-game/dist -> packages/@insidethesim|remix-dev
11
+ // In dev/test: __dirname is src, so go up to packages/create-remix-game/src -> packages/@insidethesim|remix-dev
12
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
13
+ path.join(__dirname, '../../@insidethesim|remix-dev/package.json'), // From src or dist
14
+ path.join(__dirname, '../../../@insidethesim|remix-dev/package.json'), // From nested dir
15
15
  ];
16
16
  for (const packageJsonPath of possiblePaths) {
17
17
  if (fs.existsSync(packageJsonPath)) {
@@ -28,7 +28,6 @@ function getRemixDevVersion() {
28
28
  // Fallback: Use CLI's own version (they're synced, so this works)
29
29
  const cliPackageJsonPath = path.join(__dirname, '../package.json');
30
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
31
  return cliPackageJson.version;
33
32
  }
34
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-remix-game",
3
- "version": "1.0.9",
3
+ "version": "1.1.2",
4
4
  "description": "CLI for scaffolding Remix games",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",