From 48520f5ef100e40c8e40c70f512e8f9361030b98 Mon Sep 17 00:00:00 2001 From: xeho91 Date: Wed, 15 Feb 2023 14:04:14 +0800 Subject: [PATCH 1/4] fix(node-plop): Set pattern in modify/append action types to be optional According to the code from these lines: - https://github.com/plopjs/plop/blob/main/packages/node-plop/src/actions/append.js#L32 - https://github.com/plopjs/plop/blob/973c1ce566db6fc754af55672b47ae4ed80ae4d0/packages/node-plop/src/actions/modify.js#L30 both actions `modify` and `optional` accepts `pattern` as optional. --- packages/node-plop/types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node-plop/types/index.d.ts b/packages/node-plop/types/index.d.ts index 20c975f..aedd635 100644 --- a/packages/node-plop/types/index.d.ts +++ b/packages/node-plop/types/index.d.ts @@ -251,7 +251,7 @@ export interface AddManyActionConfig interface ModifyActionConfigBase extends ActionConfig { type: "modify"; path: string; - pattern: string | RegExp; + pattern?: string | RegExp; transform?: TransformFn; } @@ -260,7 +260,7 @@ export type ModifyActionConfig = ModifyActionConfigBase & TemplateStrOrFile; interface AppendActionConfigBase extends ActionConfig { type: "append"; path: string; - pattern: string | RegExp; + pattern?: string | RegExp; unique: boolean; separator: string; } From e5b4db3d6175a55c33457e9df30b5a5832e356d6 Mon Sep 17 00:00:00 2001 From: xeho91 Date: Wed, 15 Feb 2023 14:20:54 +0800 Subject: [PATCH 2/4] chore(changesets): Add release notes --- .changeset/long-jars-roll.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/long-jars-roll.md diff --git a/.changeset/long-jars-roll.md b/.changeset/long-jars-roll.md new file mode 100644 index 0000000..939a5dd --- /dev/null +++ b/.changeset/long-jars-roll.md @@ -0,0 +1,5 @@ +--- +"node-plop": patch +--- + +Fix types for `AppendActionConfig` and `ModifyActionConfig` - the property `pattern` is now optional` From 0f128632d62fbcee1a6c8a0cb06dfb6dbc29559e Mon Sep 17 00:00:00 2001 From: xeho91 Date: Wed, 15 Feb 2023 15:40:35 +0800 Subject: [PATCH 3/4] fix(node-plop): Remove `path` property from `AddManyActionConfig` According to this code: https://github.com/plopjs/plop/blob/973c1ce566db6fc754af55672b47ae4ed80ae4d0/packages/node-plop/src/actions/addMany.js#L15 there's no property defined `path`, nor used. The property was incorrectly inherited from `AddManyConfig`. --- packages/node-plop/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node-plop/types/index.d.ts b/packages/node-plop/types/index.d.ts index aedd635..46b6c43 100644 --- a/packages/node-plop/types/index.d.ts +++ b/packages/node-plop/types/index.d.ts @@ -235,7 +235,7 @@ export interface AddManyActionConfig AddActionConfig, Exclude< keyof AddActionConfig, - "type" | "templateFile" | "template" | "transform" + "path" | "type" | "templateFile" | "template" | "transform" > > { type: "addMany"; From 4b6342db4f7182c887606eebdae440517c6883f9 Mon Sep 17 00:00:00 2001 From: xeho91 Date: Wed, 15 Feb 2023 15:44:22 +0800 Subject: [PATCH 4/4] chore(changesets): Update release note --- .changeset/long-jars-roll.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.changeset/long-jars-roll.md b/.changeset/long-jars-roll.md index 939a5dd..9d8380e 100644 --- a/.changeset/long-jars-roll.md +++ b/.changeset/long-jars-roll.md @@ -2,4 +2,7 @@ "node-plop": patch --- -Fix types for `AppendActionConfig` and `ModifyActionConfig` - the property `pattern` is now optional` +Fix types: + +- `AppendActionConfig` and `ModifyActionConfig` - the property `pattern` is now optional` +- `AddManyActionConfig` removed property `path` from options config