tegami 1.2.2 → 1.2.4
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/dist/{_accessExpressionAsString-QhbUZzwv.js → _accessExpressionAsString-DW_6Xqcp.js} +1 -1
- package/dist/{_assertGuard-BBn2NbSz.js → _assertGuard-CFFC1Up9.js} +2 -2
- package/dist/{_createStandardSchema-BGQyz-uA.js → _createStandardSchema-CrRqJgaE.js} +2 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +10 -8
- package/dist/{generate-Cnd8RiKO.js → generate-Cgl2G5ea.js} +2 -2
- package/dist/generators/simple.d.ts +1 -1
- package/dist/generators/simple.js +1 -1
- package/dist/{graph-BmXTJZxx.js → graph-DaJ28Y4f.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -8
- package/dist/{npm-cS-D2xGI.js → npm-CyC2Rk11.js} +221 -133
- package/dist/plugins/cargo.d.ts +1 -1
- package/dist/plugins/cargo.js +37 -34
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +2 -4
- package/dist/plugins/github.d.ts +7 -7
- package/dist/plugins/github.js +113 -241
- package/dist/plugins/gitlab.d.ts +6 -6
- package/dist/plugins/gitlab.js +118 -245
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +10 -10
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{publish-Bt3e1RPs.js → publish-DAMkayLs.js} +11 -15
- package/dist/{semver-EKJ8yK5U.js → semver-DrtaCCZK.js} +15 -3
- package/dist/{shared-C_iSTp_s.js → shared-pTOZU5UZ.js} +11 -3
- package/dist/{types-C_vz41r2.d.ts → types-BMYzG4dR.d.ts} +42 -26
- package/dist/{version-request-DXk_B7O_.d.ts → version-request-BorZZ98V.d.ts} +1 -1
- package/dist/{version-request-DvWVAYj2.js → version-request-CQ4cJHtP.js} +203 -67
- package/package.json +5 -4
package/dist/{_accessExpressionAsString-QhbUZzwv.js → _accessExpressionAsString-DW_6Xqcp.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_accessExpressionAsString.mjs
|
|
2
2
|
const _accessExpressionAsString = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
|
|
3
3
|
const variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
|
|
4
4
|
const reserved = (str) => RESERVED.has(str);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/TypeGuardError.mjs
|
|
2
2
|
/**
|
|
3
3
|
* Error thrown when type assertion fails.
|
|
4
4
|
*
|
|
@@ -81,7 +81,7 @@ var TypeGuardError = class extends Error {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
84
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_assertGuard.mjs
|
|
85
85
|
const _assertGuard = (exceptionable, props, factory) => {
|
|
86
86
|
if (exceptionable === true) if (factory) throw factory(props);
|
|
87
87
|
else throw new TypeGuardError(props);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_validateReport.mjs
|
|
2
2
|
const _validateReport = (array) => {
|
|
3
3
|
const reportable = (path) => {
|
|
4
4
|
if (array.length === 0) return true;
|
|
@@ -18,7 +18,7 @@ const _validateReport = (array) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
21
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_createStandardSchema.mjs
|
|
22
22
|
const _createStandardSchema = (fn) => Object.assign(fn, { "~standard": {
|
|
23
23
|
version: 1,
|
|
24
24
|
vendor: "typia",
|
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
1
|
+
import { n as generateFromCommits, t as changelogFilename } from "../generate-Cgl2G5ea.js";
|
|
2
2
|
import { i as handlePluginError, s as isCI, t as CancelledError } from "../error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as renderChangelog } from "../shared-pTOZU5UZ.js";
|
|
4
4
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import path, { join, relative } from "node:path";
|
|
6
6
|
import { x } from "tinyexec";
|
|
@@ -42,7 +42,6 @@ function resolveChangedPackages(graph, files, cwd) {
|
|
|
42
42
|
//#region src/cli/changelog.ts
|
|
43
43
|
async function runChangelogTui(tegami) {
|
|
44
44
|
const context = await tegami._internal.context();
|
|
45
|
-
if (await tegami.publishStatus() === "pending") throw new Error(`Publish lock at ${context.lockPath} is still pending. Publish it before applying a new draft.`);
|
|
46
45
|
intro("Create changelogs");
|
|
47
46
|
let selectedPackages = [];
|
|
48
47
|
if (!isCI()) selectedPackages = await promptPackageSelection(context.graph, context.cwd);
|
|
@@ -485,7 +484,7 @@ function registerCoreCommands(cli, tegami, options) {
|
|
|
485
484
|
await publishPackages(tegami, { cli: options });
|
|
486
485
|
});
|
|
487
486
|
cli.command("check-publish", { description: "exit with code 1 if no publishing needed, otherwise 0" }).action(async () => {
|
|
488
|
-
const status = await tegami.
|
|
487
|
+
const { status } = await tegami.getPublishStatus();
|
|
489
488
|
process.exit(status === "pending" ? 0 : 1);
|
|
490
489
|
});
|
|
491
490
|
cli.command("publish", { description: "publish packages from the publish lock" }).option("dry-run", {
|
|
@@ -524,10 +523,13 @@ async function versionPackages(tegami, options) {
|
|
|
524
523
|
outro("No versions changed.");
|
|
525
524
|
return false;
|
|
526
525
|
}
|
|
527
|
-
if (!options.noChecks
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
526
|
+
if (!options.noChecks) {
|
|
527
|
+
const { status, reason } = await tegami.getPublishStatus();
|
|
528
|
+
if (status === "pending") {
|
|
529
|
+
note(`Publish lock at ${context.lockPath} is still pending. Publish it before applying a new draft.`, "Failed to apply");
|
|
530
|
+
outro(reason ?? "Cannot apply.");
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
531
533
|
}
|
|
532
534
|
const lines = [];
|
|
533
535
|
for (const pkg of context.graph.getPackages()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as maxBump, t as bumpDepth } from "./semver-DrtaCCZK.js";
|
|
2
2
|
import { n as execFailure } from "./error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as renderChangelog } from "./shared-pTOZU5UZ.js";
|
|
4
4
|
import { x } from "tinyexec";
|
|
5
5
|
//#region src/utils/conventional-commit.ts
|
|
6
6
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as PackageGroup, F as BumpType, M as Draft, N as DraftPolicy, P as PackageDraft, _ as PackagePublishResult, a as PublishPreflight, b as CommitChangelog, c as TegamiPluginOption, d as GenerateChangelogOptions, f as Tegami, g as PackagePublishPlan, h as PublishLock, i as PackageOptions, k as PackageGraph, m as tegami, n as GroupOptions, o as TegamiOptions, p as WorkspacePackage, r as LogGenerator, s as TegamiPlugin, v as PublishOptions, x as TegamiContext, y as PublishPlan } from "./types-BMYzG4dR.js";
|
|
2
2
|
export { type BumpType, type CommitChangelog, type Draft, type DraftPolicy, GenerateChangelogOptions, type GroupOptions, type LogGenerator, type PackageDraft, PackageGraph, type PackageGroup, type PackageOptions, type PackagePublishPlan, type PackagePublishResult, type PublishLock, type PublishOptions, type PublishPlan, type PublishPreflight, Tegami, type TegamiContext, type TegamiOptions, type TegamiPlugin, type TegamiPluginOption, WorkspacePackage, tegami };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as generateFromCommits } from "./generate-
|
|
1
|
+
import { n as generateFromCommits } from "./generate-Cgl2G5ea.js";
|
|
2
2
|
import { i as handlePluginError } from "./error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as WorkspacePackage, t as PackageGraph } from "./graph-
|
|
3
|
+
import { t as npm } from "./npm-CyC2Rk11.js";
|
|
4
|
+
import { a as createDraft, c as parseChangelogFile, i as runPublishPlan, l as readChangelogEntries, n as publishPlanStatus, r as runPreflights, t as initPublishPlan } from "./publish-DAMkayLs.js";
|
|
5
|
+
import { n as WorkspacePackage$1, t as PackageGraph } from "./graph-DaJ28Y4f.js";
|
|
6
6
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import path, { join } from "node:path";
|
|
8
8
|
//#region src/context.ts
|
|
@@ -55,6 +55,7 @@ function resolvePlugins(plugins = []) {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/index.ts
|
|
58
|
+
const WorkspacePackage = WorkspacePackage$1;
|
|
58
59
|
/** Create a Tegami project handle. */
|
|
59
60
|
function tegami(options = {}) {
|
|
60
61
|
let $context;
|
|
@@ -98,19 +99,23 @@ function tegami(options = {}) {
|
|
|
98
99
|
}
|
|
99
100
|
return createDraft(changelogs, context);
|
|
100
101
|
},
|
|
101
|
-
async
|
|
102
|
+
async getPublishStatus(publishOptions = {}) {
|
|
102
103
|
const context = await getContextResolved();
|
|
103
104
|
const plan = await initPublishPlan(context, publishOptions);
|
|
104
|
-
if (!plan) return "
|
|
105
|
+
if (!plan) return { status: "none" };
|
|
105
106
|
await runPreflights(context, plan);
|
|
106
107
|
return publishPlanStatus(plan, context);
|
|
107
108
|
},
|
|
109
|
+
async publishStatus(publishOptions = {}) {
|
|
110
|
+
const { status } = await this.getPublishStatus(publishOptions);
|
|
111
|
+
return status === "none" ? "idle" : status;
|
|
112
|
+
},
|
|
108
113
|
async publish(publishOptions = {}) {
|
|
109
114
|
const context = await getContextResolved();
|
|
110
115
|
const plan = await initPublishPlan(context, publishOptions);
|
|
111
116
|
if (!plan) return "skipped";
|
|
112
117
|
await runPreflights(context, plan);
|
|
113
|
-
if (await publishPlanStatus(plan, context) === "success") return "skipped";
|
|
118
|
+
if ((await publishPlanStatus(plan, context)).status === "success") return "skipped";
|
|
114
119
|
await runPublishPlan(context, plan);
|
|
115
120
|
if (Array.from(plan.packages.values()).every((pkg) => pkg.publishResult.type === "skipped")) return "skipped";
|
|
116
121
|
return plan;
|
|
@@ -123,7 +128,8 @@ function tegami(options = {}) {
|
|
|
123
128
|
reason: "no-plan"
|
|
124
129
|
};
|
|
125
130
|
await runPreflights(context, plan);
|
|
126
|
-
|
|
131
|
+
const { status } = await publishPlanStatus(plan, context);
|
|
132
|
+
if (status !== "success") return {
|
|
127
133
|
state: "skipped",
|
|
128
134
|
reason: "pending"
|
|
129
135
|
};
|
|
@@ -1,18 +1,178 @@
|
|
|
1
1
|
import { a as isNodeError, c as joinPath, n as execFailure, r as fetchFailure } from "./error-CAsrGb6e.js";
|
|
2
|
-
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-
|
|
3
|
-
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-
|
|
4
|
-
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-
|
|
5
|
-
import { t as _assertGuard } from "./_assertGuard-
|
|
6
|
-
import { n as WorkspacePackage } from "./graph-
|
|
2
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DW_6Xqcp.js";
|
|
3
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-CrRqJgaE.js";
|
|
4
|
+
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-DAMkayLs.js";
|
|
5
|
+
import { t as _assertGuard } from "./_assertGuard-CFFC1Up9.js";
|
|
6
|
+
import { n as WorkspacePackage } from "./graph-DaJ28Y4f.js";
|
|
7
7
|
import fs, { readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import path, { join } from "node:path";
|
|
9
9
|
import { x } from "tinyexec";
|
|
10
10
|
import * as semver$1 from "semver";
|
|
11
|
-
import { parseDocument } from "yaml";
|
|
12
|
-
import
|
|
11
|
+
import { isSeq, parseDocument } from "yaml";
|
|
12
|
+
import process from "node:process";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
14
|
import { intro, note, outro } from "@clack/prompts";
|
|
15
15
|
import { glob } from "tinyglobby";
|
|
16
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
17
|
+
const AGENTS = [
|
|
18
|
+
"npm",
|
|
19
|
+
"yarn",
|
|
20
|
+
"yarn@berry",
|
|
21
|
+
"pnpm",
|
|
22
|
+
"pnpm@6",
|
|
23
|
+
"bun",
|
|
24
|
+
"deno",
|
|
25
|
+
"nub",
|
|
26
|
+
"aube"
|
|
27
|
+
];
|
|
28
|
+
const LOCKS = {
|
|
29
|
+
"aube-lock.yaml": "aube",
|
|
30
|
+
"aube-workspace.yaml": "aube",
|
|
31
|
+
"bun.lock": "bun",
|
|
32
|
+
"bun.lockb": "bun",
|
|
33
|
+
"deno.lock": "deno",
|
|
34
|
+
"pnpm-lock.yaml": "pnpm",
|
|
35
|
+
"pnpm-workspace.yaml": "pnpm",
|
|
36
|
+
"yarn.lock": "yarn",
|
|
37
|
+
"package-lock.json": "npm",
|
|
38
|
+
"npm-shrinkwrap.json": "npm"
|
|
39
|
+
};
|
|
40
|
+
const INSTALL_METADATA = {
|
|
41
|
+
"node_modules/.aube/": "aube",
|
|
42
|
+
"node_modules/.deno/": "deno",
|
|
43
|
+
"node_modules/.pnpm/": "pnpm",
|
|
44
|
+
"node_modules/.yarn-state.yml": "yarn",
|
|
45
|
+
"node_modules/.yarn_integrity": "yarn",
|
|
46
|
+
"node_modules/.package-lock.json": "npm",
|
|
47
|
+
".pnp.cjs": "yarn",
|
|
48
|
+
".pnp.js": "yarn",
|
|
49
|
+
"bun.lock": "bun",
|
|
50
|
+
"bun.lockb": "bun"
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
54
|
+
async function pathExists(path2, type) {
|
|
55
|
+
try {
|
|
56
|
+
const stat = await fs.stat(path2);
|
|
57
|
+
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function* lookup(cwd = process.cwd()) {
|
|
63
|
+
let directory = path.resolve(cwd);
|
|
64
|
+
const { root } = path.parse(directory);
|
|
65
|
+
while (directory && directory !== root) {
|
|
66
|
+
yield directory;
|
|
67
|
+
directory = path.dirname(directory);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function parsePackageJson(filepath, options) {
|
|
71
|
+
if (!filepath || !await pathExists(filepath, "file")) return null;
|
|
72
|
+
return await handlePackageManager(filepath, options);
|
|
73
|
+
}
|
|
74
|
+
async function detect(options = {}) {
|
|
75
|
+
const { cwd, strategies = [
|
|
76
|
+
"lockfile",
|
|
77
|
+
"packageManager-field",
|
|
78
|
+
"devEngines-field"
|
|
79
|
+
] } = options;
|
|
80
|
+
let stopDir;
|
|
81
|
+
if (typeof options.stopDir === "string") {
|
|
82
|
+
const resolved = path.resolve(options.stopDir);
|
|
83
|
+
stopDir = (dir) => dir === resolved;
|
|
84
|
+
} else stopDir = options.stopDir;
|
|
85
|
+
for (const directory of lookup(cwd)) {
|
|
86
|
+
for (const strategy of strategies) switch (strategy) {
|
|
87
|
+
case "lockfile":
|
|
88
|
+
for (const lock of Object.keys(LOCKS)) if (await pathExists(path.join(directory, lock), "file")) {
|
|
89
|
+
const name = LOCKS[lock];
|
|
90
|
+
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
91
|
+
if (result) return result;
|
|
92
|
+
else return {
|
|
93
|
+
name,
|
|
94
|
+
agent: name
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case "packageManager-field":
|
|
99
|
+
case "devEngines-field": {
|
|
100
|
+
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
101
|
+
if (result) return result;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case "install-metadata":
|
|
105
|
+
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
106
|
+
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
107
|
+
if (await pathExists(path.join(directory, metadata), fileOrDir)) {
|
|
108
|
+
const name = INSTALL_METADATA[metadata];
|
|
109
|
+
return {
|
|
110
|
+
name,
|
|
111
|
+
agent: name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (stopDir?.(directory)) break;
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
function getNameAndVer(pkg) {
|
|
122
|
+
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
123
|
+
if (typeof pkg.packageManager === "string") {
|
|
124
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
125
|
+
return {
|
|
126
|
+
name,
|
|
127
|
+
ver: handelVer(ver)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (typeof pkg.devEngines?.packageManager?.name === "string") return {
|
|
131
|
+
name: pkg.devEngines.packageManager.name,
|
|
132
|
+
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function handlePackageManager(filepath, options) {
|
|
136
|
+
try {
|
|
137
|
+
const content = await fs.readFile(filepath, "utf8");
|
|
138
|
+
const pkg = options.packageJsonParser ? await options.packageJsonParser(content, filepath) : JSON.parse(content);
|
|
139
|
+
let agent;
|
|
140
|
+
const nameAndVer = getNameAndVer(pkg);
|
|
141
|
+
if (nameAndVer) {
|
|
142
|
+
const name = nameAndVer.name;
|
|
143
|
+
const ver = nameAndVer.ver;
|
|
144
|
+
let version = ver;
|
|
145
|
+
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
146
|
+
agent = "yarn@berry";
|
|
147
|
+
version = "berry";
|
|
148
|
+
return {
|
|
149
|
+
name,
|
|
150
|
+
agent,
|
|
151
|
+
version
|
|
152
|
+
};
|
|
153
|
+
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
154
|
+
agent = "pnpm@6";
|
|
155
|
+
return {
|
|
156
|
+
name,
|
|
157
|
+
agent,
|
|
158
|
+
version
|
|
159
|
+
};
|
|
160
|
+
} else if (AGENTS.includes(name)) {
|
|
161
|
+
agent = name;
|
|
162
|
+
return {
|
|
163
|
+
name,
|
|
164
|
+
agent,
|
|
165
|
+
version
|
|
166
|
+
};
|
|
167
|
+
} else return options.onUnknown?.(pkg.packageManager) ?? null;
|
|
168
|
+
}
|
|
169
|
+
} catch {}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
function isMetadataYarnClassic(metadataPath) {
|
|
173
|
+
return metadataPath.endsWith(".yarn_integrity");
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
16
176
|
//#region src/providers/npm/cli.ts
|
|
17
177
|
const PLACEHOLDER_VERSION = "0.0.0-tegami-trusted-publish-setup";
|
|
18
178
|
const PLACEHOLDER_DIST_TAG = "temp";
|
|
@@ -87,17 +247,16 @@ async function publishPlaceholder(pkg) {
|
|
|
87
247
|
const access = pkg.manifest.publishConfig?.access;
|
|
88
248
|
const dir = await fs.mkdtemp(join(tmpdir(), "tegami-npm-placeholder-"));
|
|
89
249
|
try {
|
|
90
|
-
await fs.writeFile(join(dir, "package.json"), `${JSON.stringify({
|
|
250
|
+
await Promise.all([fs.writeFile(join(dir, "package.json"), `${JSON.stringify({
|
|
91
251
|
name: pkg.name,
|
|
92
252
|
version: PLACEHOLDER_VERSION,
|
|
93
253
|
description: "Placeholder published by Tegami for npm trusted publishing setup."
|
|
94
|
-
}, null, 2)}\n`)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`);
|
|
254
|
+
}, null, 2)}\n`), fs.writeFile(join(dir, "README.md"), `# Placeholder package
|
|
255
|
+
|
|
256
|
+
This empty package was published by [Tegami](https://tegami.fuma-nama.dev) to configure npm trusted publishing.
|
|
257
|
+
|
|
258
|
+
The real package contents will be published via CI with OIDC.
|
|
259
|
+
`)]);
|
|
101
260
|
const args = [
|
|
102
261
|
"publish",
|
|
103
262
|
"--tag",
|
|
@@ -188,99 +347,6 @@ var NpmPackage = class extends WorkspacePackage {
|
|
|
188
347
|
return this.dependencies ??= listDependencies(graph, this);
|
|
189
348
|
}
|
|
190
349
|
};
|
|
191
|
-
const assertPnpmWorkspace = (() => {
|
|
192
|
-
const _io0 = (input) => (void 0 === input.packages || Array.isArray(input.packages) && input.packages.every((elem) => "string" === typeof elem)) && (void 0 === input.catalog || "object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) && _io1(input.catalog)) && (void 0 === input.catalogs || "object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) && _io2(input.catalogs));
|
|
193
|
-
const _io1 = (input) => Object.keys(input).every((key) => {
|
|
194
|
-
const value = input[key];
|
|
195
|
-
if (void 0 === value) return true;
|
|
196
|
-
return "string" === typeof value;
|
|
197
|
-
});
|
|
198
|
-
const _io2 = (input) => Object.keys(input).every((key) => {
|
|
199
|
-
const value = input[key];
|
|
200
|
-
if (void 0 === value) return true;
|
|
201
|
-
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io1(value);
|
|
202
|
-
});
|
|
203
|
-
const _ao0 = (input, _path, _exceptionable = true) => (void 0 === input.packages || (Array.isArray(input.packages) || _assertGuard(_exceptionable, {
|
|
204
|
-
method: "typia.createAssert",
|
|
205
|
-
path: _path + ".packages",
|
|
206
|
-
expected: "(Array<string> | undefined)",
|
|
207
|
-
value: input.packages
|
|
208
|
-
}, _errorFactory)) && input.packages.every((elem, _index2) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
209
|
-
method: "typia.createAssert",
|
|
210
|
-
path: _path + ".packages[" + _index2 + "]",
|
|
211
|
-
expected: "string",
|
|
212
|
-
value: elem
|
|
213
|
-
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
214
|
-
method: "typia.createAssert",
|
|
215
|
-
path: _path + ".packages",
|
|
216
|
-
expected: "(Array<string> | undefined)",
|
|
217
|
-
value: input.packages
|
|
218
|
-
}, _errorFactory)) && (void 0 === input.catalog || ("object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) || _assertGuard(_exceptionable, {
|
|
219
|
-
method: "typia.createAssert",
|
|
220
|
-
path: _path + ".catalog",
|
|
221
|
-
expected: "(Record<string, string> | undefined)",
|
|
222
|
-
value: input.catalog
|
|
223
|
-
}, _errorFactory)) && _ao1(input.catalog, _path + ".catalog", _exceptionable) || _assertGuard(_exceptionable, {
|
|
224
|
-
method: "typia.createAssert",
|
|
225
|
-
path: _path + ".catalog",
|
|
226
|
-
expected: "(Record<string, string> | undefined)",
|
|
227
|
-
value: input.catalog
|
|
228
|
-
}, _errorFactory)) && (void 0 === input.catalogs || ("object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) || _assertGuard(_exceptionable, {
|
|
229
|
-
method: "typia.createAssert",
|
|
230
|
-
path: _path + ".catalogs",
|
|
231
|
-
expected: "(Record<string, Record<string, string>> | undefined)",
|
|
232
|
-
value: input.catalogs
|
|
233
|
-
}, _errorFactory)) && _ao2(input.catalogs, _path + ".catalogs", _exceptionable) || _assertGuard(_exceptionable, {
|
|
234
|
-
method: "typia.createAssert",
|
|
235
|
-
path: _path + ".catalogs",
|
|
236
|
-
expected: "(Record<string, Record<string, string>> | undefined)",
|
|
237
|
-
value: input.catalogs
|
|
238
|
-
}, _errorFactory));
|
|
239
|
-
const _ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
240
|
-
const value = input[key];
|
|
241
|
-
if (void 0 === value) return true;
|
|
242
|
-
return "string" === typeof value || _assertGuard(_exceptionable, {
|
|
243
|
-
method: "typia.createAssert",
|
|
244
|
-
path: _path + _accessExpressionAsString(key),
|
|
245
|
-
expected: "string",
|
|
246
|
-
value
|
|
247
|
-
}, _errorFactory);
|
|
248
|
-
});
|
|
249
|
-
const _ao2 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
250
|
-
const value = input[key];
|
|
251
|
-
if (void 0 === value) return true;
|
|
252
|
-
return ("object" === typeof value && null !== value && false === Array.isArray(value) || _assertGuard(_exceptionable, {
|
|
253
|
-
method: "typia.createAssert",
|
|
254
|
-
path: _path + _accessExpressionAsString(key),
|
|
255
|
-
expected: "Record<string, string>",
|
|
256
|
-
value
|
|
257
|
-
}, _errorFactory)) && _ao1(value, _path + _accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
|
|
258
|
-
method: "typia.createAssert",
|
|
259
|
-
path: _path + _accessExpressionAsString(key),
|
|
260
|
-
expected: "Record<string, string>",
|
|
261
|
-
value
|
|
262
|
-
}, _errorFactory);
|
|
263
|
-
});
|
|
264
|
-
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
265
|
-
let _errorFactory;
|
|
266
|
-
return (input, errorFactory) => {
|
|
267
|
-
if (false === __is(input)) {
|
|
268
|
-
_errorFactory = errorFactory;
|
|
269
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard(true, {
|
|
270
|
-
method: "typia.createAssert",
|
|
271
|
-
path: _path + "",
|
|
272
|
-
expected: "PnpmWorkspace",
|
|
273
|
-
value: input
|
|
274
|
-
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
|
|
275
|
-
method: "typia.createAssert",
|
|
276
|
-
path: _path + "",
|
|
277
|
-
expected: "PnpmWorkspace",
|
|
278
|
-
value: input
|
|
279
|
-
}, _errorFactory))(input, "$input", true);
|
|
280
|
-
}
|
|
281
|
-
return input;
|
|
282
|
-
};
|
|
283
|
-
})();
|
|
284
350
|
const assertPackageManifest = (() => {
|
|
285
351
|
const _io0 = (input) => "string" === typeof input.name && (void 0 === input.version || "string" === typeof input.version) && (void 0 === input["private"] || "boolean" === typeof input["private"]) && (void 0 === input.publishConfig || "object" === typeof input.publishConfig && null !== input.publishConfig && false === Array.isArray(input.publishConfig) && _io1(input.publishConfig)) && (void 0 === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && _io2(input.scripts)) && null !== input.workspaces && (void 0 === input.workspaces || Array.isArray(input.workspaces) && input.workspaces.every((elem) => "string" === typeof elem) || "object" === typeof input.workspaces && null !== input.workspaces && false === Array.isArray(input.workspaces) && _io3(input.workspaces)) && (void 0 === input.catalog || "object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) && _io2(input.catalog)) && (void 0 === input.catalogs || "object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) && _io4(input.catalogs)) && (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io2(input.dependencies)) && (void 0 === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && _io2(input.devDependencies)) && (void 0 === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && _io2(input.peerDependencies)) && (void 0 === input.optionalDependencies || "object" === typeof input.optionalDependencies && null !== input.optionalDependencies && false === Array.isArray(input.optionalDependencies) && _io2(input.optionalDependencies));
|
|
286
352
|
const _io1 = (input) => (void 0 === input.access || "public" === input.access || "restricted" === input.access) && (void 0 === input.registry || "string" === typeof input.registry) && (void 0 === input.tag || "string" === typeof input.tag);
|
|
@@ -613,22 +679,36 @@ async function resolveNpmGraph(cwd, client) {
|
|
|
613
679
|
if (Array.isArray(rootManifest.workspaces)) patterns.push(...rootManifest.workspaces);
|
|
614
680
|
else if (rootManifest.workspaces?.packages) patterns.push(...rootManifest.workspaces.packages);
|
|
615
681
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
682
|
+
let workspaceFiles;
|
|
683
|
+
switch (client) {
|
|
684
|
+
case "pnpm":
|
|
685
|
+
workspaceFiles = ["pnpm-workspace.yaml"];
|
|
686
|
+
break;
|
|
687
|
+
case "nub":
|
|
688
|
+
workspaceFiles = ["pnpm-workspace.yaml"];
|
|
689
|
+
break;
|
|
690
|
+
case "aube":
|
|
691
|
+
workspaceFiles = ["pnpm-workspace.yaml", "aube-workspace.yaml"];
|
|
692
|
+
break;
|
|
693
|
+
case "yarn":
|
|
694
|
+
const yarnCatalog = await readYarnCatalog(cwd);
|
|
695
|
+
if (yarnCatalog) catalogSources.push(yarnCatalog);
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
if (workspaceFiles) await Promise.all(workspaceFiles.map(async (name) => {
|
|
699
|
+
const filePath = path.join(cwd, name);
|
|
700
|
+
const content = await readFile(filePath, "utf8").catch((error) => {
|
|
619
701
|
if (isNodeError(error) && error.code === "ENOENT") return void 0;
|
|
620
702
|
throw error;
|
|
621
703
|
});
|
|
622
|
-
if (content)
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
704
|
+
if (!content) return;
|
|
705
|
+
const doc = parseDocument(content);
|
|
706
|
+
const packages = doc.get("packages");
|
|
707
|
+
catalogSources.push(createWorkspaceCatalogSource(filePath, doc));
|
|
708
|
+
if (isSeq(packages)) {
|
|
709
|
+
for (const pkg of packages.toJSON()) if (typeof pkg === "string") patterns.push(pkg);
|
|
627
710
|
}
|
|
628
|
-
}
|
|
629
|
-
const yarnCatalog = await readYarnCatalog(cwd);
|
|
630
|
-
if (yarnCatalog) catalogSources.push(yarnCatalog);
|
|
631
|
-
}
|
|
711
|
+
}));
|
|
632
712
|
if (patterns?.length) {
|
|
633
713
|
const candidatePaths = await expandWorkspacePatterns(cwd, patterns);
|
|
634
714
|
await Promise.all(candidatePaths.map(async (packagePath) => {
|
|
@@ -714,7 +794,7 @@ async function readManifest(packagePath) {
|
|
|
714
794
|
assertPackageManifest(parsed);
|
|
715
795
|
return parsed;
|
|
716
796
|
}
|
|
717
|
-
function
|
|
797
|
+
function createWorkspaceCatalogSource(filePath, doc) {
|
|
718
798
|
return {
|
|
719
799
|
resolve(name, catalogName) {
|
|
720
800
|
const value = doc.getIn(catalogName === "default" ? ["catalog", name] : [
|
|
@@ -886,10 +966,8 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
886
966
|
return "major";
|
|
887
967
|
}
|
|
888
968
|
} } = {}) {
|
|
889
|
-
let active = false;
|
|
890
969
|
return {
|
|
891
970
|
name: "npm",
|
|
892
|
-
enforce: "pre",
|
|
893
971
|
async init() {
|
|
894
972
|
if (defaultClient) this.npm = {
|
|
895
973
|
client: defaultClient,
|
|
@@ -909,7 +987,6 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
909
987
|
if (graph.packages.size === 0) return;
|
|
910
988
|
this.npm.graph = graph;
|
|
911
989
|
for (const pkg of graph.packages.values()) this.graph.add(pkg);
|
|
912
|
-
active = true;
|
|
913
990
|
},
|
|
914
991
|
async publishPreflight({ pkg }) {
|
|
915
992
|
if (!(pkg instanceof NpmPackage) || !this.npm?.graph) return;
|
|
@@ -921,7 +998,7 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
921
998
|
};
|
|
922
999
|
},
|
|
923
1000
|
resolvePlanStatus({ plan }) {
|
|
924
|
-
if (!
|
|
1001
|
+
if (!this.npm?.graph) return;
|
|
925
1002
|
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
926
1003
|
if (!preflight.shouldPublish) return;
|
|
927
1004
|
const pkg = this.graph.get(id);
|
|
@@ -979,11 +1056,11 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
979
1056
|
return result;
|
|
980
1057
|
},
|
|
981
1058
|
initDraft(plan) {
|
|
982
|
-
if (!
|
|
1059
|
+
if (!this.npm?.graph) return;
|
|
983
1060
|
plan.addPolicy(depsPolicy(this, getBumpDepType));
|
|
984
1061
|
},
|
|
985
1062
|
async applyDraft(draft) {
|
|
986
|
-
if (!
|
|
1063
|
+
if (!this.npm?.graph) return;
|
|
987
1064
|
const npmGraph = this.npm.graph;
|
|
988
1065
|
const writes = [];
|
|
989
1066
|
for (const pkg of npmGraph.packages.values()) {
|
|
@@ -1010,11 +1087,13 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
1010
1087
|
await Promise.all(writes);
|
|
1011
1088
|
},
|
|
1012
1089
|
async applyCliDraft() {
|
|
1013
|
-
if (!this.npm || !
|
|
1090
|
+
if (!this.npm?.graph || !updateLockFile) return;
|
|
1014
1091
|
let args;
|
|
1015
1092
|
switch (this.npm.agent) {
|
|
1016
1093
|
case "pnpm":
|
|
1017
1094
|
case "pnpm@6":
|
|
1095
|
+
case "aube":
|
|
1096
|
+
case "nub":
|
|
1018
1097
|
args = [
|
|
1019
1098
|
"install",
|
|
1020
1099
|
"--lockfile-only",
|
|
@@ -1137,11 +1216,20 @@ async function publish(client, pkg, distTag) {
|
|
|
1137
1216
|
let command;
|
|
1138
1217
|
const args = ["publish"];
|
|
1139
1218
|
if (distTag) args.push("--tag", distTag);
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1219
|
+
switch (client) {
|
|
1220
|
+
case "pnpm":
|
|
1221
|
+
command = "pnpm";
|
|
1222
|
+
args.push("--no-git-checks");
|
|
1223
|
+
break;
|
|
1224
|
+
case "aube":
|
|
1225
|
+
case "nub":
|
|
1226
|
+
case "yarn":
|
|
1227
|
+
command = client;
|
|
1228
|
+
break;
|
|
1229
|
+
default:
|
|
1230
|
+
command = "npm";
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1145
1233
|
const result = await x(command, args, { nodeOptions: { cwd: pkg.path } });
|
|
1146
1234
|
if (result.exitCode !== 0) return {
|
|
1147
1235
|
type: "failed",
|
package/dist/plugins/cargo.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as CargoPluginOptions, E as CargoPackage, O as cargo, T as CargoGraph } from "../types-BMYzG4dR.js";
|
|
2
2
|
export { CargoGraph, CargoPackage, CargoPluginOptions, cargo };
|