create-snappy 1.1.3 ā 1.1.4
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 +26 -21
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.4)'))
|
|
164
164
|
console.log('------------------------------------------')
|
|
165
165
|
|
|
166
166
|
const program = new Command()
|
|
@@ -402,38 +402,43 @@ async function main() {
|
|
|
402
402
|
const cloneSpinner = ora(`Cloning secure template (${selectedTemplate})...`).start()
|
|
403
403
|
|
|
404
404
|
try {
|
|
405
|
-
// Try public clone first
|
|
405
|
+
// Try public clone first
|
|
406
406
|
try {
|
|
407
407
|
execSync(`git clone --depth 1 -b ${selectedTemplate} ${repoUrl} "${targetDir}"`, {
|
|
408
408
|
stdio: 'ignore',
|
|
409
409
|
})
|
|
410
|
-
cloneSpinner.succeed('Project cloned successfully
|
|
410
|
+
cloneSpinner.succeed('Project cloned successfully.')
|
|
411
411
|
} catch (publicErr) {
|
|
412
412
|
// If public fails, try with token
|
|
413
|
-
|
|
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
|
+
|
|
414
421
|
if (token) {
|
|
415
422
|
const authenticatedUrl = repoUrl.replace('https://', `https://x-access-token:${token}@`)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
+
}
|
|
420
433
|
} else {
|
|
421
|
-
|
|
422
|
-
cloneSpinner.stop()
|
|
423
|
-
console.log(pc.yellow('\nš This template might be private. Please authenticate...'))
|
|
424
|
-
const newToken = await githubLogin()
|
|
425
|
-
const authenticatedUrl = repoUrl.replace('https://', `https://x-access-token:${newToken}@`)
|
|
426
|
-
const retrySpinner = ora(`Cloning secure template (${selectedTemplate})...`).start()
|
|
427
|
-
execSync(`git clone --depth 1 -b ${selectedTemplate} ${authenticatedUrl} "${targetDir}"`, {
|
|
428
|
-
stdio: 'ignore',
|
|
429
|
-
})
|
|
430
|
-
retrySpinner.succeed('Project cloned successfully.')
|
|
434
|
+
throw new Error('No GitHub token available for private access.')
|
|
431
435
|
}
|
|
432
436
|
}
|
|
433
437
|
} catch (err) {
|
|
434
|
-
cloneSpinner.stop()
|
|
435
|
-
console.error(pc.red("\nā
|
|
436
|
-
console.error(pc.gray(`
|
|
438
|
+
if (cloneSpinner.isSpinning) cloneSpinner.stop()
|
|
439
|
+
console.error(pc.red("\nā Installation failed during project cloning."))
|
|
440
|
+
console.error(pc.gray(`Target Template: ${selectedTemplate}`))
|
|
441
|
+
console.error(pc.gray(`Source Repository: ${repoUrl}`))
|
|
437
442
|
throw err
|
|
438
443
|
}
|
|
439
444
|
|