Skip to content

Commit 1b07fd4

Browse files
committed
fix: rename "preReleases" option to "original"
1 parent bc4cb43 commit 1b07fd4

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

conver.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"options": {},
44
"branch": "main",
55
"base": "105b0348bf16f3b66fccb09cb716ef2e0521507b",
6-
"preReleases": {
6+
"original": {
77
"conventional-versioning": "0.1.0"
88
}
99
}

e2e/pre-release.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ it("enters pre-release", async () => {
3333

3434
// check config
3535
const config = (await sandbox.readJsoncFile("conver.json")) as Options;
36-
expect(config.preReleases).toMatchObject({ "my-package": "1.2.3" });
36+
expect(config.original).toMatchObject({ "my-package": "1.2.3" });
3737
});
3838
});
3939

@@ -49,7 +49,7 @@ it("exists pre-release", async () => {
4949
},
5050
}),
5151
"conver.json": json({
52-
preReleases: {
52+
original: {
5353
"my-package": "1.2.3",
5454
},
5555
}),
@@ -77,7 +77,7 @@ it("exists pre-release", async () => {
7777

7878
// check config
7979
const options = (await sandbox.readJsoncFile("conver.json")) as Options;
80-
expect(Object.keys(options.preReleases ?? {})).not.toContain("my-package");
80+
expect(Object.keys(options.original ?? {})).not.toContain("my-package");
8181
});
8282
});
8383

@@ -93,7 +93,7 @@ it("bumps pre-release version", async () => {
9393
},
9494
}),
9595
"conver.json": json({
96-
preReleases: {
96+
original: {
9797
"my-package": "1.2.3",
9898
},
9999
}),

schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"base": {
7373
"type": "string"
7474
},
75-
"preReleases": {
75+
"original": {
7676
"type": "object",
7777
"additionalProperties": {
7878
"type": "string"

src/cli/commands/pre.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default declareCommand({
139139
if (!args.dry) {
140140
await modifyJsoncFile(configPath, [
141141
{
142-
path: ["preReleases", pkg.name],
142+
path: ["original", pkg.name],
143143
value: pkg.version,
144144
},
145145
]);

src/cli/commands/version.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ export default declareCommand({
9797
...workspace.packages
9898
.filter(
9999
(pkg) =>
100-
!isPreRelease(pkg.version) && !!options.preReleases?.[pkg.name],
100+
!isPreRelease(pkg.version) && !!options.original?.[pkg.name],
101101
)
102102
.map((pkg) => ({
103-
path: ["preReleases", pkg.name],
103+
path: ["original", pkg.name],
104104
value: undefined,
105105
})),
106106
);

src/lib/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ export interface Options {
117117
promotions?: Record<string, Bump | undefined> | undefined;
118118

119119
/**
120-
* A record of packages to pre-release and their original version.
120+
* A record of packages and their original version.
121121
*
122122
* @example
123123
* { "my-package": "1.2.3" }
124124
*/
125-
preReleases?: Record<string, string> | undefined;
125+
original?: Record<string, string> | undefined;
126126

127127
/**
128128
* Path to the root workspace directory.
@@ -150,6 +150,6 @@ export const DEFAULT_OPTIONS = {
150150
base: undefined,
151151
bumps: {},
152152
promotions: {},
153-
preReleases: {},
153+
original: {},
154154
workspaceRoot: "./",
155155
} satisfies Required<Options>;

src/lib/versioning.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ export function createVersioningPlan(
5555
const bumps = new Map<Package, Bump | undefined>();
5656

5757
for (const pkg of workspace.packages) {
58-
if (
59-
isPreRelease(pkg.version) &&
60-
!option(options, "preReleases")[pkg.name]
61-
) {
58+
if (isPreRelease(pkg.version) && !option(options, "original")[pkg.name]) {
6259
throw logger.fatal(
63-
`Pre-release for package '${pkg.name}' is not configured.\n` +
60+
`Original version for package '${pkg.name}' is not configured.\n` +
6461
`See ${link("https://github.com/tscpp/conventional-versioning/discussions/3.")}`,
6562
);
6663
}
@@ -244,7 +241,7 @@ export function createVersioningPlan(
244241
* {@link currentVersion}, except in pre-releases.
245242
*/
246243
const baseVersion = new SemVer(
247-
option(options, "preReleases")[pkg.name] ?? pkg.version,
244+
option(options, "original")[pkg.name] ?? pkg.version,
248245
);
249246

250247
// Limit bump for '0.x' packages to 'minor', to prevent releasing the first

0 commit comments

Comments
 (0)