Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed May 4, 2023
1 parent dc919a0 commit e8dcb18
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/__e2e__/publishRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ describe('publish command (registry)', () => {
it('will perform retries', async () => {
registry.stop();

// hide the errors for this test--it's supposed to have errors, and showing them is misleading
logs.init(false);
logs.init(true);
// // hide the errors for this test--it's supposed to have errors, and showing them is misleading
// logs.init(false);

factory = new RepositoryFactory('single');
factory.init();
Expand Down
2 changes: 1 addition & 1 deletion src/__fixtures__/mockLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function initMockLogs(opts?: MockLogsOptions | boolean | MockLogMethod[])

const logs: MockLogs = {
mocks: {} as MockLogs['mocks'],
realConsole: { ...console },
realConsole: { ...require('console') },
init: (shouldLog = alsoLog) => {
logs.restore(); // clear any previous mocks
mockedMethods.forEach(method => {
Expand Down
2 changes: 1 addition & 1 deletion src/__fixtures__/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ${gitResult.stderr.toString()}`);
return gitResult;
}

/** Log the results of a git command to stdio (for debugging) */
/** Log the results of a git command to non-wrapped console.log (for debugging) */
async gitConsoleLog(args: string[]) {
realConsole.log(`$ git ${args.join(' ')}`);
const res = await execa('git', args, { cwd: this.rootPath, all: true, reject: false });
Expand Down
7 changes: 7 additions & 0 deletions src/publish/publishToRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ export async function publishToRegistry(originalBumpInfo: BumpInfo, options: Bea
const bumpInfo = _.cloneDeep(originalBumpInfo);
const { modifiedPackages, newPackages, packageInfos } = bumpInfo;

console.log('Bumping versions');
if (options.bump) {
await performBump(bumpInfo, options);
}
console.log('Finished bumping versions');

const succeededPackages = new Set<string>();

let invalid = false;
console.log('Validating versions');
if (!(await validatePackageVersions(bumpInfo, registry))) {
displayManualRecovery(bumpInfo, succeededPackages);
invalid = true;
Expand All @@ -37,16 +40,20 @@ export async function publishToRegistry(originalBumpInfo: BumpInfo, options: Bea
process.exit(1);
}

console.log('Validation passed');
// get the packages to publish, reducing the set by packages that don't need publishing
const packagesToPublish = toposortPackages([...modifiedPackages, ...newPackages], packageInfos).filter(pkg => {
const { publish, reasonToSkip } = shouldPublishPackage(bumpInfo, pkg);
if (!publish) {
console.log(`Skipping publish - ${reasonToSkip}`);
} else {
console.log('Publishing - ' + pkg);
}
return publish;
});

// performing publishConfig and workspace version overrides requires this procedure to ONLY be run right before npm publish, but NOT in the git push
console.log('Performing publish overrides');
performPublishOverrides(packagesToPublish, bumpInfo.packageInfos);

// if there is a prepublish hook perform a prepublish pass, calling the routine on each package
Expand Down
1 change: 1 addition & 0 deletions src/publish/validatePackageDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { shouldPublishPackage } from './shouldPublishPackage';
* Validate no private package is listed as package dependency for packages which will be published.
*/
export function validatePackageDependencies(bumpInfo: BumpInfo): boolean {
console.log('Validating package dependencies');
let hasErrors: boolean = false;
const { modifiedPackages, newPackages, packageInfos } = bumpInfo;

Expand Down

0 comments on commit e8dcb18

Please sign in to comment.