@epic-web/workshop-utils 6.69.0 → 6.69.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.
@@ -102,12 +102,12 @@ export declare function checkForUpdatesCached(): Promise<{
102
102
  export declare function updateLocalRepo(): Promise<{
103
103
  readonly status: "success";
104
104
  readonly message: "The app is deployed" | "You are offline" | "Not in a git repo" | "Cannot find remote" | "No updates available.";
105
- } | {
106
- readonly status: "success";
107
- readonly message: "Updated successfully.";
108
105
  } | {
109
106
  readonly status: "error";
110
107
  readonly message: string;
108
+ } | {
109
+ readonly status: "success";
110
+ readonly message: "Updated successfully.";
111
111
  }>;
112
112
  export declare function getCommitInfo(): Promise<{
113
113
  hash: string;
@@ -127,6 +127,28 @@ export async function checkForUpdatesCached() {
127
127
  cache: checkForUpdatesCache,
128
128
  });
129
129
  }
130
+ async function runNpmInstallWithRetry(cwd, maxRetries = 3, baseDelayMs = 1000) {
131
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
132
+ try {
133
+ await execaCommand('npm install', { cwd, stdio: 'inherit' });
134
+ return;
135
+ }
136
+ catch (error) {
137
+ const isEbusy = error instanceof Error &&
138
+ (error.message.includes('EBUSY') ||
139
+ error.code === 'EBUSY');
140
+ if (isEbusy && attempt < maxRetries) {
141
+ const delay = baseDelayMs * Math.pow(2, attempt - 1);
142
+ console.log(`⚠️ File busy error (attempt ${attempt}/${maxRetries}). ` +
143
+ `Retrying in ${delay / 1000}s...`);
144
+ await new Promise((resolve) => setTimeout(resolve, delay));
145
+ }
146
+ else {
147
+ throw error;
148
+ }
149
+ }
150
+ }
151
+ }
130
152
  export async function updateLocalRepo() {
131
153
  const ENV = getEnv();
132
154
  if (ENV.EPICSHOP_DEPLOYED) {
@@ -157,7 +179,23 @@ export async function updateLocalRepo() {
157
179
  await execaCommand('git stash pop', { cwd });
158
180
  }
159
181
  console.log('📦 Re-installing dependencies...');
160
- await execaCommand('npm install', { cwd, stdio: 'inherit' });
182
+ try {
183
+ await runNpmInstallWithRetry(cwd);
184
+ }
185
+ catch (error) {
186
+ const isEbusy = error instanceof Error &&
187
+ (error.message.includes('EBUSY') ||
188
+ error.code === 'EBUSY');
189
+ if (isEbusy) {
190
+ return {
191
+ status: 'error',
192
+ message: 'npm install failed: files are locked. ' +
193
+ 'Please close any editors or terminals using this directory, ' +
194
+ 'then run: npm install',
195
+ };
196
+ }
197
+ throw error;
198
+ }
161
199
  await cleanupEmptyExerciseDirectories(cwd);
162
200
  const postUpdateScript = getWorkshopConfig().scripts?.postupdate;
163
201
  if (postUpdateScript) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-utils",
3
- "version": "6.69.0",
3
+ "version": "6.69.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },