@webhikers/cli 1.1.0 → 1.1.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webhikers/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI for creating and deploying webhikers projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -67,10 +67,33 @@ export async function createCommand(name) {
67
67
 
68
68
  // --- 2. Create GitHub repo from template ---
69
69
  console.log("Creating GitHub repo from template...");
70
+
71
+ // Create repo first (without --clone, to avoid race condition)
70
72
  run(
71
- `gh repo create ${GITHUB_ORG}/${name} --template ${TEMPLATE_REPO} --private --clone`
73
+ `gh repo create ${GITHUB_ORG}/${name} --template ${TEMPLATE_REPO} --private`
72
74
  );
73
75
 
76
+ // Wait for GitHub to finish creating the repo from template
77
+ console.log(" Waiting for GitHub to prepare the repository...");
78
+ const maxRetries = 12;
79
+ let cloned = false;
80
+ for (let i = 0; i < maxRetries; i++) {
81
+ await new Promise((r) => setTimeout(r, 5000));
82
+ try {
83
+ runCapture(`gh repo clone ${GITHUB_ORG}/${name} ${name}`);
84
+ cloned = true;
85
+ break;
86
+ } catch {
87
+ console.log(` Retrying clone... (${i + 1}/${maxRetries})`);
88
+ }
89
+ }
90
+
91
+ if (!cloned) {
92
+ console.error("Error: Could not clone repo after 60 seconds.");
93
+ console.error(`Try manually: gh repo clone ${GITHUB_ORG}/${name}`);
94
+ process.exit(1);
95
+ }
96
+
74
97
  const projectDir = resolve(process.cwd(), name);
75
98
  if (!existsSync(projectDir)) {
76
99
  console.error(`Error: Expected directory ${projectDir} not found.`);