@eldrforge/kodrdriv 0.0.44 → 0.0.46
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.
|
@@ -5,7 +5,6 @@ import { getLogger, getDryRunLogger } from '../logging.js';
|
|
|
5
5
|
import { create } from '../util/storage.js';
|
|
6
6
|
import { run } from '../util/child.js';
|
|
7
7
|
import { execute as execute$1 } from './publish.js';
|
|
8
|
-
import { getCurrentBranchName } from '../util/github.js';
|
|
9
8
|
import { safeJsonParse, validatePackageJson } from '../util/validation.js';
|
|
10
9
|
|
|
11
10
|
// Create a package-scoped logger that prefixes all messages
|
|
@@ -206,62 +205,6 @@ const topologicalSort = (graph)=>{
|
|
|
206
205
|
logger.verbose(`Topological sort completed. Build order determined for ${result.length} packages.`);
|
|
207
206
|
return result;
|
|
208
207
|
};
|
|
209
|
-
// Workspace-level prechecks that apply to the entire repository
|
|
210
|
-
const runWorkspacePrechecks = async (runConfig, requireGitRepo = false)=>{
|
|
211
|
-
const isDryRun = runConfig.dryRun || false;
|
|
212
|
-
const logger = getDryRunLogger(isDryRun);
|
|
213
|
-
logger.info('Running workspace-level prechecks...');
|
|
214
|
-
// Check if we're in a git repository at workspace level
|
|
215
|
-
let isWorkspaceGitRepo = false;
|
|
216
|
-
try {
|
|
217
|
-
if (isDryRun) {
|
|
218
|
-
logger.info('Would check git repository with: git rev-parse --git-dir');
|
|
219
|
-
isWorkspaceGitRepo = true; // Assume true for dry run
|
|
220
|
-
} else {
|
|
221
|
-
await run('git rev-parse --git-dir');
|
|
222
|
-
isWorkspaceGitRepo = true;
|
|
223
|
-
}
|
|
224
|
-
} catch {
|
|
225
|
-
if (!isDryRun) {
|
|
226
|
-
if (requireGitRepo) {
|
|
227
|
-
throw new Error('Not in a git repository');
|
|
228
|
-
} else {
|
|
229
|
-
logger.info('Workspace is not a git repository. Skipping workspace-level git checks (multi-repo workspace detected).');
|
|
230
|
-
isWorkspaceGitRepo = false;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// Only perform workspace-level git checks if we're in a git repository
|
|
235
|
-
if (isWorkspaceGitRepo) {
|
|
236
|
-
// Check for uncommitted changes at workspace level
|
|
237
|
-
logger.info('Checking for uncommitted changes...');
|
|
238
|
-
try {
|
|
239
|
-
if (isDryRun) {
|
|
240
|
-
logger.info('Would check git status with: git status --porcelain');
|
|
241
|
-
} else {
|
|
242
|
-
const { stdout } = await run('git status --porcelain');
|
|
243
|
-
if (stdout.trim()) {
|
|
244
|
-
throw new Error('Working directory has uncommitted changes. Please commit or stash your changes before running publish-tree.');
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
} catch {
|
|
248
|
-
if (!isDryRun) {
|
|
249
|
-
throw new Error('Failed to check git status. Please ensure you are in a valid git repository.');
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// Check if we're on a release branch
|
|
253
|
-
logger.info('Checking current branch...');
|
|
254
|
-
if (isDryRun) {
|
|
255
|
-
logger.info('Would verify current branch is a release branch (starts with "release/")');
|
|
256
|
-
} else {
|
|
257
|
-
const currentBranch = await getCurrentBranchName();
|
|
258
|
-
if (!currentBranch.startsWith('release/')) {
|
|
259
|
-
throw new Error(`Current branch '${currentBranch}' is not a release branch. Please switch to a release branch (e.g., release/1.0.0) before running publish-tree.`);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
logger.info('Workspace-level prechecks passed.');
|
|
264
|
-
};
|
|
265
208
|
// Per-package prechecks that apply to each individual package
|
|
266
209
|
const runPackagePrechecks = async (packageName, packageInfo, runConfig, index, total)=>{
|
|
267
210
|
var _runConfig_publish;
|
|
@@ -356,9 +299,7 @@ const runTreePrechecks = async (graph, buildOrder, runConfig)=>{
|
|
|
356
299
|
const isDryRun = runConfig.dryRun || false;
|
|
357
300
|
const logger = getDryRunLogger(isDryRun);
|
|
358
301
|
logger.info(`${isDryRun ? 'DRY RUN: ' : ''}Running prechecks for all ${buildOrder.length} packages...`);
|
|
359
|
-
//
|
|
360
|
-
await runWorkspacePrechecks(runConfig, true);
|
|
361
|
-
// Then run package-level prechecks for each package
|
|
302
|
+
// Run package-level prechecks for each package
|
|
362
303
|
const failedPackages = [];
|
|
363
304
|
for(let i = 0; i < buildOrder.length; i++){
|
|
364
305
|
const packageName = buildOrder[i];
|
|
@@ -397,9 +338,6 @@ const runTreePrechecks = async (graph, buildOrder, runConfig)=>{
|
|
|
397
338
|
logger.error(' 3. For invalid package.json files:');
|
|
398
339
|
logger.error(' Fix JSON syntax errors and ensure all required fields are present');
|
|
399
340
|
logger.error('');
|
|
400
|
-
logger.error(' 4. For git repository issues:');
|
|
401
|
-
logger.error(' Ensure you are in a git repository on a release branch with no uncommitted changes');
|
|
402
|
-
logger.error('');
|
|
403
341
|
logger.error('💡 After fixing these issues, re-run the command to continue with the publish process.');
|
|
404
342
|
throw new Error(`Prechecks failed for ${failedPackages.length} package${failedPackages.length === 1 ? '' : 's'}. Please fix the issues above and try again.`);
|
|
405
343
|
}
|