diff --git a/packages/nx-shopify/src/generators/snippet/schema.d.ts b/packages/nx-shopify/src/generators/snippet/schema.d.ts index 9b23ea7..f3ce1f5 100644 --- a/packages/nx-shopify/src/generators/snippet/schema.d.ts +++ b/packages/nx-shopify/src/generators/snippet/schema.d.ts @@ -5,5 +5,6 @@ export interface SnippetGeneratorSchema { tags?: string; directory?: string; flat?: boolean; + liquidOnly?: boolean; skipTests?: boolean; } diff --git a/packages/nx-shopify/src/generators/snippet/schema.json b/packages/nx-shopify/src/generators/snippet/schema.json index d82aaa7..de5bca7 100644 --- a/packages/nx-shopify/src/generators/snippet/schema.json +++ b/packages/nx-shopify/src/generators/snippet/schema.json @@ -33,6 +33,11 @@ "description": "Create snippet files at the directory root rather than its own directory.", "default": false }, + "liquidOnly": { + "type": "boolean", + "description": "When true, does not create files other than the liquid file for the new snippet.", + "default": false + }, "skipTests": { "type": "boolean", "description": "When true, does not create \"spec.ts\" test files for the new snippet.", diff --git a/packages/nx-shopify/src/generators/snippet/snippet.generator.ts b/packages/nx-shopify/src/generators/snippet/snippet.generator.ts index 50e7bc1..f56a9a7 100644 --- a/packages/nx-shopify/src/generators/snippet/snippet.generator.ts +++ b/packages/nx-shopify/src/generators/snippet/snippet.generator.ts @@ -101,6 +101,10 @@ function createSnippetFiles(host: Tree, options: NormalizedSchema) { deleteFile = true; } + if (options.liquidOnly && !/.*.liquid/.test(c.path)) { + deleteFile = true; + } + if (deleteFile) { host.delete(c.path); }