create-snappy 1.1.4 ā 1.1.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 +1 -1
- package/scripts/create-snappy/cli.js +12 -38
package/package.json
CHANGED
|
@@ -160,7 +160,7 @@ function getPackageManager() {
|
|
|
160
160
|
|
|
161
161
|
async function main() {
|
|
162
162
|
console.log(pc.cyan(SNAPPY_LOGO))
|
|
163
|
-
console.log(pc.cyan('š Welcome to the SNAPPY Stack Installer! (v1.1.
|
|
163
|
+
console.log(pc.cyan('š Welcome to the SNAPPY Stack Installer! (v1.1.5)'))
|
|
164
164
|
console.log('------------------------------------------')
|
|
165
165
|
|
|
166
166
|
const program = new Command()
|
|
@@ -398,47 +398,21 @@ async function main() {
|
|
|
398
398
|
|
|
399
399
|
try {
|
|
400
400
|
// 1. Initialize from repository
|
|
401
|
-
|
|
402
|
-
const
|
|
401
|
+
// 1. Initialize from repository
|
|
402
|
+
const repoUrl = 'https://github.com/Snappy-Stack/snappy'
|
|
403
|
+
const cloneSpinner = ora(`Cloning template (${selectedTemplate})...`).start()
|
|
403
404
|
|
|
404
405
|
try {
|
|
405
|
-
//
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
cloneSpinner.succeed('Project cloned successfully.')
|
|
411
|
-
} catch (publicErr) {
|
|
412
|
-
// If public fails, try with token
|
|
413
|
-
let token = getSavedToken()
|
|
414
|
-
|
|
415
|
-
if (!token) {
|
|
416
|
-
cloneSpinner.stop()
|
|
417
|
-
console.log(pc.yellow('\nš Access denied or repository is private. Please authenticate...'))
|
|
418
|
-
token = await githubLogin()
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
if (token) {
|
|
422
|
-
const authenticatedUrl = repoUrl.replace('https://', `https://x-access-token:${token}@`)
|
|
423
|
-
const retrySpinner = ora(`Cloning secure template (${selectedTemplate}) with authentication...`).start()
|
|
424
|
-
try {
|
|
425
|
-
execSync(`git clone --depth 1 -b ${selectedTemplate} ${authenticatedUrl} "${targetDir}"`, {
|
|
426
|
-
stdio: 'ignore',
|
|
427
|
-
})
|
|
428
|
-
retrySpinner.succeed('Project cloned successfully (authenticated).')
|
|
429
|
-
} catch (authErr) {
|
|
430
|
-
retrySpinner.fail('Authentication failed or repository inaccessible.')
|
|
431
|
-
throw authErr
|
|
432
|
-
}
|
|
433
|
-
} else {
|
|
434
|
-
throw new Error('No GitHub token available for private access.')
|
|
435
|
-
}
|
|
436
|
-
}
|
|
406
|
+
// Clean public clone only
|
|
407
|
+
execSync(`git clone --depth 1 -b ${selectedTemplate} ${repoUrl} "${targetDir}"`, {
|
|
408
|
+
stdio: 'ignore',
|
|
409
|
+
})
|
|
410
|
+
cloneSpinner.succeed('Project cloned successfully.')
|
|
437
411
|
} catch (err) {
|
|
438
|
-
|
|
412
|
+
cloneSpinner.stop()
|
|
439
413
|
console.error(pc.red("\nā Installation failed during project cloning."))
|
|
440
|
-
console.error(pc.gray(`
|
|
441
|
-
console.error(pc.gray(`
|
|
414
|
+
console.error(pc.gray(`Template: ${selectedTemplate}`))
|
|
415
|
+
console.error(pc.gray(`If this is a private template, ensure you have git access to the repository.`))
|
|
442
416
|
throw err
|
|
443
417
|
}
|
|
444
418
|
|