Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playground/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const STANDARD: string;
export const NEEDS_VERSION: string;
export const AUTOUPDATE_NEEDS_VERSION: string;
export const SECURITY_NEEDS_VERSION: string;
export const STACK_NEEDS_VERSION: Record<string, string>;
export const STACKS: Array<{ id: string; label: string }>;
export const PLATFORM_STACKS: Record<"github" | "gitlab", string[]>;
export const PRESETS: Array<{ id: string; summary: string }>;
Expand Down
7 changes: 7 additions & 0 deletions playground/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const AUTOUPDATE_NEEDS_VERSION = "0.9.0";
/** The same for code scanning. */
export const SECURITY_NEEDS_VERSION = "0.9.0";

/** The same for the stacks added after the standard the file names: an earlier repokeeper does not know them. */
export const STACK_NEEDS_VERSION = { docker: "0.9.0" };

export const STACKS = [
{ id: "node", label: "Node.js" },
{ id: "python", label: "Python" },
Expand Down Expand Up @@ -200,6 +203,10 @@ export function problems(input) {
if (/^\/|(^|\/)\.\.(\/|$)/.test(stack.directory)) {
found.push(`The folder of ${stack.id} has to be a path inside the repository.`);
}
if (STACK_NEEDS_VERSION[stack.id]) {
const { label } = STACKS.find((known) => known.id === stack.id);
found.push(`The ${label} stack needs repokeeper ${STACK_NEEDS_VERSION[stack.id]} or newer.`);
}
}
if (input.modules.health) {
const { health } = input;
Expand Down
7 changes: 7 additions & 0 deletions test/playground.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ describe("playground", () => {
]);
});

it("names the repokeeper a stack newer than the standard needs", () => {
const note = "The Dockerfile stack needs repokeeper 0.9.0 or newer.";
expect(problems(filled("standard", "github", [{ id: "docker" }]))).toEqual([note]);
expect(problems(filled("standard", "gitlab", [{ id: "node" }, { id: "docker" }]))).toEqual([note]);
expect(problems(filled("standard", "github", [{ id: "node" }]))).toEqual([]);
});

it("offers the command only while a preset says everything the form says", () => {
expect(shortcutCommand(filled("standard"))).toBe("npx repokeeper init --stack node");
expect(shortcutCommand(filled("essential"))).toBe("npx repokeeper init --preset essential --stack node");
Expand Down
Loading