@fuman/build 0.0.15 → 0.0.17
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/bump-version.d.ts +2 -2
- package/cli/commands/gen-changelog.js +0 -1
- package/cli/commands/lint/index.js +0 -1
- package/cli/commands/lint/validate-workspace-deps.d.ts +1 -2
- package/cli/commands/lint/validate-workspace-deps.js +0 -8
- package/cli/commands/release.d.ts +2 -2
- package/cli/commands/release.js +0 -1
- package/git/github.js +1 -5
- package/jsr/deno-json.js +4 -4
- package/jsr/utils/jsr.js +4 -8
- package/misc/_config.js +3 -1
- package/package-json/process-package-json.js +9 -9
- package/package-json/types.d.ts +1 -2
- package/package-json/types.js +8 -8
- package/package.json +8 -8
- package/versioning/bump-version.js +50 -28
- package/versioning/types.d.ts +18 -0
- package/vite/build-plugin.js +1 -1
|
@@ -3,13 +3,13 @@ import { bc } from './_utils.js';
|
|
|
3
3
|
export declare function formatBumpVersionResult(result: BumpVersionResult, withReleaseType: boolean): string;
|
|
4
4
|
export declare const bumpVersionCli: bc.Command<{
|
|
5
5
|
root: string | undefined;
|
|
6
|
-
type: "
|
|
6
|
+
type: "auto" | "major" | "minor" | "patch";
|
|
7
7
|
since: string | undefined;
|
|
8
8
|
dryRun: boolean | undefined;
|
|
9
9
|
quiet: boolean | undefined;
|
|
10
10
|
}, {
|
|
11
11
|
root: string | undefined;
|
|
12
|
-
type: "
|
|
12
|
+
type: "auto" | "major" | "minor" | "patch";
|
|
13
13
|
since: string | undefined;
|
|
14
14
|
dryRun: boolean | undefined;
|
|
15
15
|
quiet: boolean | undefined;
|
|
@@ -4,7 +4,6 @@ import { validateWorkspaceDeps } from "./validate-workspace-deps.js";
|
|
|
4
4
|
import * as bc from "@drizzle-team/brocli";
|
|
5
5
|
const INTERNAL_MESSAGES = {
|
|
6
6
|
not_workspace_proto: "internal dependencies must be linked with workspace: protocol",
|
|
7
|
-
standalone_dep: "non-standalone packages cannot depend on standalone packages with workspace: protocol",
|
|
8
7
|
not_workspace_dep: "workspace: protocol is used to link to a package not found in the workspace"
|
|
9
8
|
};
|
|
10
9
|
const lintCli = bc.command({
|
|
@@ -25,10 +25,9 @@ export interface InternalDepsError {
|
|
|
25
25
|
/**
|
|
26
26
|
* sub-type of the error
|
|
27
27
|
* - not_workspace_proto: internal dependencies must be linked with workspace: protocol
|
|
28
|
-
* - standalone_dep: non-standalone packages cannot depend on standalone packages
|
|
29
28
|
* - not_workspace_dep: `workspace:` protocol is used to link to a package not found in the workspace
|
|
30
29
|
*/
|
|
31
|
-
subtype: 'not_workspace_proto' | '
|
|
30
|
+
subtype: 'not_workspace_proto' | 'not_workspace_dep';
|
|
32
31
|
}
|
|
33
32
|
export type WorkspaceDepsError = ExternalDepsError | InternalDepsError;
|
|
34
33
|
/**
|
|
@@ -37,14 +37,6 @@ async function validateWorkspaceDeps(params) {
|
|
|
37
37
|
});
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
|
-
if (!pj.fuman?.standalone && otherPkgStandalone && version.startsWith("workspace:")) {
|
|
41
|
-
errors.push({
|
|
42
|
-
type: "internal",
|
|
43
|
-
package: pj.name,
|
|
44
|
-
dependency: name,
|
|
45
|
-
subtype: "standalone_dep"
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
40
|
continue;
|
|
49
41
|
}
|
|
50
42
|
if (version.startsWith("workspace:")) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bc } from './_utils.js';
|
|
2
2
|
export declare const releaseCli: bc.Command<{
|
|
3
|
-
kind: "
|
|
3
|
+
kind: "auto" | "major" | "minor" | "patch";
|
|
4
4
|
withGithubRelease: boolean;
|
|
5
5
|
gitExtraOrigins: string | undefined;
|
|
6
6
|
githubToken: string | undefined;
|
|
@@ -18,7 +18,7 @@ export declare const releaseCli: bc.Command<{
|
|
|
18
18
|
npmRegistry: string | undefined;
|
|
19
19
|
dryRun: boolean | undefined;
|
|
20
20
|
}, {
|
|
21
|
-
kind: "
|
|
21
|
+
kind: "auto" | "major" | "minor" | "patch";
|
|
22
22
|
withGithubRelease: boolean;
|
|
23
23
|
gitExtraOrigins: string | undefined;
|
|
24
24
|
githubToken: string | undefined;
|
package/cli/commands/release.js
CHANGED
|
@@ -114,7 +114,6 @@ const releaseCli = bc.command({
|
|
|
114
114
|
console.log("🚀 next tag:", tagName);
|
|
115
115
|
console.log("📝 generating changelog...");
|
|
116
116
|
const changelog = prevTag != null ? await generateChangelog({
|
|
117
|
-
workspace: changedPackages,
|
|
118
117
|
cwd: root,
|
|
119
118
|
since: prevTag,
|
|
120
119
|
params: config?.versioning
|
package/git/github.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { ffetchBase
|
|
2
|
-
import { ffetchZodAdapter } from "@fuman/fetch/zod";
|
|
1
|
+
import { ffetchBase } from "@fuman/fetch";
|
|
3
2
|
import { asyncPool } from "@fuman/utils";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
async function createGithubRelease(params) {
|
|
6
5
|
const ffetch = ffetchBase.extend({
|
|
7
6
|
baseUrl: params.apiUrl ?? "https://api.github.com",
|
|
8
|
-
addons: [
|
|
9
|
-
ffetchAddons.parser(ffetchZodAdapter())
|
|
10
|
-
],
|
|
11
7
|
headers: {
|
|
12
8
|
"Accept": "application/vnd.github+json",
|
|
13
9
|
"User-Agent": "@fuman/build",
|
package/jsr/deno-json.js
CHANGED
|
@@ -8,7 +8,7 @@ function packageJsonToDeno({
|
|
|
8
8
|
baseDir
|
|
9
9
|
}) {
|
|
10
10
|
const importMap = {};
|
|
11
|
-
const exports = {};
|
|
11
|
+
const exports$1 = {};
|
|
12
12
|
for (const field of ["dependencies", "peerDependencies", "optionalDependencies"]) {
|
|
13
13
|
const deps = packageJson[field];
|
|
14
14
|
if (deps == null) continue;
|
|
@@ -55,16 +55,16 @@ function packageJsonToDeno({
|
|
|
55
55
|
if (!value.startsWith(`./${baseDir}`)) {
|
|
56
56
|
throw new Error(`Invalid export value: ${value} (must be inside ./${baseDir})`);
|
|
57
57
|
}
|
|
58
|
-
exports[name] = `./${value.slice(baseDir.length + 3)}`;
|
|
58
|
+
exports$1[name] = `./${value.slice(baseDir.length + 3)}`;
|
|
59
59
|
} else {
|
|
60
|
-
exports[name] = value;
|
|
60
|
+
exports$1[name] = value;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
65
|
name: asNonNull(packageJson.name),
|
|
66
66
|
version: asNonNull(packageJson.version),
|
|
67
|
-
exports,
|
|
67
|
+
exports: exports$1,
|
|
68
68
|
exclude,
|
|
69
69
|
imports: importMap,
|
|
70
70
|
publish: {
|
package/jsr/utils/jsr.js
CHANGED
|
@@ -2,8 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import { ffetchBase
|
|
6
|
-
import { ffetchZodAdapter } from "@fuman/fetch/zod";
|
|
5
|
+
import { ffetchBase } from "@fuman/fetch";
|
|
7
6
|
import { write, webReadableToFuman } from "@fuman/io";
|
|
8
7
|
import { nodeWritableToFuman } from "@fuman/node";
|
|
9
8
|
import { asyncPool } from "@fuman/utils";
|
|
@@ -30,10 +29,7 @@ async function downloadJsrPackage(specifier, params) {
|
|
|
30
29
|
}
|
|
31
30
|
const registry = params?.registry ?? DEFAULT_REGISTRY;
|
|
32
31
|
const ffetch = ffetchBase.extend({
|
|
33
|
-
baseUrl: registry
|
|
34
|
-
addons: [
|
|
35
|
-
ffetchAddons.parser(ffetchZodAdapter())
|
|
36
|
-
]
|
|
32
|
+
baseUrl: registry
|
|
37
33
|
});
|
|
38
34
|
const targetDir = `${specifier.packageName.replace(/\//g, "+")}@${specifier.version}`;
|
|
39
35
|
const registryHost = new URL(registry).host;
|
|
@@ -46,7 +42,7 @@ async function downloadJsrPackage(specifier, params) {
|
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
const meta = await ffetch(`${specifier.packageName}/meta.json`).parsedJson(z.object({
|
|
49
|
-
versions: z.record(z.unknown())
|
|
45
|
+
versions: z.record(z.string(), z.unknown())
|
|
50
46
|
}));
|
|
51
47
|
const availableVersions = Object.keys(meta.versions);
|
|
52
48
|
const version = semver.maxSatisfying(availableVersions, specifier.version);
|
|
@@ -55,7 +51,7 @@ async function downloadJsrPackage(specifier, params) {
|
|
|
55
51
|
}
|
|
56
52
|
await fsp.mkdir(cacheDir, { recursive: true });
|
|
57
53
|
const versionMeta = await ffetch(`${specifier.packageName}/${version}_meta.json`).parsedJson(z.object({
|
|
58
|
-
manifest: z.record(z.unknown())
|
|
54
|
+
manifest: z.record(z.string(), z.unknown())
|
|
59
55
|
}));
|
|
60
56
|
const fetchFile = async (file) => {
|
|
61
57
|
file = file.replace(/^\//, "");
|
package/misc/_config.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
2
3
|
const CONFIG_NAME = "build.config.js";
|
|
3
4
|
async function loadBuildConfig(packageRoot) {
|
|
4
5
|
try {
|
|
5
|
-
const
|
|
6
|
+
const filePath = pathToFileURL(join(packageRoot, CONFIG_NAME)).href;
|
|
7
|
+
const mod = (await import(filePath)).default;
|
|
6
8
|
if (typeof mod === "function") {
|
|
7
9
|
return mod();
|
|
8
10
|
} else {
|
|
@@ -87,15 +87,15 @@ function processPackageJson(params) {
|
|
|
87
87
|
delete packageJson.fuman;
|
|
88
88
|
}
|
|
89
89
|
if (packageJson.exports != null) {
|
|
90
|
-
let exports = packageJson.exports;
|
|
91
|
-
if (typeof exports === "string") {
|
|
92
|
-
exports = { ".": exports };
|
|
90
|
+
let exports$1 = packageJson.exports;
|
|
91
|
+
if (typeof exports$1 === "string") {
|
|
92
|
+
exports$1 = { ".": exports$1 };
|
|
93
93
|
}
|
|
94
|
-
if (typeof exports !== "object") {
|
|
94
|
+
if (typeof exports$1 !== "object") {
|
|
95
95
|
throw new TypeError("package.json exports must be an object");
|
|
96
96
|
}
|
|
97
97
|
const newExports = {};
|
|
98
|
-
for (const [key, value] of Object.entries(exports)) {
|
|
98
|
+
for (const [key, value] of Object.entries(exports$1)) {
|
|
99
99
|
if (typeof value !== "string") {
|
|
100
100
|
throw new TypeError(`package.json exports value must be a string: ${key}`);
|
|
101
101
|
}
|
|
@@ -138,14 +138,14 @@ function processPackageJson(params) {
|
|
|
138
138
|
entrypoints
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
function removeCommonjsExports(exports) {
|
|
142
|
-
const keys = Object.keys(exports);
|
|
141
|
+
function removeCommonjsExports(exports$1) {
|
|
142
|
+
const keys = Object.keys(exports$1);
|
|
143
143
|
if (keys.includes("import")) {
|
|
144
|
-
delete exports.require;
|
|
144
|
+
delete exports$1.require;
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
for (const key of keys) {
|
|
148
|
-
const value = exports[key];
|
|
148
|
+
const value = exports$1[key];
|
|
149
149
|
if (value == null || typeof value !== "object") continue;
|
|
150
150
|
delete value.require;
|
|
151
151
|
}
|
package/package-json/types.d.ts
CHANGED
|
@@ -57,10 +57,9 @@ export interface PackageJson {
|
|
|
57
57
|
* standalone packages have a few differences from normal ones:
|
|
58
58
|
* - (bump-version) each standalone package has independent versioning
|
|
59
59
|
* - (lint) normal packages can't depend on standalone packages
|
|
60
|
-
* - (lint) unlike normal packages, standalone packages are allowed to depend on older versions of workspace packages
|
|
61
60
|
*/
|
|
62
61
|
standalone?: boolean;
|
|
63
62
|
};
|
|
64
63
|
[key: string]: any;
|
|
65
64
|
}
|
|
66
|
-
export declare const PackageJsonSchema: z.
|
|
65
|
+
export declare const PackageJsonSchema: z.ZodObject;
|
package/package-json/types.js
CHANGED
|
@@ -25,15 +25,15 @@ const PackageJsonSchema = z.object({
|
|
|
25
25
|
}),
|
|
26
26
|
keywords: z.array(z.string()),
|
|
27
27
|
workspaces: z.array(z.string()),
|
|
28
|
-
scripts: z.record(z.string()),
|
|
29
|
-
dependencies: z.record(z.string()),
|
|
30
|
-
devDependencies: z.record(z.string()),
|
|
31
|
-
peerDependencies: z.record(z.string()),
|
|
32
|
-
optionalDependencies: z.record(z.string()),
|
|
28
|
+
scripts: z.record(z.string(), z.string()),
|
|
29
|
+
dependencies: z.record(z.string(), z.string()),
|
|
30
|
+
devDependencies: z.record(z.string(), z.string()),
|
|
31
|
+
peerDependencies: z.record(z.string(), z.string()),
|
|
32
|
+
optionalDependencies: z.record(z.string(), z.string()),
|
|
33
33
|
bundledDependencies: z.array(z.string()),
|
|
34
|
-
engines: z.record(z.string()),
|
|
34
|
+
engines: z.record(z.string(), z.string()),
|
|
35
35
|
pnpm: z.object({
|
|
36
|
-
overrides: z.record(z.string())
|
|
36
|
+
overrides: z.record(z.string(), z.string())
|
|
37
37
|
}).partial(),
|
|
38
38
|
fuman: z.object({
|
|
39
39
|
jsr: z.union([
|
|
@@ -45,7 +45,7 @@ const PackageJsonSchema = z.object({
|
|
|
45
45
|
z.literal("only")
|
|
46
46
|
]),
|
|
47
47
|
keepScripts: z.array(z.string()),
|
|
48
|
-
distOnlyFields: z.record(z.unknown()),
|
|
48
|
+
distOnlyFields: z.record(z.string(), z.unknown()),
|
|
49
49
|
ownVersioning: z.boolean(),
|
|
50
50
|
standalone: z.boolean(),
|
|
51
51
|
private: z.boolean()
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuman/build",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"description": "utils for building packages and managing monorepos",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@drizzle-team/brocli": "^0.
|
|
10
|
-
"@fuman/fetch": "0.0
|
|
11
|
-
"@fuman/io": "^0.0.
|
|
12
|
-
"@fuman/node": "^0.0.
|
|
13
|
-
"@fuman/utils": "^0.0.
|
|
9
|
+
"@drizzle-team/brocli": "^0.11.0",
|
|
10
|
+
"@fuman/fetch": "^0.3.0",
|
|
11
|
+
"@fuman/io": "^0.0.17",
|
|
12
|
+
"@fuman/node": "^0.0.17",
|
|
13
|
+
"@fuman/utils": "^0.0.17",
|
|
14
14
|
"cross-spawn": "^7.0.5",
|
|
15
15
|
"detect-indent": "^7.0.1",
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"picomatch": "^4.0.2",
|
|
19
19
|
"semver": "^7.6.3",
|
|
20
20
|
"tinyglobby": "^0.2.6",
|
|
21
|
-
"zod": "^
|
|
21
|
+
"zod": "^4.0.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typedoc": ">=0.24.0",
|
|
25
25
|
"typescript": "^5.2.2",
|
|
26
|
-
"vite": "^5.4.0 || ^6.0.0"
|
|
26
|
+
"vite": "^5.4.0 || ^6.0.0 || ^7.0.0"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
@@ -3,10 +3,38 @@ import { join } from "node:path";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { asNonNull } from "@fuman/utils";
|
|
5
5
|
import detectIndent from "detect-indent";
|
|
6
|
-
import {
|
|
6
|
+
import { inc, satisfies, parse, gt } from "semver";
|
|
7
7
|
import { getCommitsBetween, parseConventionalCommit, getLatestTag } from "../git/utils.js";
|
|
8
8
|
import { collectVersions, findRootPackage } from "../package-json/utils.js";
|
|
9
9
|
import { findProjectChangedPackages } from "./collect-files.js";
|
|
10
|
+
function determineBumpType(params) {
|
|
11
|
+
const { oldVersion, commits } = params;
|
|
12
|
+
let hasBreakingChanges = false;
|
|
13
|
+
let hasFeatures = false;
|
|
14
|
+
for (const commit of commits) {
|
|
15
|
+
const parsed = parseConventionalCommit(commit.message);
|
|
16
|
+
if (!parsed) continue;
|
|
17
|
+
if (parsed.breaking) hasBreakingChanges = true;
|
|
18
|
+
if (parsed.type === "feat") hasFeatures = true;
|
|
19
|
+
}
|
|
20
|
+
const parsedVersion = parse(oldVersion);
|
|
21
|
+
if (!parsedVersion) {
|
|
22
|
+
throw new Error(`Invalid version: ${oldVersion}`);
|
|
23
|
+
}
|
|
24
|
+
if (hasBreakingChanges) {
|
|
25
|
+
if (parsedVersion.major === 0 && parsedVersion.minor === 0) {
|
|
26
|
+
return "patch";
|
|
27
|
+
} else if (parsedVersion.major === 0) {
|
|
28
|
+
return "minor";
|
|
29
|
+
} else {
|
|
30
|
+
return "major";
|
|
31
|
+
}
|
|
32
|
+
} else if (hasFeatures) {
|
|
33
|
+
return parsedVersion.major === 0 ? "patch" : "minor";
|
|
34
|
+
} else {
|
|
35
|
+
return "patch";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
10
38
|
async function bumpVersion(params) {
|
|
11
39
|
const {
|
|
12
40
|
workspace,
|
|
@@ -41,32 +69,16 @@ async function bumpVersion(params) {
|
|
|
41
69
|
let hasFeatures = false;
|
|
42
70
|
let hasBreakingChanges = false;
|
|
43
71
|
if (type == null) {
|
|
44
|
-
|
|
72
|
+
const commits = await getCommitsBetween({
|
|
45
73
|
since,
|
|
46
74
|
cwd
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!parsedVersion) {
|
|
55
|
-
throw new Error(`Invalid version: ${maxVersion}`);
|
|
56
|
-
}
|
|
57
|
-
if (hasBreakingChanges) {
|
|
58
|
-
if (parsedVersion.major === 0 && parsedVersion.minor === 0) {
|
|
59
|
-
type = "patch";
|
|
60
|
-
} else if (parsedVersion.major === 0) {
|
|
61
|
-
type = "minor";
|
|
62
|
-
} else {
|
|
63
|
-
type = "major";
|
|
64
|
-
}
|
|
65
|
-
} else if (hasFeatures) {
|
|
66
|
-
type = parsedVersion.major === 0 ? "patch" : "minor";
|
|
67
|
-
} else {
|
|
68
|
-
type = "patch";
|
|
69
|
-
}
|
|
75
|
+
});
|
|
76
|
+
type = determineBumpType({
|
|
77
|
+
oldVersion: maxVersion,
|
|
78
|
+
commits
|
|
79
|
+
});
|
|
80
|
+
hasFeatures = commits.some((commit) => parseConventionalCommit(commit.message)?.type === "feat");
|
|
81
|
+
hasBreakingChanges = commits.some((commit) => parseConventionalCommit(commit.message)?.breaking);
|
|
70
82
|
}
|
|
71
83
|
const nextVersion = inc(maxVersion, type);
|
|
72
84
|
if (nextVersion == null) {
|
|
@@ -80,6 +92,7 @@ async function bumpVersion(params) {
|
|
|
80
92
|
prevVersion: asNonNull(pkg.json.version)
|
|
81
93
|
});
|
|
82
94
|
}
|
|
95
|
+
const bumpWithDependants = params.params?.bumpWithDependants;
|
|
83
96
|
for (const pkg of changedPackages) {
|
|
84
97
|
if (pkg.json.fuman?.ownVersioning) continue;
|
|
85
98
|
const pkgName = asNonNull(pkg.json.name);
|
|
@@ -94,7 +107,15 @@ async function bumpVersion(params) {
|
|
|
94
107
|
}
|
|
95
108
|
if (expandedVersion === "workspace:^") expandedVersion = `^${workspaceVersions[pkgName]}`;
|
|
96
109
|
if (expandedVersion === "workspace:*") expandedVersion = workspaceVersions[pkgName];
|
|
97
|
-
|
|
110
|
+
let shouldBump;
|
|
111
|
+
if (bumpWithDependants === true) {
|
|
112
|
+
shouldBump = true;
|
|
113
|
+
} else if (bumpWithDependants === "only-minor") {
|
|
114
|
+
shouldBump = !satisfies(nextVersion, expandedVersion) && type === "minor";
|
|
115
|
+
} else {
|
|
116
|
+
shouldBump = !satisfies(nextVersion, expandedVersion);
|
|
117
|
+
}
|
|
118
|
+
if (shouldBump) {
|
|
98
119
|
if (otherPkg.json.fuman?.ownVersioning) {
|
|
99
120
|
throw new Error(`package ${otherPkg.json.name}@${otherPkg.json.version} is marked as "own versioning", and will not be compatible with ${pkgName}@${expandedVersion} after bumping. please bump it manually`);
|
|
100
121
|
}
|
|
@@ -132,10 +153,11 @@ async function bumpVersion(params) {
|
|
|
132
153
|
const commits = await getCommitsBetween({
|
|
133
154
|
until: prevTag,
|
|
134
155
|
cwd,
|
|
135
|
-
files: [join(pkg.path, "
|
|
156
|
+
files: [join(pkg.path, "**")]
|
|
136
157
|
});
|
|
137
158
|
if (commits.length > 0) {
|
|
138
|
-
|
|
159
|
+
const bumpType = determineBumpType({ oldVersion: newVersion, commits });
|
|
160
|
+
newVersion = asNonNull(inc(newVersion, bumpType));
|
|
139
161
|
}
|
|
140
162
|
}
|
|
141
163
|
}
|
package/versioning/types.d.ts
CHANGED
|
@@ -39,6 +39,24 @@ export interface VersioningOptions {
|
|
|
39
39
|
* @default `['**\/*.test.ts', '**\/*.md']`
|
|
40
40
|
*/
|
|
41
41
|
exclude?: string[] | null;
|
|
42
|
+
/**
|
|
43
|
+
* whether to also bump dependant packages when bumping a package,
|
|
44
|
+
* even if this is a semver-compatible bump.
|
|
45
|
+
*
|
|
46
|
+
* example:
|
|
47
|
+
* - A depends on package B, and B depends on package C
|
|
48
|
+
* - A gets patch bump (e.g. `v1.2.3` -> `v1.2.4`)
|
|
49
|
+
* - when `false` or `'only-minor'`, B and C єlwill not be bumped
|
|
50
|
+
* - when `true`, B and C will be bumped to the same version as A (i.e. `v1.2.4`)
|
|
51
|
+
*
|
|
52
|
+
* `only-minor` will make fuman ignore patch bumps and only bump dependants
|
|
53
|
+
* when minor version is bumped.
|
|
54
|
+
*
|
|
55
|
+
* note that dependants are always bumped on a major bump.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
bumpWithDependants?: boolean | 'only-minor';
|
|
42
60
|
/**
|
|
43
61
|
* custom predicate for inclusion of files
|
|
44
62
|
* (will be called in addition to the globs,
|
package/vite/build-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fsp from "node:fs/promises";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
|
-
import { asNonNull,
|
|
4
|
+
import { asNonNull, assertStartsWith, deepMerge, parallelMap } from "@fuman/utils";
|
|
5
5
|
import { glob } from "tinyglobby";
|
|
6
6
|
import { loadBuildConfig } from "../misc/_config.js";
|
|
7
7
|
import { tryCopy, fileExists, directoryExists } from "../misc/fs.js";
|