@fuman/build 0.0.6 → 0.0.7

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.
@@ -54,7 +54,7 @@ class FumanTypedocReader {
54
54
  const pkgName = asNonNull(pkg2.json.name);
55
55
  if (data2?.includePackages && !data2.includePackages.includes(pkgName)) continue;
56
56
  if (data2?.excludePackages?.includes(pkgName)) continue;
57
- if (pkg2.json.exports != null && !data2?.includePackages?.includes(pkgName)) continue;
57
+ if (pkg2.json.exports == null && !data2?.includePackages?.includes(pkgName)) continue;
58
58
  entrypoints2.push(pkg2.path);
59
59
  }
60
60
  options.setValue("entryPoints", entrypoints2, cwd);
@@ -1,8 +1,7 @@
1
- import { createReadStream } from "node:fs";
1
+ import { readFile } from "node:fs/promises";
2
2
  import { basename } from "node:path";
3
3
  import process from "node:process";
4
- import { nodeReadableToWeb } from "@fuman/node";
5
- import { asNonNull, notImplemented } from "@fuman/utils";
4
+ import { asNonNull, notImplemented, parallelMap } from "@fuman/utils";
6
5
  import { sort } from "semver";
7
6
  import { createGithubRelease } from "../../git/github.js";
8
7
  import { getLatestTag, getFirstCommit, gitTagExists } from "../../git/utils.js";
@@ -56,12 +55,13 @@ const releaseCli = bc.command({
56
55
  let bumpVersionResult;
57
56
  if (prevTag != null) {
58
57
  bumpVersionResult = await bumpVersion({
59
- workspace,
58
+ workspace: workspaceWithRoot,
60
59
  since: prevTag ?? await getFirstCommit(root),
61
60
  type: args.kind === "auto" ? void 0 : args.kind,
62
61
  cwd: root,
63
62
  params: config?.versioning,
64
- dryRun: args.dryRun
63
+ dryRun: args.dryRun,
64
+ withRoot: true
65
65
  });
66
66
  changedPackages = bumpVersionResult.changedPackages.map((pkg) => pkg.package);
67
67
  if (changedPackages.length === 0) {
@@ -213,10 +213,10 @@ ${changelog}`;
213
213
  tag: tagName,
214
214
  name: tagName,
215
215
  body: changelog,
216
- artifacts: tarballs.map((file) => ({
216
+ artifacts: await parallelMap(tarballs, async (file) => ({
217
217
  name: basename(file),
218
218
  type: "application/gzip",
219
- body: nodeReadableToWeb(createReadStream(file))
219
+ body: await readFile(file)
220
220
  }))
221
221
  });
222
222
  console.log(`\x1B[;32m✅github release created: https://github.com/${repo}/releases/tag/${tagName}\x1B[;0m`);
package/git/github.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare function createGithubRelease(params: {
9
9
  artifacts?: {
10
10
  name: string;
11
11
  type: string;
12
- body: BodyInit;
12
+ body: Uint8Array;
13
13
  }[];
14
14
  apiUrl?: string;
15
15
  }): Promise<number>;
package/git/github.js CHANGED
@@ -6,7 +6,6 @@ async function createGithubRelease(params) {
6
6
  const ffetch = ffetchBase.extend({
7
7
  baseUrl: params.apiUrl ?? "https://api.github.com",
8
8
  addons: [
9
- ffetchAddons.retry(),
10
9
  ffetchAddons.parser(ffetchZodAdapter())
11
10
  ],
12
11
  headers: {
@@ -34,7 +33,8 @@ async function createGithubRelease(params) {
34
33
  method: "POST",
35
34
  query: { name: file.name },
36
35
  headers: {
37
- "Content-Type": file.type
36
+ "Content-Type": file.type,
37
+ "Content-Length": file.body.length.toString()
38
38
  },
39
39
  body: file.body,
40
40
  validateResponse: (res) => res.status === 201
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fuman/build",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
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.6",
10
+ "@fuman/fetch": "^0.0.7",
11
11
  "@fuman/io": "^0.0.4",
12
12
  "@fuman/node": "^0.0.4",
13
13
  "@fuman/utils": "^0.0.4",
@@ -47,4 +47,6 @@ export declare function bumpVersion(params: {
47
47
  params?: VersioningOptions;
48
48
  /** whether to not actually write the files */
49
49
  dryRun?: boolean;
50
+ /** whether to also bump version of the root package.json */
51
+ withRoot?: boolean;
50
52
  }): Promise<BumpVersionResult>;
@@ -5,7 +5,7 @@ import { asNonNull } from "@fuman/utils";
5
5
  import detectIndent from "detect-indent";
6
6
  import { parse, inc, satisfies, gt } from "semver";
7
7
  import { getCommitsBetween, parseConventionalCommit } from "../git/utils.js";
8
- import { collectVersions } from "../package-json/utils.js";
8
+ import { collectVersions, findRootPackage } from "../package-json/utils.js";
9
9
  import { findProjectChangedPackages } from "./collect-files.js";
10
10
  async function bumpVersion(params) {
11
11
  const {
@@ -13,10 +13,13 @@ async function bumpVersion(params) {
13
13
  all,
14
14
  cwd = process.cwd(),
15
15
  since,
16
- dryRun = false
16
+ dryRun = false,
17
+ withRoot = false
17
18
  } = params;
19
+ const workspaceWithoutRoot = workspace.filter((pkg) => !pkg.root);
18
20
  let maxVersion = null;
19
- for (const pkg of workspace) {
21
+ for (const pkg of workspaceWithoutRoot) {
22
+ if (pkg.root) continue;
20
23
  const version = asNonNull(pkg.json.version);
21
24
  if (pkg.json.fuman?.ownVersioning) {
22
25
  continue;
@@ -28,7 +31,8 @@ async function bumpVersion(params) {
28
31
  if (maxVersion == null) {
29
32
  throw new Error("No packages found with fuman-managed versioning");
30
33
  }
31
- const changedPackages = all ? workspace : await findProjectChangedPackages({
34
+ const changedPackages = all ? workspaceWithoutRoot : await findProjectChangedPackages({
35
+ workspace: workspaceWithoutRoot,
32
36
  root: cwd,
33
37
  since,
34
38
  params: params.params
@@ -108,7 +112,11 @@ async function bumpVersion(params) {
108
112
  }
109
113
  }
110
114
  }
111
- for (const { package: pkg } of result) {
115
+ const packagesToBump = [...result.map((it) => it.package)];
116
+ if (withRoot) {
117
+ packagesToBump.push(findRootPackage(workspace));
118
+ }
119
+ for (const pkg of packagesToBump) {
112
120
  if (!dryRun) {
113
121
  const pkgJsonPath = join(pkg.path, "package.json");
114
122
  const pkgJsonText = await fsp.readFile(pkgJsonPath, "utf8");