@fuman/build 0.0.5 → 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.
- package/cli/commands/docs.js +1 -1
- package/cli/commands/release.js +7 -7
- package/git/github.d.ts +1 -1
- package/git/github.js +9 -3
- package/package.json +2 -2
- package/versioning/bump-version.d.ts +2 -0
- package/versioning/bump-version.js +13 -5
package/cli/commands/docs.js
CHANGED
|
@@ -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
|
|
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);
|
package/cli/commands/release.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
|
-
import {
|
|
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
|
|
216
|
+
artifacts: await parallelMap(tarballs, async (file) => ({
|
|
217
217
|
name: basename(file),
|
|
218
218
|
type: "application/gzip",
|
|
219
|
-
body:
|
|
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
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: {
|
|
@@ -30,15 +29,22 @@ async function createGithubRelease(params) {
|
|
|
30
29
|
}));
|
|
31
30
|
if (params.artifacts != null && params.artifacts.length > 0) {
|
|
32
31
|
await asyncPool(params.artifacts, async (file) => {
|
|
33
|
-
await ffetch(
|
|
32
|
+
await ffetch(`https://uploads.github.com/repos/${params.repo}/releases/${release.id}/assets`, {
|
|
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
|
|
41
41
|
});
|
|
42
|
+
}, {
|
|
43
|
+
onError: (item, idx, err) => {
|
|
44
|
+
console.error("failed to upload artifact:", item.name);
|
|
45
|
+
console.error(err);
|
|
46
|
+
return "ignore";
|
|
47
|
+
}
|
|
42
48
|
});
|
|
43
49
|
}
|
|
44
50
|
return release.id;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuman/build",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
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.
|
|
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
|
|
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 ?
|
|
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
|
-
|
|
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");
|