@fuman/build 0.0.15 → 0.0.16
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/misc/_config.js +3 -1
- package/package.json +4 -4
- package/versioning/bump-version.js +10 -1
- package/versioning/types.d.ts +18 -0
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 {
|
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.16",
|
|
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
10
|
"@fuman/fetch": "0.0.13",
|
|
11
|
-
"@fuman/io": "^0.0.
|
|
12
|
-
"@fuman/node": "^0.0.
|
|
13
|
-
"@fuman/utils": "^0.0.
|
|
11
|
+
"@fuman/io": "^0.0.16",
|
|
12
|
+
"@fuman/node": "^0.0.16",
|
|
13
|
+
"@fuman/utils": "^0.0.16",
|
|
14
14
|
"cross-spawn": "^7.0.5",
|
|
15
15
|
"detect-indent": "^7.0.1",
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
@@ -80,6 +80,7 @@ async function bumpVersion(params) {
|
|
|
80
80
|
prevVersion: asNonNull(pkg.json.version)
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
+
const bumpWithDependants = params.params?.bumpWithDependants;
|
|
83
84
|
for (const pkg of changedPackages) {
|
|
84
85
|
if (pkg.json.fuman?.ownVersioning) continue;
|
|
85
86
|
const pkgName = asNonNull(pkg.json.name);
|
|
@@ -94,7 +95,15 @@ async function bumpVersion(params) {
|
|
|
94
95
|
}
|
|
95
96
|
if (expandedVersion === "workspace:^") expandedVersion = `^${workspaceVersions[pkgName]}`;
|
|
96
97
|
if (expandedVersion === "workspace:*") expandedVersion = workspaceVersions[pkgName];
|
|
97
|
-
|
|
98
|
+
let shouldBump;
|
|
99
|
+
if (bumpWithDependants === true) {
|
|
100
|
+
shouldBump = true;
|
|
101
|
+
} else if (bumpWithDependants === "only-minor") {
|
|
102
|
+
shouldBump = !satisfies(nextVersion, expandedVersion) && type === "minor";
|
|
103
|
+
} else {
|
|
104
|
+
shouldBump = !satisfies(nextVersion, expandedVersion);
|
|
105
|
+
}
|
|
106
|
+
if (shouldBump) {
|
|
98
107
|
if (otherPkg.json.fuman?.ownVersioning) {
|
|
99
108
|
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
109
|
}
|
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,
|