@fuman/build 0.0.1 → 0.0.2

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.
@@ -16,8 +16,8 @@ function formatBumpVersionResult(result, withReleaseType) {
16
16
  lines.push(`next version: ${result.nextVersion}`);
17
17
  lines.push("");
18
18
  lines.push("list of changed packages:");
19
- for (const { package: pkg, because } of result.changedPackages) {
20
- lines.push(` ${pkg.json.name}${because ? ` (because of ${because.join(", ")})` : ""}: ${pkg.json.version} → ${result.nextVersion}`);
19
+ for (const { package: pkg, because, prevVersion } of result.changedPackages) {
20
+ lines.push(` ${pkg.json.name}${because ? ` (because of ${because.join(", ")})` : ""}: ${prevVersion} → ${pkg.json.version}`);
21
21
  }
22
22
  return lines.join("\n");
23
23
  }
@@ -63,11 +63,15 @@ const releaseCli = bc.command({
63
63
  dryRun: args.dryRun
64
64
  });
65
65
  changedPackages = bumpVersionResult.changedPackages.map((pkg) => pkg.package);
66
- if (bumpVersionResult.changedPackages.length === 0) {
66
+ if (changedPackages.length === 0) {
67
67
  console.log("🤔 no packages changed, nothing to do");
68
68
  process.exit(1);
69
69
  }
70
70
  console.log(formatBumpVersionResult(bumpVersionResult, args.kind === "auto"));
71
+ for (const pkg of changedPackages) {
72
+ const inWorkspace = asNonNull(workspace.find((it) => it.json.name === pkg.json.name));
73
+ inWorkspace.json.version = pkg.json.version;
74
+ }
71
75
  } else {
72
76
  changedPackages = workspace;
73
77
  }
@@ -164,7 +168,7 @@ const releaseCli = bc.command({
164
168
  if (args.dryRun) {
165
169
  console.log("dry run, skipping release commit and tag");
166
170
  } else {
167
- let message = tagName;
171
+ let message = `chore(release): ${tagName}`;
168
172
  if (!args.withGithubRelease) {
169
173
  message += `
170
174
 
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@fuman/build",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "utils for building packages and managing monorepos",
6
6
  "license": "MIT",
7
7
  "scripts": {},
8
8
  "dependencies": {
9
9
  "@drizzle-team/brocli": "^0.10.2",
10
- "@fuman/fetch": "^0.0.1",
11
- "@fuman/io": "^0.0.1",
12
- "@fuman/node": "^0.0.1",
13
- "@fuman/utils": "^0.0.1",
10
+ "@fuman/fetch": "^0.0.2",
11
+ "@fuman/io": "^0.0.2",
12
+ "@fuman/node": "^0.0.2",
13
+ "@fuman/utils": "^0.0.2",
14
14
  "cross-spawn": "^7.0.5",
15
15
  "detect-indent": "^7.0.1",
16
16
  "js-yaml": "^4.1.0",
@@ -4,6 +4,8 @@ import { VersioningOptions } from './types.js';
4
4
  export interface BumpVersionPackage {
5
5
  /** info about the package */
6
6
  package: WorkspacePackage;
7
+ /** version before the bump */
8
+ prevVersion: string;
7
9
  /**
8
10
  * if the package was not changed by itself,
9
11
  * but the bump is required because of another package
@@ -72,7 +72,10 @@ async function bumpVersion(params) {
72
72
  const result = [];
73
73
  for (const pkg of changedPackages) {
74
74
  if (pkg.json.fuman?.ownVersioning) continue;
75
- result.push({ package: pkg });
75
+ result.push({
76
+ package: pkg,
77
+ prevVersion: asNonNull(pkg.json.version)
78
+ });
76
79
  }
77
80
  for (const pkg of changedPackages) {
78
81
  if (pkg.json.fuman?.ownVersioning) continue;
@@ -96,6 +99,7 @@ async function bumpVersion(params) {
96
99
  } else {
97
100
  result.push({
98
101
  package: otherPkg,
102
+ prevVersion: asNonNull(otherPkg.json.version),
99
103
  because: [pkgName]
100
104
  });
101
105
  }
@@ -104,8 +108,8 @@ async function bumpVersion(params) {
104
108
  }
105
109
  }
106
110
  }
107
- if (!dryRun) {
108
- for (const { package: pkg } of result) {
111
+ for (const { package: pkg } of result) {
112
+ if (!dryRun) {
109
113
  const pkgJsonPath = join(pkg.path, "package.json");
110
114
  const pkgJsonText = await fsp.readFile(pkgJsonPath, "utf8");
111
115
  const indent = detectIndent(pkgJsonText).indent || " ";
@@ -114,6 +118,7 @@ async function bumpVersion(params) {
114
118
  await fsp.writeFile(pkgJsonPath, `${JSON.stringify(pkgJson, null, indent)}
115
119
  `);
116
120
  }
121
+ pkg.json.version = nextVersion;
117
122
  }
118
123
  return {
119
124
  maxVersion,