create-skateboard-app 1.0.0 → 1.0.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/bin/cli.js +38 -66
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -47,35 +47,41 @@ function checkCommand(command) {
|
|
|
47
47
|
async function downloadTemplate(projectName) {
|
|
48
48
|
// Try multiple methods in order of preference
|
|
49
49
|
const methods = [
|
|
50
|
-
{
|
|
51
|
-
name: 'degit',
|
|
52
|
-
check: () => checkCommand('npx'),
|
|
53
|
-
execute: () => execSync(`npx degit stevederico/skateboard ${projectName}`, {
|
|
54
|
-
stdio: 'pipe',
|
|
55
|
-
timeout: 30000
|
|
56
|
-
})
|
|
57
|
-
},
|
|
58
50
|
{
|
|
59
51
|
name: 'git clone',
|
|
60
52
|
check: () => checkCommand('git'),
|
|
61
53
|
execute: () => {
|
|
62
|
-
execSync(`git clone --depth 1 https://github.com/stevederico/skateboard.git ${projectName}`, {
|
|
54
|
+
execSync(`git clone --depth 1 --single-branch https://github.com/stevederico/skateboard.git ${projectName}`, {
|
|
63
55
|
stdio: 'pipe',
|
|
64
|
-
timeout:
|
|
56
|
+
timeout: 15000
|
|
65
57
|
});
|
|
66
58
|
// Remove .git directory to avoid including git history
|
|
67
59
|
execSync(`rm -rf ${projectName}/.git`, { stdio: 'pipe' });
|
|
68
60
|
}
|
|
69
61
|
},
|
|
62
|
+
{
|
|
63
|
+
name: 'curl + tar',
|
|
64
|
+
check: () => checkCommand('curl') && checkCommand('tar'),
|
|
65
|
+
execute: () => {
|
|
66
|
+
// Download and extract in one step, avoiding the skateboard-master folder issue
|
|
67
|
+
execSync(`curl -L https://github.com/stevederico/skateboard/archive/refs/heads/master.tar.gz | tar -xz`, {
|
|
68
|
+
stdio: 'pipe',
|
|
69
|
+
timeout: 15000
|
|
70
|
+
});
|
|
71
|
+
// Move contents from skateboard-master to the project directory
|
|
72
|
+
execSync(`mv skateboard-master ${projectName}`, { stdio: 'pipe' });
|
|
73
|
+
}
|
|
74
|
+
},
|
|
70
75
|
{
|
|
71
76
|
name: 'curl + unzip',
|
|
72
77
|
check: () => checkCommand('curl') && checkCommand('unzip'),
|
|
73
78
|
execute: () => {
|
|
74
79
|
execSync(`curl -L https://github.com/stevederico/skateboard/archive/refs/heads/master.zip -o temp.zip`, {
|
|
75
80
|
stdio: 'pipe',
|
|
76
|
-
timeout:
|
|
81
|
+
timeout: 15000
|
|
77
82
|
});
|
|
78
83
|
execSync(`unzip -q temp.zip`, { stdio: 'pipe' });
|
|
84
|
+
// Move the extracted skateboard-master folder to the project name
|
|
79
85
|
execSync(`mv skateboard-master ${projectName}`, { stdio: 'pipe' });
|
|
80
86
|
execSync(`rm temp.zip`, { stdio: 'pipe' });
|
|
81
87
|
}
|
|
@@ -89,16 +95,16 @@ async function downloadTemplate(projectName) {
|
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
try {
|
|
92
|
-
info(`
|
|
98
|
+
info(`Downloading template with ${method.name}...`);
|
|
93
99
|
method.execute();
|
|
94
|
-
success(`Template downloaded
|
|
100
|
+
success(`Template downloaded successfully`);
|
|
95
101
|
return;
|
|
96
102
|
} catch (err) {
|
|
97
103
|
log(`${method.name} failed, trying next method...`, 'yellow');
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
|
|
101
|
-
throw new Error('All download methods failed. Please ensure you have git
|
|
107
|
+
throw new Error('All download methods failed. Please ensure you have git or curl available and check your internet connection.');
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
// Interactive prompt functions
|
|
@@ -181,7 +187,7 @@ async function collectProjectConfig(projectName) {
|
|
|
181
187
|
log(`\n${colors.bold}Let's configure your Skateboard app!${colors.reset}\n`);
|
|
182
188
|
|
|
183
189
|
// App name
|
|
184
|
-
const appName = await ask('App name', projectName.split('-').map(word =>
|
|
190
|
+
const appName = await ask('App display name', projectName.split('-').map(word =>
|
|
185
191
|
word.charAt(0).toUpperCase() + word.slice(1)
|
|
186
192
|
).join(' '));
|
|
187
193
|
|
|
@@ -216,42 +222,14 @@ async function collectProjectConfig(projectName) {
|
|
|
216
222
|
|
|
217
223
|
const selectedIcon = await askChoice('Choose an app icon:', iconChoices);
|
|
218
224
|
|
|
219
|
-
//
|
|
220
|
-
const backendURL =
|
|
221
|
-
const devBackendURL =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const addDefaultPages = await askYesNo('Add default pages (Home, Other)?', true);
|
|
228
|
-
if (addDefaultPages) {
|
|
229
|
-
pages.push(
|
|
230
|
-
{ title: 'Home', url: 'home', icon: 'house' },
|
|
231
|
-
{ title: 'Other', url: 'other', icon: 'inbox' }
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const addMorePages = await askYesNo('Add more custom pages?', false);
|
|
236
|
-
if (addMorePages) {
|
|
237
|
-
let addAnother = true;
|
|
238
|
-
while (addAnother) {
|
|
239
|
-
const pageTitle = await ask('Page title');
|
|
240
|
-
const pageUrl = await ask('Page URL', pageTitle.toLowerCase().replace(/\s+/g, '-'));
|
|
241
|
-
const pageIcon = await ask('Page icon (lucide icon name)', 'circle');
|
|
242
|
-
|
|
243
|
-
pages.push({
|
|
244
|
-
title: pageTitle,
|
|
245
|
-
url: pageUrl,
|
|
246
|
-
icon: pageIcon
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
addAnother = await askYesNo('Add another page?', false);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Company name (after pages configuration)
|
|
254
|
-
const companyName = await ask('Company name', 'Your Company');
|
|
225
|
+
// Default values for removed questions
|
|
226
|
+
const backendURL = 'https://api.example.com';
|
|
227
|
+
const devBackendURL = 'http://localhost:8000';
|
|
228
|
+
const companyName = 'Your Company';
|
|
229
|
+
const pages = [
|
|
230
|
+
{ title: 'Home', url: 'home', icon: 'house' },
|
|
231
|
+
{ title: 'Other', url: 'other', icon: 'inbox' }
|
|
232
|
+
];
|
|
255
233
|
|
|
256
234
|
// Installation preferences
|
|
257
235
|
const installDeps = await askYesNo('Install dependencies automatically?', true);
|
|
@@ -316,7 +294,7 @@ async function main() {
|
|
|
316
294
|
// If no project name provided, ask for it
|
|
317
295
|
if (!projectName) {
|
|
318
296
|
log(`\n${colors.bold}🛹 Welcome to Skateboard App Creator!${colors.reset}\n`);
|
|
319
|
-
projectName = await ask('
|
|
297
|
+
projectName = await ask('Project directory name', 'my-skateboard-app');
|
|
320
298
|
}
|
|
321
299
|
|
|
322
300
|
// Validate project name
|
|
@@ -397,25 +375,19 @@ async function main() {
|
|
|
397
375
|
// Success message
|
|
398
376
|
log(`\n${colors.bold}${colors.green}🎉 Success! Created ${config.appName}${colors.reset}\n`);
|
|
399
377
|
|
|
400
|
-
// Change to the new project directory
|
|
401
|
-
process.chdir(projectName);
|
|
402
|
-
info(`Switched to ${projectName} directory`);
|
|
403
|
-
|
|
404
|
-
log('Next steps:', 'yellow');
|
|
405
|
-
if (!config.installDeps) {
|
|
406
|
-
log(` npm install`);
|
|
407
|
-
}
|
|
408
|
-
log(` npm run dev`);
|
|
409
378
|
log(`\n${colors.cyan}Your app is configured with:${colors.reset}`);
|
|
410
|
-
log(` 🏢 Company: ${config.companyName}`);
|
|
411
379
|
log(` 📱 App: ${config.appName}`);
|
|
412
380
|
log(` 💬 Tagline: ${config.tagline}`);
|
|
413
381
|
log(` 🎨 Color: ${config.appColor}`);
|
|
414
382
|
log(` 🎯 Icon: ${config.appIcon}`);
|
|
415
|
-
|
|
416
|
-
log(
|
|
417
|
-
log(`\n${colors.
|
|
418
|
-
|
|
383
|
+
|
|
384
|
+
log(`\n${colors.bold}Get started with:${colors.reset}`, 'yellow');
|
|
385
|
+
log(`\n ${colors.cyan}cd ${projectName}${colors.reset}`);
|
|
386
|
+
if (!config.installDeps) {
|
|
387
|
+
log(` ${colors.cyan}npm install${colors.reset}`);
|
|
388
|
+
}
|
|
389
|
+
log(` ${colors.cyan}npm run start${colors.reset}`);
|
|
390
|
+
log(`\n${colors.yellow}Happy coding! 🛹${colors.reset}\n`);
|
|
419
391
|
|
|
420
392
|
} catch (err) {
|
|
421
393
|
error(`Failed to create project: ${err.message}`);
|