From 73a168bdfb4b022f929ec68e085ba8ac121f5117 Mon Sep 17 00:00:00 2001 From: John Carmichael Date: Tue, 4 Mar 2025 08:28:41 +0000 Subject: [PATCH 1/2] feat: ignore tpl_testing --- CHANGELOG.md | 3 +++ docs/_pages/known-templates.md | 5 ----- docs/_pages/templates.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 2 +- src/lib/helpers/__tests__/isFileToIgnore.ts | 2 ++ src/lib/helpers/isFileToIgnore.ts | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19774dd..245a0f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### 5.62.0 04/03/2025 +feat: _tpl_testing_ added to the default ignore allowing a tpl to hold own test files + ### 5.61.0 15/02/2025 chore: typescript bumped to latest major and quicktype to latest minor in the 15 major range diff --git a/docs/_pages/known-templates.md b/docs/_pages/known-templates.md index b29fd2d..cb7b7d5 100644 --- a/docs/_pages/known-templates.md +++ b/docs/_pages/known-templates.md @@ -3,11 +3,6 @@ Below you can see the list of templates available for use with Generate-it - [generate-it-typescript-server](https://github.com/acr-lfr/generate-it-typescript-server) - All types derived from the openapi file - Uses the express http engine -- [generate-it-typescript-api-test-rig](https://github.com/acr-lfr/generate-it-typescript-api-test-rig) - - Generates stub files to write tests for - - Uses jest and request promise - - Uses the out of the box Jest test coverage reporting - - Written in typescript - [generate-it-typescript-server-client](https://github.com/acr-lfr/generate-it-typescript-server-client) - A server side typescript client - [generate-it-asyncapi-rabbitmq](https://github.com/acr-lfr/generate-it-asyncapi-rabbitmq) diff --git a/docs/_pages/templates.md b/docs/_pages/templates.md index 7fefd98..fe111d9 100644 --- a/docs/_pages/templates.md +++ b/docs/_pages/templates.md @@ -68,3 +68,9 @@ NOTE: This is different to type OTHER which will always be added back if not fou Named: Anything, with or without .njk file extension. These files are every other file that is not one of the above special file types. They are also rendered by the templating engine unless the `renderOnlyExt` option is enabled. + +### Testing template files + +Generate-it will ignore any files in a folder called "". An example can be found in the https://github.com/j-d-carmichael/gen-it-ts-esm-server template. + +This allows the developer of the template to build and test locally before publishing. diff --git a/package-lock.json b/package-lock.json index 049fcaf..5fabcc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generate-it", - "version": "5.61.0", + "version": "5.62.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "generate-it", - "version": "5.61.0", + "version": "5.62.0", "license": "MIT", "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.7.2", diff --git a/package.json b/package.json index b1a1eea..512ca1f 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generate-it", - "version": "5.61.0", + "version": "5.62.0", "description": "Generate-it, will generate servers, clients, web-socket and anything else you can template with nunjucks from yml files (openapi/asyncapi)", "author": "Acrontum GmbH & Liffery Ltd", "license": "MIT", diff --git a/src/lib/helpers/__tests__/isFileToIgnore.ts b/src/lib/helpers/__tests__/isFileToIgnore.ts index ad17dbc..4e6397c 100644 --- a/src/lib/helpers/__tests__/isFileToIgnore.ts +++ b/src/lib/helpers/__tests__/isFileToIgnore.ts @@ -11,6 +11,8 @@ describe('Should not allow directories on black list, eg git idea vscode, even a expect(isFileToIgnore('som/dir/node_modules/blah', 'workspace')).toBe(true); expect(isFileToIgnore('som/dir/node_modules', 'workspace')).toBe(true); expect(isFileToIgnore('som/dir/node_modules/', 'workspace')).toBe(true); + expect(isFileToIgnore('som/dir/_tpl_testing_/', 'workspace')).toBe(true); + expect(isFileToIgnore('som/_tpl_testing_/nested/dir', 'workspace')).toBe(true); }); it('should match exactly', () => { diff --git a/src/lib/helpers/isFileToIgnore.ts b/src/lib/helpers/isFileToIgnore.ts index b80fd4e..61e1797 100644 --- a/src/lib/helpers/isFileToIgnore.ts +++ b/src/lib/helpers/isFileToIgnore.ts @@ -1,7 +1,7 @@ import { NodegenRc } from '@/interfaces'; import path from 'path'; -const defaultIgnoreList = [`(\\.idea|\\.git|\\.vscode|node_modules|build|dist)\\b`]; +const defaultIgnoreList = [`(\\.idea|\\.git|\\.vscode|node_modules|build|dist|_tpl_testing_)\\b`]; let ignoreList: string; let fullRegex: RegExp; From 51506eade4f0617a6feb9319ac7977e8d0d4103e Mon Sep 17 00:00:00 2001 From: John Carmichael Date: Tue, 4 Mar 2025 10:00:15 +0000 Subject: [PATCH 2/2] docs: folder ignored for testing declared --- docs/_pages/templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_pages/templates.md b/docs/_pages/templates.md index fe111d9..272452c 100644 --- a/docs/_pages/templates.md +++ b/docs/_pages/templates.md @@ -71,6 +71,6 @@ These files are every other file that is not one of the above special file types ### Testing template files -Generate-it will ignore any files in a folder called "". An example can be found in the https://github.com/j-d-carmichael/gen-it-ts-esm-server template. +Generate-it will ignore any files in a folder called "\_tpl_testing\_". An example can be found in the https://github.com/j-d-carmichael/gen-it-ts-esm-server template. This allows the developer of the template to build and test locally before publishing.