Skip to content

Commit

Permalink
feat(snippet): generate liquid only snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandg7 committed May 6, 2021
1 parent 7a6daa1 commit b4495a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/nx-shopify/src/generators/snippet/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export interface SnippetGeneratorSchema {
tags?: string;
directory?: string;
flat?: boolean;
liquidOnly?: boolean;
skipTests?: boolean;
}
5 changes: 5 additions & 0 deletions packages/nx-shopify/src/generators/snippet/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit b4495a4

Please sign in to comment.