create-snappy 0.0.3 ā 0.0.5
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/package.json +22 -22
- package/scripts/create-snappy/cli.js +40 -85
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-snappy",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "The official installer for the SNAPPY stack.",
|
|
5
|
-
"main": "scripts/create-snappy/cli.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"create-snappy": "./scripts/create-snappy/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "create-snappy",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "The official installer for the SNAPPY stack.",
|
|
5
|
+
"main": "scripts/create-snappy/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-snappy": "./scripts/create-snappy/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"commander": "^14.0.3",
|
|
15
|
+
"ora": "^5.4.1",
|
|
16
|
+
"picocolors": "^1.1.1",
|
|
17
|
+
"prompts": "^2.4.2"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -195,13 +195,17 @@ async function main() {
|
|
|
195
195
|
.name('create-snappy')
|
|
196
196
|
.description('The official installer for the SNAPPY stack. (Private Access Required)')
|
|
197
197
|
.argument('[project-name]', 'Name of the project directory')
|
|
198
|
-
.option('-t, --template <
|
|
199
|
-
.option('--login', '
|
|
198
|
+
.option('-t, --template <type>', 'Template to use (e.g., portfolio)')
|
|
199
|
+
.option('--login', 'Login with GitHub')
|
|
200
200
|
.option('--guided', 'Force guided setup for environment variables')
|
|
201
|
+
.option('--license <key>', 'SNAPPY License Key')
|
|
202
|
+
.option('--name <name>', 'Project name')
|
|
203
|
+
.option('--description <desc>', 'Project description')
|
|
204
|
+
.option('--author <name>', 'Author name')
|
|
201
205
|
.parse(process.argv)
|
|
202
206
|
|
|
203
207
|
const options = program.opts()
|
|
204
|
-
let providedName = program.args[0]
|
|
208
|
+
let providedName = options.name || program.args[0]
|
|
205
209
|
|
|
206
210
|
if (options.login) {
|
|
207
211
|
try {
|
|
@@ -232,19 +236,23 @@ async function main() {
|
|
|
232
236
|
})
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
if (!options.description) {
|
|
240
|
+
questions.push({
|
|
241
|
+
type: 'text',
|
|
242
|
+
name: 'projectDescription',
|
|
243
|
+
message: 'Project description?',
|
|
244
|
+
initial: 'A fresh SNAPPY app',
|
|
245
|
+
})
|
|
246
|
+
}
|
|
241
247
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
if (!options.author) {
|
|
249
|
+
questions.push({
|
|
250
|
+
type: 'text',
|
|
251
|
+
name: 'authorName',
|
|
252
|
+
message: 'Author name?',
|
|
253
|
+
initial: savedConfig.authorName || 'Wicky',
|
|
254
|
+
})
|
|
255
|
+
}
|
|
248
256
|
|
|
249
257
|
if (!options.template) {
|
|
250
258
|
questions.push({
|
|
@@ -258,54 +266,18 @@ async function main() {
|
|
|
258
266
|
})
|
|
259
267
|
}
|
|
260
268
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// Guided Setup Questions
|
|
269
|
-
const needsGuided = options.guided || !hasSavedConfig
|
|
270
|
-
|
|
271
|
-
if (needsGuided) {
|
|
272
|
-
console.log(pc.yellow('\nš ļø Guided Setup: Please enter your infrastructure details.'))
|
|
273
|
-
console.log(pc.gray('These will be saved to ~/.snappy/config.json for future use.\n'))
|
|
274
|
-
|
|
275
|
-
questions.push(
|
|
276
|
-
{
|
|
277
|
-
type: 'text',
|
|
278
|
-
name: 's3Bucket',
|
|
279
|
-
message: 'R2/S3 Bucket Name?',
|
|
280
|
-
initial: savedConfig.s3Bucket || 'snappy-production',
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
type: 'text',
|
|
284
|
-
name: 's3Region',
|
|
285
|
-
message: 'R2/S3 Region?',
|
|
286
|
-
initial: savedConfig.s3Region || 'auto',
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
type: 'text',
|
|
290
|
-
name: 's3Endpoint',
|
|
291
|
-
message: 'R2/S3 Endpoint URL?',
|
|
292
|
-
initial: savedConfig.s3Endpoint || '',
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
type: 'password',
|
|
296
|
-
name: 's3AccessKey',
|
|
297
|
-
message: 'R2/S3 Access Key ID?',
|
|
298
|
-
initial: savedConfig.s3AccessKey || '',
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
type: 'password',
|
|
302
|
-
name: 's3SecretKey',
|
|
303
|
-
message: 'R2/S3 Secret Access Key?',
|
|
304
|
-
initial: savedConfig.s3SecretKey || '',
|
|
305
|
-
},
|
|
306
|
-
)
|
|
269
|
+
if (!options.license) {
|
|
270
|
+
questions.push({
|
|
271
|
+
type: 'password',
|
|
272
|
+
name: 'snappyLicenseKey',
|
|
273
|
+
message: 'SNAPPY License Key (leave blank for trial)?',
|
|
274
|
+
initial: savedConfig.snappyLicenseKey || '',
|
|
275
|
+
})
|
|
307
276
|
}
|
|
308
277
|
|
|
278
|
+
// Guided Setup: (Cloudflare R2 is now automated via Snappy Core)
|
|
279
|
+
const needsGuided = false;
|
|
280
|
+
|
|
309
281
|
const response = await prompts(questions, {
|
|
310
282
|
onCancel: () => {
|
|
311
283
|
console.log(pc.yellow('Installation cancelled.'))
|
|
@@ -316,13 +288,8 @@ async function main() {
|
|
|
316
288
|
// Merge responses with saved config
|
|
317
289
|
const config = {
|
|
318
290
|
...savedConfig,
|
|
319
|
-
authorName: response.authorName || savedConfig.authorName,
|
|
320
|
-
snappyLicenseKey: response.snappyLicenseKey || savedConfig.snappyLicenseKey,
|
|
321
|
-
s3Bucket: response.s3Bucket || savedConfig.s3Bucket,
|
|
322
|
-
s3Region: response.s3Region || savedConfig.s3Region,
|
|
323
|
-
s3Endpoint: response.s3Endpoint || savedConfig.s3Endpoint,
|
|
324
|
-
s3AccessKey: response.s3AccessKey || savedConfig.s3AccessKey,
|
|
325
|
-
s3SecretKey: response.s3SecretKey || savedConfig.s3SecretKey,
|
|
291
|
+
authorName: options.author || response.authorName || savedConfig.authorName,
|
|
292
|
+
snappyLicenseKey: options.license || response.snappyLicenseKey || savedConfig.snappyLicenseKey,
|
|
326
293
|
}
|
|
327
294
|
|
|
328
295
|
// Save if it was a guided session or forced
|
|
@@ -331,7 +298,7 @@ async function main() {
|
|
|
331
298
|
}
|
|
332
299
|
|
|
333
300
|
const projectName = providedName || response.projectName
|
|
334
|
-
const projectDescription = response.projectDescription
|
|
301
|
+
const projectDescription = options.description || response.projectDescription
|
|
335
302
|
const authorName = config.authorName
|
|
336
303
|
const selectedTemplate = options.template || response.template || 'portfolio'
|
|
337
304
|
|
|
@@ -449,7 +416,7 @@ async function main() {
|
|
|
449
416
|
|
|
450
417
|
// Update @snappy-stack/core to latest
|
|
451
418
|
if (pkg.dependencies['@snappy-stack/core']) {
|
|
452
|
-
pkg.dependencies['@snappy-stack/core'] = '^0.1.
|
|
419
|
+
pkg.dependencies['@snappy-stack/core'] = '^0.1.11';
|
|
453
420
|
}
|
|
454
421
|
|
|
455
422
|
// Fix all @lexical/* sub-dependencies
|
|
@@ -487,29 +454,17 @@ async function main() {
|
|
|
487
454
|
// 3. Configure .env
|
|
488
455
|
console.log('\nš ļø Configuring environment variables...')
|
|
489
456
|
|
|
490
|
-
const
|
|
491
|
-
const finalS3Endpoint = config.s3Endpoint
|
|
492
|
-
const finalS3AccessKey = config.s3AccessKey
|
|
493
|
-
const finalS3SecretKey = config.s3SecretKey
|
|
494
|
-
const finalS3Region = config.s3Region
|
|
457
|
+
const finalLicenseToken = config.snappyLicenseKey;
|
|
495
458
|
|
|
496
459
|
const payloadSecret = crypto.randomBytes(32).toString('hex')
|
|
497
460
|
|
|
498
|
-
|
|
461
|
+
let envContent = `# SNAPPY STACK - Zero-Config Environment
|
|
499
462
|
SNAPPY_LICENSE_TOKEN="${finalLicenseToken || ''}"
|
|
500
|
-
SNAPPY_API_URL
|
|
463
|
+
# SNAPPY_API_URL is hardcoded in @snappy-stack/core
|
|
501
464
|
|
|
502
465
|
# Payload CMS
|
|
503
466
|
PAYLOAD_SECRET="${payloadSecret}"
|
|
504
467
|
PUBLIC_FRONTEND_URL="http://localhost:3000"
|
|
505
|
-
|
|
506
|
-
# R2 Storage Configuration (Isolated via SNAPPY)
|
|
507
|
-
S3_BUCKET="${finalS3Bucket}"
|
|
508
|
-
NEXT_PUBLIC_S3_BUCKET="${finalS3Bucket}"
|
|
509
|
-
S3_REGION="${finalS3Region}"
|
|
510
|
-
S3_ENDPOINT="${finalS3Endpoint}"
|
|
511
|
-
S3_ACCESS_KEY_ID="${finalS3AccessKey}"
|
|
512
|
-
S3_SECRET_ACCESS_KEY="${finalS3SecretKey}"
|
|
513
468
|
`
|
|
514
469
|
fs.writeFileSync(path.join(targetDir, '.env'), envContent)
|
|
515
470
|
console.log(pc.green('ā
.env generated.\n'))
|