Skip to content

Commit

Permalink
feat: remove name from project patch
Browse files Browse the repository at this point in the history
  • Loading branch information
fahchen committed Aug 26, 2024
1 parent c090c13 commit 8ccdb08
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
3 changes: 2 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command, CompletionsCommand } from "@cliffy/command";
import { Command } from "@cliffy/command";
import { CompletionsCommand } from "@cliffy/command/completions";

import denoJson from "./deno.json" with { type: "json" };

Expand Down
11 changes: 2 additions & 9 deletions src/jcli/config/project-json-patch-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,7 @@ function equal(value: PathNode): BuilderNodeFilter {
return (pathNode) => pathNode === value;
}

function buildNamePatch(
_op: DiffPatchOp,
value: unknown,
patch: ProjectPatch,
): void {
/* op must be "replace" */
patch.name = value as string;
}
function skip(_op: DiffPatchOp, _value: unknown, _patch: ProjectPatch): void {}

function buildTitlePatch(
_op: DiffPatchOp,
Expand Down Expand Up @@ -270,7 +263,7 @@ function buildScopesPatch(
}

export const builder = new BuilderNode({ name: "root" }).children([
new BuilderNode({ name: "name" }).on(equal("name")).do(buildNamePatch),
new BuilderNode({ name: "name" }).on(equal("name")).do(skip),
new BuilderNode({ name: "title" }).on(equal("title")).do(buildTitlePatch),

new BuilderNode({ name: "capabilities" }).on(equal("capabilities")).children([
Expand Down
1 change: 0 additions & 1 deletion src/jcli/config/project-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export type ProjectPluginInstancePatch =
| ProjectPluginInstanceDeletePatch;

export interface ProjectPatch {
name?: string;
title?: string;
capabilities: Array<ProjectCapabilityPatch>;
instances: Array<ProjectPluginInstancePatch>;
Expand Down
1 change: 0 additions & 1 deletion test/jcli/config/project-json_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe("ProjectDotJSON", () => {

assertNotEquals(diff, undefined);
assertObjectMatch(diff!, {
name: "bar",
capabilities: [],
instances: [],
});
Expand Down
2 changes: 0 additions & 2 deletions test/subcommands/push/action/push-configuration_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe("configuration", () => {
assertEquals(patches!.length, 1);

assertObjectMatch(patches![0], {
name: "name",
title: "title",
capabilities: [
{
Expand Down Expand Up @@ -146,7 +145,6 @@ describe("configuration", () => {
assertEquals(patches!.length, 1);

assertObjectMatch(patches![0], {
name: "name",
title: "title",
capabilities: [],
instances: [],
Expand Down

0 comments on commit 8ccdb08

Please sign in to comment.