mirror of
https://github.com/jakejarvis/hugo-extended.git
synced 2026-07-29 18:45:20 -04:00
fix: rename new site to new project to match Hugo v0.156.0
Hugo v0.156.0 renamed the `new site` subcommand to `new project`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-7
@@ -78,8 +78,8 @@ export const getHugoBinary = async (): Promise<string> => {
|
|||||||
* baseURL: "http://localhost:1313"
|
* baseURL: "http://localhost:1313"
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* // Create a new site
|
* // Create a new project
|
||||||
* await exec("new site", ["my-site"], { format: "yaml" });
|
* await exec("new project", ["my-site"], { format: "yaml" });
|
||||||
*
|
*
|
||||||
* // Build site for production
|
* // Build site for production
|
||||||
* await exec("build", {
|
* await exec("build", {
|
||||||
@@ -338,14 +338,14 @@ export const hugo = {
|
|||||||
}
|
}
|
||||||
return exec("new content", pathOrOptions);
|
return exec("new content", pathOrOptions);
|
||||||
},
|
},
|
||||||
site: (
|
project: (
|
||||||
pathOrOptions?: string | HugoOptionsFor<"new site">,
|
pathOrOptions?: string | HugoOptionsFor<"new project">,
|
||||||
options?: HugoOptionsFor<"new site">,
|
options?: HugoOptionsFor<"new project">,
|
||||||
) => {
|
) => {
|
||||||
if (typeof pathOrOptions === "string") {
|
if (typeof pathOrOptions === "string") {
|
||||||
return exec("new site", [pathOrOptions], options);
|
return exec("new project", [pathOrOptions], options);
|
||||||
}
|
}
|
||||||
return exec("new site", pathOrOptions);
|
return exec("new project", pathOrOptions);
|
||||||
},
|
},
|
||||||
theme: (
|
theme: (
|
||||||
nameOrOptions?: string | HugoOptionsFor<"new theme">,
|
nameOrOptions?: string | HugoOptionsFor<"new theme">,
|
||||||
|
|||||||
+2
-2
@@ -105,8 +105,8 @@ function findFlag(flags: FlagSpec[], propName: string): FlagSpec | undefined {
|
|||||||
* // Returns: ["server", "--port", "1313", "--build-drafts"]
|
* // Returns: ["server", "--port", "1313", "--build-drafts"]
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* buildArgs("new site", ["my-site"], { format: "yaml" })
|
* buildArgs("new project", ["my-site"], { format: "yaml" })
|
||||||
* // Returns: ["new", "site", "my-site", "--format", "yaml"]
|
* // Returns: ["new", "project", "my-site", "--format", "yaml"]
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* buildArgs("build", undefined, { theme: ["a", "b"], minify: true })
|
* buildArgs("build", undefined, { theme: ["a", "b"], minify: true })
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ describe("New Commands Integration", () => {
|
|||||||
await rm(tempDir, { recursive: true, force: true });
|
await rm(tempDir, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("new.site", () => {
|
describe("new.project", () => {
|
||||||
it("should create a new site with default format", async () => {
|
it("should create a new project with default format", async () => {
|
||||||
const sitePath = join(tempDir, "test-site");
|
const sitePath = join(tempDir, "test-site");
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
// Check that essential directories exist
|
// Check that essential directories exist
|
||||||
await expect(
|
await expect(
|
||||||
@@ -30,18 +30,18 @@ describe("New Commands Integration", () => {
|
|||||||
await expect(access(join(sitePath, "themes"))).resolves.toBeUndefined();
|
await expect(access(join(sitePath, "themes"))).resolves.toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create a new site with yaml format", async () => {
|
it("should create a new project with yaml format", async () => {
|
||||||
const sitePath = join(tempDir, "test-site-yaml");
|
const sitePath = join(tempDir, "test-site-yaml");
|
||||||
await hugo.new.site(sitePath, { format: "yaml" });
|
await hugo.new.project(sitePath, { format: "yaml" });
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
access(join(sitePath, "hugo.yaml")),
|
access(join(sitePath, "hugo.yaml")),
|
||||||
).resolves.toBeUndefined();
|
).resolves.toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create a new site with json format", async () => {
|
it("should create a new project with json format", async () => {
|
||||||
const sitePath = join(tempDir, "test-site-json");
|
const sitePath = join(tempDir, "test-site-json");
|
||||||
await hugo.new.site(sitePath, { format: "json" });
|
await hugo.new.project(sitePath, { format: "json" });
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
access(join(sitePath, "hugo.json")),
|
access(join(sitePath, "hugo.json")),
|
||||||
@@ -52,12 +52,12 @@ describe("New Commands Integration", () => {
|
|||||||
const sitePath = join(tempDir, "test-site-force");
|
const sitePath = join(tempDir, "test-site-force");
|
||||||
|
|
||||||
// Create site first time
|
// Create site first time
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
// Hugo 0.154.x does not overwrite an existing site config file, even with --force.
|
// Hugo 0.154.x does not overwrite an existing site config file, even with --force.
|
||||||
// Future versions may change this behavior, so test accepts either outcome.
|
// Future versions may change this behavior, so test accepts either outcome.
|
||||||
try {
|
try {
|
||||||
await hugo.new.site(sitePath, { force: true });
|
await hugo.new.project(sitePath, { force: true });
|
||||||
// If it succeeds, verify the site still exists
|
// If it succeeds, verify the site still exists
|
||||||
await expect(
|
await expect(
|
||||||
access(join(sitePath, "hugo.toml")),
|
access(join(sitePath, "hugo.toml")),
|
||||||
@@ -72,7 +72,7 @@ describe("New Commands Integration", () => {
|
|||||||
describe("new.theme", () => {
|
describe("new.theme", () => {
|
||||||
it("should create a new theme", async () => {
|
it("should create a new theme", async () => {
|
||||||
const sitePath = join(tempDir, "test-site");
|
const sitePath = join(tempDir, "test-site");
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
// Use --source instead of process.chdir (not supported in worker threads)
|
// Use --source instead of process.chdir (not supported in worker threads)
|
||||||
await hugo.new.theme("test-theme", { source: sitePath });
|
await hugo.new.theme("test-theme", { source: sitePath });
|
||||||
@@ -86,7 +86,7 @@ describe("New Commands Integration", () => {
|
|||||||
|
|
||||||
it("should create theme with yaml format", async () => {
|
it("should create theme with yaml format", async () => {
|
||||||
const sitePath = join(tempDir, "test-site");
|
const sitePath = join(tempDir, "test-site");
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
await hugo.new.theme("test-theme-yaml", {
|
await hugo.new.theme("test-theme-yaml", {
|
||||||
format: "yaml",
|
format: "yaml",
|
||||||
@@ -103,7 +103,7 @@ describe("New Commands Integration", () => {
|
|||||||
describe("new.content", () => {
|
describe("new.content", () => {
|
||||||
it("should create new content file", async () => {
|
it("should create new content file", async () => {
|
||||||
const sitePath = join(tempDir, "test-site");
|
const sitePath = join(tempDir, "test-site");
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
await hugo.new.content("posts/my-post.md", { source: sitePath });
|
await hugo.new.content("posts/my-post.md", { source: sitePath });
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ describe("New Commands Integration", () => {
|
|||||||
|
|
||||||
it("should create content with custom kind", async () => {
|
it("should create content with custom kind", async () => {
|
||||||
const sitePath = join(tempDir, "test-site");
|
const sitePath = join(tempDir, "test-site");
|
||||||
await hugo.new.site(sitePath);
|
await hugo.new.project(sitePath);
|
||||||
|
|
||||||
await hugo.new.content("pages/about.md", {
|
await hugo.new.content("pages/about.md", {
|
||||||
kind: "page",
|
kind: "page",
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ describe("buildArgs", () => {
|
|||||||
|
|
||||||
describe("positional arguments", () => {
|
describe("positional arguments", () => {
|
||||||
it("should add positional arguments after command", () => {
|
it("should add positional arguments after command", () => {
|
||||||
const args = buildArgs("new site", ["my-site"]);
|
const args = buildArgs("new project", ["my-site"]);
|
||||||
expect(args).toEqual(["new", "site", "my-site"]);
|
expect(args).toEqual(["new", "project", "my-site"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should handle multiple positional arguments", () => {
|
it("should handle multiple positional arguments", () => {
|
||||||
@@ -26,8 +26,8 @@ describe("buildArgs", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should handle positional args with options", () => {
|
it("should handle positional args with options", () => {
|
||||||
const args = buildArgs("new site", ["my-site"], { format: "yaml" });
|
const args = buildArgs("new project", ["my-site"], { format: "yaml" });
|
||||||
expect(args).toEqual(["new", "site", "my-site", "--format", "yaml"]);
|
expect(args).toEqual(["new", "project", "my-site", "--format", "yaml"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("Type Safety", () => {
|
|||||||
// Check that specific commands are valid HugoCommand values
|
// Check that specific commands are valid HugoCommand values
|
||||||
expectTypeOf<"build">().toExtend<HugoCommand>();
|
expectTypeOf<"build">().toExtend<HugoCommand>();
|
||||||
expectTypeOf<"server">().toExtend<HugoCommand>();
|
expectTypeOf<"server">().toExtend<HugoCommand>();
|
||||||
expectTypeOf<"new site">().toExtend<HugoCommand>();
|
expectTypeOf<"new project">().toExtend<HugoCommand>();
|
||||||
expectTypeOf<"new theme">().toExtend<HugoCommand>();
|
expectTypeOf<"new theme">().toExtend<HugoCommand>();
|
||||||
expectTypeOf<"new content">().toExtend<HugoCommand>();
|
expectTypeOf<"new content">().toExtend<HugoCommand>();
|
||||||
});
|
});
|
||||||
@@ -14,7 +14,7 @@ describe("Type Safety", () => {
|
|||||||
it("should map commands to correct option types", () => {
|
it("should map commands to correct option types", () => {
|
||||||
type BuildOpts = HugoOptionsFor<"build">;
|
type BuildOpts = HugoOptionsFor<"build">;
|
||||||
type ServerOpts = HugoOptionsFor<"server">;
|
type ServerOpts = HugoOptionsFor<"server">;
|
||||||
type NewSiteOpts = HugoOptionsFor<"new site">;
|
type NewProjectOpts = HugoOptionsFor<"new project">;
|
||||||
type NewThemeOpts = HugoOptionsFor<"new theme">;
|
type NewThemeOpts = HugoOptionsFor<"new theme">;
|
||||||
|
|
||||||
// Build options should have minify
|
// Build options should have minify
|
||||||
@@ -23,8 +23,8 @@ describe("Type Safety", () => {
|
|||||||
// Server options should have port
|
// Server options should have port
|
||||||
expectTypeOf<ServerOpts>().toHaveProperty("port");
|
expectTypeOf<ServerOpts>().toHaveProperty("port");
|
||||||
|
|
||||||
// New site options should have format
|
// New project options should have format
|
||||||
expectTypeOf<NewSiteOpts>().toHaveProperty("format");
|
expectTypeOf<NewProjectOpts>().toHaveProperty("format");
|
||||||
|
|
||||||
// New theme options should have format
|
// New theme options should have format
|
||||||
expectTypeOf<NewThemeOpts>().toHaveProperty("format");
|
expectTypeOf<NewThemeOpts>().toHaveProperty("format");
|
||||||
|
|||||||
Reference in New Issue
Block a user