@intentius/chant 0.124.104 → 0.124.105
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/capabilities/templates.d.ts +66 -3
- package/dist/capabilities/templates.js +220 -81
- package/dist/cli/handlers/release-doctor.js +8 -3
- package/dist/cli/handlers/release-init.js +7 -4
- package/dist/cli/handlers/search.d.ts +1 -1
- package/dist/cli/handlers/search.js +24 -2
- package/dist/cli/parse-args.js +2 -2
- package/dist/cli/release-commands/doctor.js +5 -2
- package/dist/cloud-lister/aws.d.ts +9 -0
- package/dist/cloud-lister/aws.js +20 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +2 -0
- package/dist/floor-table.data.js +1 -0
- package/dist/graph-refs.d.ts +13 -0
- package/dist/graph-refs.js +11 -4
- package/dist/lifecycle/derive-edges.d.ts +1 -1
- package/dist/lifecycle/derive-edges.js +5 -3
- package/dist/lifecycle/index-import.d.ts +12 -5
- package/dist/lifecycle/index-import.js +38 -9
- package/dist/lifecycle/release-artifacts.js +3 -1
- package/dist/lifecycle/release-at.d.ts +5 -1
- package/dist/lifecycle/release-at.js +69 -4
- package/dist/lifecycle/release-doctor.d.ts +10 -0
- package/dist/lifecycle/release-doctor.js +84 -14
- package/dist/lifecycle/release-green.d.ts +5 -2
- package/dist/lifecycle/release-green.js +40 -8
- package/dist/lifecycle/release-images.d.ts +7 -1
- package/dist/lifecycle/release-images.js +14 -5
- package/dist/lifecycle/release-init.d.ts +16 -7
- package/dist/lifecycle/release-init.js +212 -45
- package/dist/lifecycle/release-next.d.ts +1 -1
- package/dist/lifecycle/release-next.js +9 -4
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +38 -38
- package/dist/workspace/capabilities-contract.d.ts +15 -5
- package/dist/workspace/capabilities-contract.js +7 -4
- package/dist/workspace/capabilities.schema.json +45 -1
- package/dist/workspace/release-changed.d.ts +2 -0
- package/dist/workspace/release-changed.js +7 -2
- package/dist/workspace/release-steps/doctor.js +2 -1
- package/dist/workspace/train-cut.js +2 -2
- package/package.json +1 -1
|
@@ -771,9 +771,17 @@ export function planRelease(facts, opts) {
|
|
|
771
771
|
}
|
|
772
772
|
/** The environment a planned train is recorded for. */
|
|
773
773
|
export const TRAIN_ENV = "npm";
|
|
774
|
+
/** The directory a train member init makes for what no workspace package holds (#5271), from the project root. */
|
|
775
|
+
export const TRAIN_OWN_DIR = "release";
|
|
776
|
+
/** The rule by which init gives a train member what the project builds besides its packages (#5271), as the plan's reasons print it. */
|
|
777
|
+
export const TRAIN_OWNERSHIP_RULE = `an image, chart or Python or Rust package belongs to the train member whose directory holds its file; what no member's directory holds gets a member of its own at ${TRAIN_OWN_DIR}/<name>, one per directory, whose entries name the files with ../.. and whose release.sources names that directory, so release changed releases it when the files change`;
|
|
778
|
+
/** A workspace package a train releases: an npm package, or a VS Code extension (#5271). */
|
|
779
|
+
const trainPackage = (p) => p.name !== null && !p.private;
|
|
774
780
|
/**
|
|
775
781
|
* Whether the project's npm, pnpm or yarn workspaces can release as a train:
|
|
776
|
-
* one member per publishable package
|
|
782
|
+
* one member per publishable package or VS Code extension (#5154, #5271),
|
|
783
|
+
* with the images, charts and Python or Rust package beside them given to a
|
|
784
|
+
* member by {@link TRAIN_OWNERSHIP_RULE}. `why` says why a project with
|
|
777
785
|
* several packages gets one release instead, and is null for a project with
|
|
778
786
|
* fewer than two.
|
|
779
787
|
*/
|
|
@@ -781,28 +789,20 @@ export function trainFit(facts) {
|
|
|
781
789
|
const node = facts.node;
|
|
782
790
|
if (!node?.workspaces)
|
|
783
791
|
return { train: false, why: null };
|
|
784
|
-
const
|
|
785
|
-
const
|
|
786
|
-
const rootPublished = published(node.root);
|
|
792
|
+
const packages = node.workspaces.filter(trainPackage);
|
|
793
|
+
const rootPublished = trainPackage(node.root);
|
|
787
794
|
if (packages.length + (rootPublished ? 1 : 0) < 2)
|
|
788
795
|
return { train: false, why: null };
|
|
789
796
|
if (rootPublished)
|
|
790
797
|
return { train: false, why: `the root package ${node.root.name} is published too, and a train releases the packages below the root` };
|
|
791
|
-
const ext = [node.root, ...node.workspaces].find((p) => p.vscode && !p.private && p.name);
|
|
792
|
-
if (ext)
|
|
793
|
-
return { train: false, why: `${ext.name} is a VS Code extension, and release init makes a train's members of npm packages only` };
|
|
794
798
|
if (facts.goreleaser)
|
|
795
|
-
return { train: false, why: `${facts.goreleaser.file}
|
|
796
|
-
if (facts.dockerfiles.length > 0)
|
|
797
|
-
return { train: false, why: `${facts.dockerfiles[0]} builds an image, and release init makes a train's members of npm packages only, with none to build it` };
|
|
798
|
-
if ((facts.charts?.length ?? 0) > 0)
|
|
799
|
-
return { train: false, why: `${facts.charts[0].dir}/Chart.yaml is a chart packed at the cut, and release init makes a train's members of npm packages only, with none to pack it` };
|
|
799
|
+
return { train: false, why: `${facts.goreleaser.file} runs goreleaser at the repository root, and a train member runs it in its own directory, where its builds and dist would not be the root's` };
|
|
800
800
|
if (facts.nfpm)
|
|
801
|
-
return { train: false, why: `${facts.nfpm.file}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
if (
|
|
805
|
-
return { train: false, why:
|
|
801
|
+
return { train: false, why: `${facts.nfpm.file} packs files by paths from the repository root, and a train member runs nfpm in its own directory` };
|
|
802
|
+
const r = facts.registries;
|
|
803
|
+
const other = r?.maven ? "pom.xml" : r?.dotnet ? r.dotnet.projects[0].file : r?.ruby ? r.ruby.gemspec : null;
|
|
804
|
+
if (other)
|
|
805
|
+
return { train: false, why: `${other} builds at the repository root, and release init makes no train member for it` };
|
|
806
806
|
return { train: true };
|
|
807
807
|
}
|
|
808
808
|
/** A workspace member name (lowercase letters, digits and dashes, at most 40) for a package. */
|
|
@@ -815,10 +815,15 @@ function ownPrefixes(h, pkg, member) {
|
|
|
815
815
|
const names = new Set([pkg.name, pkg.name?.replace(/^@[^/]+\//, ""), member, pkg.dir, posix.basename(pkg.dir)].filter((n) => !!n));
|
|
816
816
|
return [h.prefix, ...h.others.map((o) => o.prefix)].filter((p) => p !== null && p !== "" && names.has(p.replace(/[/@_-]v?$/, "")));
|
|
817
817
|
}
|
|
818
|
+
/** `path` (from the project root) relative to `dir`, `.` for the directory itself. */
|
|
819
|
+
const relTo = (dir, path) => posix.relative(dir === "." ? "" : dir, path === "." ? "" : path) || ".";
|
|
818
820
|
/**
|
|
819
821
|
* Plan a train for a project {@link trainFit} accepts: a member per
|
|
820
|
-
* publishable workspace package, each stamping and
|
|
821
|
-
* package,
|
|
822
|
+
* publishable workspace package or VS Code extension, each stamping and
|
|
823
|
+
* publishing its own package, the images and charts each member's
|
|
824
|
+
* directory holds, a member at `release/<name>` for each other directory
|
|
825
|
+
* that holds an image, a chart, or a Python or Rust package (#5271), and the
|
|
826
|
+
* root's `release.train` with a dispatched workflow.
|
|
822
827
|
*/
|
|
823
828
|
export function planTrain(facts, opts) {
|
|
824
829
|
const node = facts.node;
|
|
@@ -826,86 +831,248 @@ export function planTrain(facts, opts) {
|
|
|
826
831
|
const notes = [];
|
|
827
832
|
const registry = [];
|
|
828
833
|
const forge = facts.workflowForge;
|
|
829
|
-
const
|
|
834
|
+
const named = node.workspaces.filter((p) => p.name);
|
|
835
|
+
const packages = dependencyOrder(named.filter(trainPackage));
|
|
836
|
+
const npmPackages = packages.filter((p) => !p.vscode);
|
|
837
|
+
const { file: workflowFile, adopted } = releaseWorkflowFile(facts, npmPackages.length > 0, notes);
|
|
830
838
|
const workflowName = posix.basename(workflowFile);
|
|
831
839
|
const env = TRAIN_ENV;
|
|
832
|
-
const
|
|
833
|
-
const packages = dependencyOrder(named.filter((p) => !p.private && !p.vscode));
|
|
840
|
+
const repo = facts.origin?.repo ?? "this repository";
|
|
834
841
|
const skipped = named.filter((p) => p.private);
|
|
835
842
|
const names = new Set(packages.map((p) => p.name));
|
|
836
843
|
const greenReasons = [];
|
|
837
844
|
const green = greenOf(facts, greenReasons, notes);
|
|
845
|
+
const workflow = { trigger: "dispatch" };
|
|
846
|
+
const addEnv = (k, v) => void (workflow.env = { ...(workflow.env ?? {}), [k]: v });
|
|
838
847
|
// Member names, unique.
|
|
839
848
|
const used = new Set();
|
|
840
|
-
const
|
|
841
|
-
const base = memberNameOf(p);
|
|
849
|
+
const unique = (base) => {
|
|
842
850
|
let name = base;
|
|
843
851
|
for (let i = 2; used.has(name); i++)
|
|
844
852
|
name = `${base.slice(0, 38)}-${i}`;
|
|
845
853
|
used.add(name);
|
|
846
854
|
return name;
|
|
847
|
-
}
|
|
848
|
-
// Tags: a
|
|
855
|
+
};
|
|
856
|
+
// Tags: a member's own history keeps its prefix; tags shared by every member are the root's legacy tags.
|
|
849
857
|
const h = facts.tags;
|
|
850
858
|
const claimed = new Set();
|
|
851
|
-
const
|
|
852
|
-
const
|
|
853
|
-
const own = ownPrefixes(h, p, name);
|
|
859
|
+
const tagged = (release, who, name) => {
|
|
860
|
+
const own = ownPrefixes(h, who, name);
|
|
854
861
|
for (const o of own)
|
|
855
862
|
claimed.add(o);
|
|
856
863
|
const template = own.find(templatePrefix);
|
|
857
|
-
|
|
864
|
+
release.tag = template ? `${template}{version}` : "{member}/v{version}";
|
|
858
865
|
const legacy = own.filter((o) => o !== template);
|
|
859
866
|
if (legacy.length > 0)
|
|
860
867
|
release.legacyTags = legacy;
|
|
861
868
|
release.green = green;
|
|
869
|
+
};
|
|
870
|
+
const members = packages.map((p) => {
|
|
871
|
+
const name = unique(memberNameOf(p));
|
|
872
|
+
const release = {};
|
|
873
|
+
tagged(release, p, name);
|
|
862
874
|
const internal = p.deps.some((d) => names.has(d) && d !== p.name);
|
|
863
875
|
release.version = internal ? { packages: ["."], ranges: "train" } : { packages: ["."] };
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
876
|
+
const publish = [];
|
|
877
|
+
const what = [];
|
|
878
|
+
if (p.vscode) {
|
|
879
|
+
const vsix = `dist/${p.name.replace(/^@[^/]+\//, "")}.vsix`;
|
|
880
|
+
publish.push({ type: "marketplace", marketplace: "vscode", vsix }, { type: "marketplace", marketplace: "openvsx", vsix, auth: "trusted-publishing" });
|
|
881
|
+
what.push(`${p.name} stamped with its label and published to the VS Code Marketplace and Open VSX from ${vsix}`);
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
const target = { type: "npm", packages: ["."] };
|
|
885
|
+
if (p.name.startsWith("@") && p.access === null)
|
|
886
|
+
target.access = "public";
|
|
887
|
+
publish.push(target);
|
|
888
|
+
what.push(`${p.name} stamped with its label and published to npm${target.access ? ' with access "public"' : ""}`);
|
|
889
|
+
}
|
|
890
|
+
release.publish = publish;
|
|
891
|
+
return { name, dir: p.dir, package: p.name, release, what, source: p.dir, npm: !p.vscode };
|
|
869
892
|
});
|
|
893
|
+
// #5271: what the members' directories don't hold gets a member at release/<name>, one per directory.
|
|
894
|
+
const ownerOf = (path) => {
|
|
895
|
+
let best = null;
|
|
896
|
+
for (const m of members)
|
|
897
|
+
if (m.package !== null && (path === m.dir || path.startsWith(`${m.dir}/`)) && (!best || m.dir.length > best.dir.length))
|
|
898
|
+
best = m;
|
|
899
|
+
return best;
|
|
900
|
+
};
|
|
901
|
+
const fallbackName = facts.origin?.repo.split("/").pop() ?? node.root.name?.replace(/^@[^/]+\//, "") ?? "app";
|
|
902
|
+
const ownMember = (source, base) => {
|
|
903
|
+
const found = members.find((m) => m.package === null && m.source === source);
|
|
904
|
+
if (found)
|
|
905
|
+
return found;
|
|
906
|
+
const name = unique(memberNameOf({ name: base, dir: source === "." ? fallbackName : source }));
|
|
907
|
+
const back = relTo(`${TRAIN_OWN_DIR}/${name}`, source);
|
|
908
|
+
const release = {};
|
|
909
|
+
tagged(release, { name: null, dir: `${TRAIN_OWN_DIR}/${name}` }, name);
|
|
910
|
+
release.sources = [back];
|
|
911
|
+
const m = { name, dir: `${TRAIN_OWN_DIR}/${name}`, package: null, release, what: [], source, npm: false };
|
|
912
|
+
members.push(m);
|
|
913
|
+
return m;
|
|
914
|
+
};
|
|
915
|
+
/** A path from the project root as the member names it: from its own directory, or back from release/<name>. */
|
|
916
|
+
const fromMember = (m, path) => relTo(m.dir, path);
|
|
917
|
+
const push = (m, key, v) => void (m.release[key] = [...(m.release[key] ?? []), v]);
|
|
918
|
+
const stampFile = (m, file) => {
|
|
919
|
+
const version = m.release.version ?? {};
|
|
920
|
+
m.release.version = { ...version, files: [...(version.files ?? []), fromMember(m, file)] };
|
|
921
|
+
};
|
|
922
|
+
// Python and Rust packages at the root, before the images, so the root's member is named for the package.
|
|
923
|
+
const py = facts.python;
|
|
924
|
+
const forgejo = forge === "forgejo";
|
|
925
|
+
if (py?.pyproject && py.name) {
|
|
926
|
+
const m = ownMember(".", py.name);
|
|
927
|
+
push(m, "artifacts", { name: "python", build: `python -m pip install build && python -m build --outdir dist ${fromMember(m, ".")}`, outputs: ["dist/*"] });
|
|
928
|
+
push(m, "publish", { type: "pypi", files: ["artifact:python"], auth: forgejo ? "token" : "trusted-publishing" });
|
|
929
|
+
if (py.version)
|
|
930
|
+
stampFile(m, "pyproject.toml");
|
|
931
|
+
else
|
|
932
|
+
notes.push(`pyproject.toml has no static version (it is dynamic, or unset), so member ${m.name} does not stamp it: the build takes the version from wherever the project sets it.`);
|
|
933
|
+
m.what.push(`${py.name} built with python -m build into its own dist and published to PyPI ${forgejo ? "with the token in PYPI_TOKEN" : "with trusted publishing"}${py.version ? ", its label stamped into the root's pyproject.toml" : ""}`);
|
|
934
|
+
if (forgejo) {
|
|
935
|
+
addEnv("PYPI_TOKEN", "${{ secrets.PYPI_TOKEN }}");
|
|
936
|
+
registry.push(`PyPI ${py.name}: create an API token for the project on pypi.org and store it as the secret PYPI_TOKEN; PyPI has no trusted publisher for this forge.`);
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
registry.push(`PyPI ${py.name}: on pypi.org add a trusted publisher to the project's publishing settings (a pending publisher if the project does not exist yet) for ${forge === "gitlab" ? `GitLab CI/CD naming ${repo} and the top-level pipeline file .gitlab-ci.yml` : `GitHub Actions naming ${repo} and the workflow file ${workflowName}`}.${forge === "github" ? " A GitHub publisher can name an environment; leave it empty, since the workflow runs in none." : ""}`);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
else if (py)
|
|
943
|
+
notes.push(`${py.name ?? "The Python package"} is in no member and not published to PyPI: ${py.pyproject ? "pyproject.toml has no [project] name" : "there is no pyproject.toml for python -m build to read"}.`);
|
|
944
|
+
const rs = facts.rust;
|
|
945
|
+
if (rs && !rs.unpublishable && (rs.name || rs.workspace)) {
|
|
946
|
+
const m = ownMember(".", rs.name ?? fallbackName);
|
|
947
|
+
push(m, "publish", { type: "cargo", manifest: fromMember(m, "Cargo.toml") });
|
|
948
|
+
if (rs.version)
|
|
949
|
+
stampFile(m, "Cargo.toml");
|
|
950
|
+
else
|
|
951
|
+
notes.push(`Cargo.toml has no [package] or [workspace.package] version at the root, so member ${m.name} does not stamp it: add the member crates' Cargo.toml files to its release.version.files.`);
|
|
952
|
+
m.what.push(`${rs.name ?? "the workspace's crates"} published with cargo publish from the root's Cargo.toml${rs.version ? ", its label stamped into it" : ""}`);
|
|
953
|
+
registry.push(`crates.io ${rs.name ?? "each crate"}: ${forge === "github" ? `add a trusted publisher to ${rs.name ? "the crate" : "each crate"} on crates.io for GitHub Actions naming ${repo} and the workflow file ${workflowName}. A crate's first version can't be published that way: publish it by hand, or store a token that may publish new crates as the secret CARGO_REGISTRY_TOKEN and set CARGO_REGISTRY_TOKEN: "\${{ secrets.CARGO_REGISTRY_TOKEN }}" in the root's release.workflow.env.` : `create an API token that may publish ${rs.name ? "the crate" : "the crates"} and store it as the ${forge === "gitlab" ? "masked CI/CD variable" : "secret"} CARGO_REGISTRY_TOKEN${forge === "gitlab" ? "." : ", and set CARGO_REGISTRY_TOKEN: \"${{ secrets.CARGO_REGISTRY_TOKEN }}\" in the root's release.workflow.env."}`}`);
|
|
954
|
+
}
|
|
955
|
+
else if (rs)
|
|
956
|
+
notes.push(`${rs.name ?? "The crate"} is in no member and not published to crates.io: ${rs.unpublishable ? "Cargo.toml sets publish = false" : "Cargo.toml has no [package] name or [workspace]"}.`);
|
|
957
|
+
// Images: each in the member whose directory holds its Dockerfile, else in release/<name>.
|
|
958
|
+
const usedImages = new Set();
|
|
959
|
+
const imageCount = facts.dockerfiles.length;
|
|
960
|
+
for (const dockerfile of facts.dockerfiles) {
|
|
961
|
+
let image = imageName(dockerfile, fallbackName);
|
|
962
|
+
while (usedImages.has(image))
|
|
963
|
+
image = `${image}-${usedImages.size}`;
|
|
964
|
+
usedImages.add(image);
|
|
965
|
+
const dir = posix.dirname(dockerfile);
|
|
966
|
+
const m = ownerOf(dockerfile) ?? ownMember(dir, image);
|
|
967
|
+
const context = fromMember(m, dir);
|
|
968
|
+
// In a package npm publishes, the archive is written outside dist, which npm packs.
|
|
969
|
+
const archive = m.npm ? imageArchiveBesideGoreleaser(image) : `dist/images/${image}.tar`;
|
|
970
|
+
push(m, "images", { name: image, dockerfile: fromMember(m, dockerfile), ...(context === "." ? {} : { context }), ...(m.npm ? { archive } : {}) });
|
|
971
|
+
const repository = imageRepository(facts.origin, image, imageCount === 1);
|
|
972
|
+
if (repository) {
|
|
973
|
+
push(m, "publish", { type: "oci", image: archive, repository });
|
|
974
|
+
m.what.push(`the image ${image} built from ${dockerfile} and pushed to ${repository}`);
|
|
975
|
+
if (repository.startsWith("ghcr.io/"))
|
|
976
|
+
registry.push(`${repository}: the workflow pushes with the run's token. The first push makes the package private; make it public in the package's settings if it should be.`);
|
|
977
|
+
else
|
|
978
|
+
registry.push(`${repository}: set OCI_USERNAME and OCI_PASSWORD for the release workflow, as ${forge === "gitlab" ? "masked CI/CD variables" : "secrets in the root's release.workflow.env"}, with push access to the registry.`);
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
m.what.push(`the image ${image} built from ${dockerfile}`);
|
|
982
|
+
notes.push(`${dockerfile} is built into member ${m.name}'s release.images as ${image}, and no oci target is declared: origin names no registry chant knows. Add { type: "oci", image: "${archive}", repository: "<registry>/<name>" } to its release.publish.`);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
// Helm charts: the same rule, a helm target per member that packs any.
|
|
986
|
+
const charts = facts.charts ?? [];
|
|
987
|
+
const chartRepository = imageRepository(facts.origin, "charts", false);
|
|
988
|
+
const placed = charts.map((c) => {
|
|
989
|
+
const chartName = (c.name ?? posix.basename(c.dir === "." ? fallbackName : c.dir)).toLowerCase().replace(/[^a-z0-9._-]+/g, "-");
|
|
990
|
+
return { c, chartName, m: ownerOf(c.dir) ?? ownMember(c.dir, chartName) };
|
|
991
|
+
});
|
|
992
|
+
for (const { c, chartName, m } of placed) {
|
|
993
|
+
const entries = m.release.artifacts ?? [];
|
|
994
|
+
let entry = placed.filter((x) => x.m === m).length === 1 ? "chart" : `chart-${chartName}`;
|
|
995
|
+
while (entries.some((e) => e.name === entry))
|
|
996
|
+
entry = `${entry}-${entries.length}`;
|
|
997
|
+
push(m, "artifacts", { name: entry, helm: m.npm ? { chart: fromMember(m, c.dir), dir: "build" } : { chart: fromMember(m, c.dir) } });
|
|
998
|
+
const target = (m.release.publish ?? []).find((t) => t.type === "helm");
|
|
999
|
+
if (target)
|
|
1000
|
+
target.charts.push(`artifact:${entry}`);
|
|
1001
|
+
else if (chartRepository)
|
|
1002
|
+
push(m, "publish", { type: "helm", charts: [`artifact:${entry}`], oci: { repository: chartRepository } });
|
|
1003
|
+
m.what.push(`the chart ${c.dir === "." ? "Chart.yaml" : `${c.dir}/Chart.yaml`} packed with its label${chartRepository ? ` and pushed to ${chartRepository}/${chartName}` : ""}`);
|
|
1004
|
+
}
|
|
1005
|
+
if (charts.length > 0) {
|
|
1006
|
+
if (chartRepository) {
|
|
1007
|
+
if (chartRepository.startsWith("ghcr.io/"))
|
|
1008
|
+
registry.push(`${chartRepository}: the workflow pushes the charts with the run's token. The first push makes each package private; make it public in the package's settings if it should be.`);
|
|
1009
|
+
else
|
|
1010
|
+
registry.push(`${chartRepository}: set OCI_USERNAME and OCI_PASSWORD for the release workflow, as ${forge === "gitlab" ? "masked CI/CD variables" : "secrets in the root's release.workflow.env"}, with push access to the registry.`);
|
|
1011
|
+
}
|
|
1012
|
+
else
|
|
1013
|
+
notes.push(`The charts are packed into their members' release.artifacts, and no helm target is declared: origin names no registry chant knows. Add { type: "helm", charts: ["artifact:<entry>"], oci: { repository: "<registry>/<path>" } } to each member's release.publish.`);
|
|
1014
|
+
}
|
|
1015
|
+
// The members' tags read the old ones: shared tags are the root's.
|
|
870
1016
|
const shared = [h.prefix, ...h.others.map((o) => o.prefix)].filter((p) => p !== null && p !== "" && !claimed.has(p));
|
|
871
1017
|
const release = { train: shared.length > 0 ? { env, first: "together" } : { env } };
|
|
872
|
-
reasons.push(`release.train: ${
|
|
1018
|
+
reasons.push(`release.train: ${members.length} members, each released at its own version; chant workspace train cut ${env} cuts every member that changed since its last release, and the train publishes them in dependency order${shared.length > 0 ? `. first "together": the packages have shared ${shared.map((p) => `${p}<version>`).join(" and ")} releases, so the first train gives every member one label past the highest version any has, and each later train labels each on its own` : ""}`);
|
|
1019
|
+
if (members.some((m) => m.package === null) || members.some((m) => m.release.images || m.release.artifacts))
|
|
1020
|
+
reasons.push(`members: ${TRAIN_OWNERSHIP_RULE}`);
|
|
873
1021
|
if (shared.length > 0) {
|
|
874
1022
|
release.legacyTags = shared;
|
|
875
|
-
reasons.push(`release.legacyTags ${JSON.stringify(shared)}: chant release changed reads the newest ${shared.map((p) => `${p}<version>`).join(" or ")} tag as every
|
|
1023
|
+
reasons.push(`release.legacyTags ${JSON.stringify(shared)}: chant release changed reads the newest ${shared.map((p) => `${p}<version>`).join(" or ")} tag as every member's last release until the train has cut one`);
|
|
876
1024
|
}
|
|
877
1025
|
release.green = green;
|
|
878
1026
|
reasons.push(...greenReasons);
|
|
879
|
-
const workflow = { trigger: "dispatch" };
|
|
880
1027
|
if (adopted)
|
|
881
1028
|
workflow.file = workflowFile;
|
|
1029
|
+
const extensions = packages.filter((p) => p.vscode);
|
|
1030
|
+
// A GitLab job gets the project's CI/CD variables as they are.
|
|
1031
|
+
if (extensions.length > 0 && forge !== "gitlab")
|
|
1032
|
+
addEnv("VSCE_PAT", "${{ secrets.VSCE_PAT }}");
|
|
882
1033
|
nodeWorkflow(node, opts, workflow, reasons);
|
|
883
|
-
release
|
|
1034
|
+
// Keys in the order the one release writes them.
|
|
1035
|
+
const { env: wfEnv, ...wfRest } = workflow;
|
|
1036
|
+
release.workflow = wfEnv ? { ...wfRest, env: wfEnv } : wfRest;
|
|
884
1037
|
reasons.push(`release.workflow: ${workflowFile}, started by hand with the levels, cuts the train from a green commit and publishes it`);
|
|
885
1038
|
if (adopted)
|
|
886
1039
|
reasons.push(`release.workflow.file ${workflowFile}: it runs npm publish today, so the npm trusted publishers that name it keep working; the train workflow replaces it rather than publishing from a second file`);
|
|
887
1040
|
for (const m of members) {
|
|
888
1041
|
const tag = m.release.tag;
|
|
889
|
-
const ranges = m.release.version
|
|
890
|
-
const
|
|
891
|
-
reasons.push(`${
|
|
1042
|
+
const ranges = m.release.version?.ranges;
|
|
1043
|
+
const where = m.package === null ? `${m.dir}/chant.config.ts, member ${m.name}, a member of its own for ${m.source === "." ? "the repository root" : m.source} (release.sources ${JSON.stringify(m.release.sources)})` : `${m.dir}/chant.config.ts, member ${m.name}`;
|
|
1044
|
+
reasons.push(`${where}: ${m.what.join("; ")}, tagged ${tag}${ranges ? `; ranges "train", so its range on a sibling names the version the train gives it` : ""}${m.release.legacyTags ? `; its ${m.release.legacyTags.map((p) => `${p}<version>`).join(" and ")} tags read as earlier releases` : ""}`);
|
|
892
1045
|
}
|
|
893
1046
|
if (skipped.length > 0)
|
|
894
1047
|
notes.push(`Not published, being private: ${skipped.map((p) => p.name).join(", ")}. The train's publish job builds ${skipped.length === 1 ? "it" : "them"} when a member needs ${skipped.length === 1 ? "it" : "them"}.`);
|
|
895
|
-
const packed =
|
|
1048
|
+
const packed = npmPackages.filter((p) => !p.packList);
|
|
896
1049
|
if (packed.length > 0)
|
|
897
1050
|
notes.push(`npm packs a package's chant.config.ts with it unless package.json files or an .npmignore leaves it out: ${packed.map((p) => p.name).join(", ")} ${packed.length === 1 ? "has" : "have"} neither.`);
|
|
898
|
-
const
|
|
1051
|
+
for (const ext of extensions) {
|
|
1052
|
+
const vsix = `${ext.dir}/dist/${ext.name.replace(/^@[^/]+\//, "")}.vsix`;
|
|
1053
|
+
notes.push(`The build must write ${vsix}, such as with vsce package -o dist/${posix.basename(vsix)} in ${ext.dir}, and the VS Code Marketplace target needs vsce on PATH.`);
|
|
1054
|
+
}
|
|
1055
|
+
const anyDist = members.some((m) => m.release.images || m.release.artifacts) || extensions.length > 0;
|
|
1056
|
+
if (!facts.distIgnored && anyDist)
|
|
1057
|
+
notes.push("dist/ is not in .gitignore: the publish refuses a tree with build outputs git does not ignore.");
|
|
1058
|
+
if (facts.buildIgnored !== true && members.some((m) => m.npm && (m.release.images || m.release.artifacts)))
|
|
1059
|
+
notes.push("build/ is not in .gitignore: a member that publishes to npm writes its images and charts to build/, outside the dist npm packs, and the publish refuses a tree with build outputs git does not ignore.");
|
|
899
1060
|
for (const m of members) {
|
|
1061
|
+
if (!m.npm)
|
|
1062
|
+
continue;
|
|
900
1063
|
registry.push(adopted
|
|
901
1064
|
? `npm ${m.package}: keep the trusted publisher on npmjs.com that names ${repo} and the workflow file ${workflowName}, or add one naming them if the package has none, and allow npm dist-tag on it, since the reveal moves latest. If ${m.package} is not on npm yet, publish its first version by hand from ${m.dir} (npm publish) so it has settings; the train labels the next past it.`
|
|
902
1065
|
: `npm ${m.package}: on npmjs.com, add a trusted publisher for ${forge === "gitlab" ? `GitLab CI/CD naming ${repo} and the top-level config .gitlab-ci.yml` : `${forge === "github" ? "GitHub Actions" : "this forge"} naming ${repo} and the workflow file ${workflowName}`}, and allow npm dist-tag, since the reveal moves latest. Every package names the same file. If ${m.package} is not on npm yet, publish its first version by hand from ${m.dir} (npm publish) so it has settings; the train labels the next past it.`);
|
|
903
1066
|
}
|
|
1067
|
+
for (const ext of extensions) {
|
|
1068
|
+
registry.push(`VS Code Marketplace ${ext.publisher ?? "<publisher>"}.${ext.name}: create a personal access token with Marketplace (Manage) scope and store it as the ${forge === "gitlab" ? "masked CI/CD variable" : "repository secret"} VSCE_PAT.`);
|
|
1069
|
+
registry.push(`Open VSX ${ext.publisher ?? "<publisher>"}.${ext.name}: create the namespace ${ext.publisher ?? "<publisher>"} once, and add ${repo} with the workflow file ${workflowName} under the extension's trusted publishers at https://open-vsx.org/user-settings/trusted-publishers.`);
|
|
1070
|
+
}
|
|
904
1071
|
// #5216: a GitLab job token cannot push the train's tags.
|
|
905
1072
|
if (forge === "gitlab")
|
|
906
1073
|
registry.push(`GitLab: include ${workflowFile} from .gitlab-ci.yml, and store a project access token with write_repository as the masked CI/CD variable CHANT_RELEASE_TOKEN; the cut and publish jobs push with it.`);
|
|
907
1074
|
const workspaceName = memberNameOf({ name: facts.origin?.repo.split("/").pop() ?? node.root.name ?? null, dir: facts.path ?? "workspace" }) || "workspace";
|
|
908
|
-
return { release, members, workspaceName, reasons, notes, registry, workflowFile, env };
|
|
1075
|
+
return { release, members: members.map(({ name, dir, package: pkg, release: r }) => ({ name, dir, package: pkg, release: r })), workspaceName, reasons, notes, registry, workflowFile, env };
|
|
909
1076
|
}
|
|
910
1077
|
const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
911
1078
|
/** A value as TypeScript source, objects and arrays on one line when short. */
|
|
@@ -88,7 +88,7 @@ export declare function nextLabel(input: {
|
|
|
88
88
|
yanked?: readonly string[];
|
|
89
89
|
}): string;
|
|
90
90
|
/** The commits in `from..to` touching `path` (from the repository root), newest first, merges left out. */
|
|
91
|
-
export declare function commitsTouching(top: string, from: string, to: string, path: string): NextCommit[];
|
|
91
|
+
export declare function commitsTouching(top: string, from: string, to: string, path: string | readonly string[]): NextCommit[];
|
|
92
92
|
/** The highest level of `commits`, or null when there are none. */
|
|
93
93
|
export declare function commitsBump(commits: readonly NextCommit[]): ReleaseBumpLevel | null;
|
|
94
94
|
/**
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*/
|
|
39
39
|
import { execFileSync } from "node:child_process";
|
|
40
40
|
import { realpathSync } from "node:fs";
|
|
41
|
-
import { relative } from "node:path";
|
|
41
|
+
import { relative, resolve } from "node:path";
|
|
42
42
|
import { classifyCommit } from "./release-changelog.js";
|
|
43
43
|
import { consumedIntents, maxBump, pendingIntents, readIntents } from "./release-intents.js";
|
|
44
44
|
/** The first chant with `chant release next` and `chant release cut auto`, the label from the conventional commits and the `.chant/release/*.md` intent files since the member's previous release; a cut records the intent files it consumed (`intents` on its cut line), `release changed` computes each member's bump from them (`bumpFrom`, `intents`, `intent-pending`), notes generated from commits lead with their summaries, and a dispatched release workflow takes the label `auto` (#5159); with no release in the ledger the previous one is the newest version tag `release.tag` or `release.legacyTags` matches (#5200), and on 0.x a breaking commit bumps minor unless `release.breakingOnZero` is `major` (#5191). */
|
|
@@ -117,7 +117,9 @@ function git(top, args) {
|
|
|
117
117
|
}
|
|
118
118
|
/** The commits in `from..to` touching `path` (from the repository root), newest first, merges left out. */
|
|
119
119
|
export function commitsTouching(top, from, to, path) {
|
|
120
|
-
const
|
|
120
|
+
const paths = typeof path === "string" ? [path] : path;
|
|
121
|
+
const specs = paths.includes("") ? ["."] : paths.map((p) => `:(top,literal)${p}`);
|
|
122
|
+
const out = git(top, ["log", "--no-merges", "--format=%H%x00%B%x1e", `${from}..${to}`, "--", ...specs]);
|
|
121
123
|
if (out === null)
|
|
122
124
|
throw new ReleaseNextError("revision-unknown", `git could not list the commits ${from.slice(0, 12)}..${to.slice(0, 12)}`, "Fetch the full history of the branch.");
|
|
123
125
|
return out
|
|
@@ -226,8 +228,11 @@ export async function nextRelease(req) {
|
|
|
226
228
|
stable = { label: hit.label, commit: hit.commit, source: "tag", tag: hit.tag };
|
|
227
229
|
}
|
|
228
230
|
const intents = await memberPendingIntents(req.cwd, top, at, names, cuts);
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
+
const fromTop = (abs) => relative(realpathSync(top), abs).split("\\").join("/");
|
|
232
|
+
const path = fromTop(realpathOr(memberSourcePath(req.cwd)));
|
|
233
|
+
// #5271: release.sources count beside the member's own directory.
|
|
234
|
+
const sources = settings.sources.map((s) => fromTop(resolve(realpathOr(req.cwd), s))).filter((s) => s !== ".." && !s.startsWith("../"));
|
|
235
|
+
const commits = stable ? shiftOnZero(commitsTouching(top, stable.commit, at, [path, ...sources]), stable.label, settings.breakingOnZero) : [];
|
|
231
236
|
if (here) {
|
|
232
237
|
return { label: here.label, at, bump: null, alreadyCut: true, from: stable ?? { label: here.label, commit: at, source: "ledger" }, commits, intents: [] };
|
|
233
238
|
}
|
package/dist/release-floors.d.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* files rather than to the end of this one. The floors below were declared
|
|
31
31
|
* here before that and keep the subpath they shipped under.
|
|
32
32
|
*/
|
|
33
|
-
export declare const NEXT_RELEASE = "0.124.
|
|
33
|
+
export declare const NEXT_RELEASE = "0.124.105";
|
|
34
34
|
/** The first chant with `chant dev local` and `chant dev bundle-check`, `@intentius/chant/local-chant` and `@intentius/chant/bundle-check` (`chantRuntimeTarget`, `chantExternalPlugin`, `checkBundle`): a product built against a chant checkout, and its bundle checked, without its own scripts (#4787). */
|
|
35
35
|
export declare const LOCAL_CHANT_FLOOR = "0.124.86";
|
|
36
36
|
/** The first chant with `chant workspace ref-gate` (pre-receive, pre-push, check, status, attach, install) and `refs` in `.chant/trust.json`, the checks a ref update needs evidence for (#4867). */
|
package/dist/release-floors.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* files rather than to the end of this one. The floors below were declared
|
|
31
31
|
* here before that and keep the subpath they shipped under.
|
|
32
32
|
*/
|
|
33
|
-
export const NEXT_RELEASE = "0.124.
|
|
33
|
+
export const NEXT_RELEASE = "0.124.105";
|
|
34
34
|
/** The first chant with `chant dev local` and `chant dev bundle-check`, `@intentius/chant/local-chant` and `@intentius/chant/bundle-check` (`chantRuntimeTarget`, `chantExternalPlugin`, `checkBundle`): a product built against a chant checkout, and its bundle checked, without its own scripts (#4787). */
|
|
35
35
|
export const LOCAL_CHANT_FLOOR = "0.124.86";
|
|
36
36
|
/** The first chant with `chant workspace ref-gate` (pre-receive, pre-push, check, status, attach, install) and `refs` in `.chant/trust.json`, the checks a ref update needs evidence for (#4867). */
|