Skip to content

Commit c2a7744

Browse files
committed
fix(npm): apply breaking changes after updates
1 parent bbf2cd9 commit c2a7744

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

src/bin-update/effects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const updateEffects = {
9999
if (gtr(latest, String(instance.rawSpecifier.raw), true)) {
100100
outdatedCount++;
101101
mostRecent.push(
102-
chalk`${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${ICON.rightArrow}} {green ${latest}}`,
102+
chalk`${instance.name} {gray {red ${String(instance.rawSpecifier.raw)}} ${ICON.rightArrow}} {green ${latest}}`,
103103
);
104104
} else {
105105
mostRecent.push(chalk`{green ${instance.name}}`);
@@ -116,7 +116,7 @@ export const updateEffects = {
116116
onOutdated(instance: Instance, latest: string) {
117117
outdatedCount++;
118118
mostRecent.push(
119-
chalk`${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${ICON.rightArrow}} {green ${latest}}`,
119+
chalk`${instance.name} {gray {red ${String(instance.rawSpecifier.raw)}} ${ICON.rightArrow}} {green ${latest}}`,
120120
);
121121
return Effect.void;
122122
},
@@ -136,7 +136,7 @@ export const updateEffects = {
136136
Schema.decodeUnknownEither(
137137
Schema.Struct({
138138
'dist-tags': Schema.Struct({ latest: Schema.String }),
139-
'time': Schema.Record(Schema.String, Schema.String),
139+
'time': Schema.Record({ key: Schema.String, value: Schema.String }),
140140
'homepage': Schema.optional(Schema.String),
141141
'repository': Schema.optional(
142142
Schema.Union(Schema.String, Schema.Struct({ url: Schema.optional(Schema.String) })),
@@ -271,7 +271,7 @@ function promptForReleaseType(
271271
: '';
272272

273273
return {
274-
title: chalk`${updateable.instance.name} {gray ${updateable.instance.rawSpecifier.raw} ${ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
274+
title: chalk`${updateable.instance.name} {gray ${String(updateable.instance.rawSpecifier.raw)} ${ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
275275
selected: true,
276276
value: updateable,
277277
};

src/lib/with-logger.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { Effect, Logger, LogLevel } from 'effect';
33

44
export function withLogger(program: Effect.Effect<unknown>) {
55
const logger = Logger.make(({ logLevel, message }) => {
6+
const args = Array.isArray(message) ? message : [message];
67
if (logLevel === LogLevel.Info) {
7-
globalThis.console.info(message);
8+
globalThis.console.info(...args);
89
} else if (logLevel === LogLevel.Debug) {
9-
globalThis.console.info(chalk`{magenta ? %s}`, message);
10+
globalThis.console.info(chalk`{magenta ? %s}`, ...args);
1011
} else if (logLevel === LogLevel.Error) {
11-
globalThis.console.error(chalk`{red ! %s}`, message);
12+
globalThis.console.error(chalk`{red ! %s}`, ...args);
1213
} else if (logLevel === LogLevel.Warning) {
13-
globalThis.console.warn(chalk`{yellow ! %s}`, message);
14+
globalThis.console.warn(chalk`{yellow ! %s}`, ...args);
1415
} else {
15-
globalThis.console.log(chalk`{cyan [%s] %s}`, logLevel, message);
16+
globalThis.console.log(chalk`{cyan [%s] %s}`, logLevel, ...args);
1617
}
1718
});
1819
const layer = Logger.replace(Logger.defaultLogger, logger);

test/lib/create-scenario.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import type { Report } from '../../src/report.js';
2121

2222
type NodeFs = typeof fs;
2323

24-
type MockFn<F extends (...args: any) => any> = Mock<Parameters<F>, ReturnType<F>>;
25-
2624
export interface TestScenario {
2725
cli: Partial<CliConfig>;
2826
errorHandlers: ErrorHandlers;
@@ -35,18 +33,18 @@ export interface TestScenario {
3533
mockIo: {
3634
cosmiconfig: Io['cosmiconfig'];
3735
enquirer: {
38-
prompt: MockFn<Io['enquirer']['prompt']>;
36+
prompt: Mock<Io['enquirer']['prompt']>;
3937
};
4038
fs: NodeFs;
4139
globby: {
42-
sync: MockFn<Io['globby']['sync']>;
40+
sync: Mock<Io['globby']['sync']>;
4341
};
4442
process: {
4543
cwd: Io['process']['cwd'];
46-
exit: MockFn<Io['process']['exit']>;
44+
exit: Mock<Io['process']['exit']>;
4745
};
4846
readYamlFile: {
49-
sync: MockFn<Io['readYamlFile']['sync']>;
47+
sync: Mock<Io['readYamlFile']['sync']>;
5048
};
5149
};
5250
readPackages(): Record<string, PackageJson>;

0 commit comments

Comments
 (0)