create-remix-game 1.1.0 ā 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 +52 -21
- package/dist/scaffold.js +0 -1
- package/package.json +1 -1
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.
|
|
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
|
-
|
|
39
|
+
const targetDir = args[0];
|
|
12
40
|
// Get project configuration
|
|
13
41
|
const config = await prompts([
|
|
14
42
|
{
|
|
15
|
-
type:
|
|
16
|
-
name: '
|
|
17
|
-
message: '
|
|
18
|
-
initial: '
|
|
43
|
+
type: 'text',
|
|
44
|
+
name: 'gameName',
|
|
45
|
+
message: 'Game name:',
|
|
46
|
+
initial: 'My Remix Game',
|
|
19
47
|
validate: (name) => {
|
|
20
|
-
if (
|
|
21
|
-
return '
|
|
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
|
-
|
|
67
|
-
const
|
|
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,
|
|
97
|
+
await scaffold(projectPath, {
|
|
98
|
+
...config,
|
|
99
|
+
projectName,
|
|
100
|
+
});
|
|
71
101
|
// Install dependencies
|
|
72
|
-
console.log(chalk.cyan('
|
|
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
|
|
110
|
+
console.log(chalk.bold.green('\nš Done!\n'));
|
|
81
111
|
console.log('Get started with:\n');
|
|
82
|
-
console.log(chalk.cyan(` cd ${
|
|
83
|
-
|
|
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/scaffold.js
CHANGED
|
@@ -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
|
}
|