From 96c53ed49a793e413b71ea3a22a136fb1d599918 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Fri, 5 Dec 2025 09:06:52 +1000 Subject: [PATCH] fix(create-basic-tools): correct template path resolution for npx execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version @tpmjs/create-basic-tools@1.0.6 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/tools/create-basic-tools/CHANGELOG.md | 8 ++++++++ packages/tools/create-basic-tools/package.json | 2 +- .../tools/create-basic-tools/src/utils/file-writer.ts | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/tools/create-basic-tools/CHANGELOG.md b/packages/tools/create-basic-tools/CHANGELOG.md index e1b8d61..b45f099 100644 --- a/packages/tools/create-basic-tools/CHANGELOG.md +++ b/packages/tools/create-basic-tools/CHANGELOG.md @@ -1,5 +1,13 @@ # @tpmjs/create-basic-tools +## 1.0.6 + +### Patch Changes + +- fix: correct template path resolution for npx execution + + Fixed template path resolution from `../../templates` to `../templates` to work correctly when the package is run via npx. After tsup compilation, the bundle is in `dist/` and only needs to go up one level to reach the package root where templates are located. + ## 1.0.0 ### Major Changes diff --git a/packages/tools/create-basic-tools/package.json b/packages/tools/create-basic-tools/package.json index 57e2f91..579c4e4 100644 --- a/packages/tools/create-basic-tools/package.json +++ b/packages/tools/create-basic-tools/package.json @@ -1,6 +1,6 @@ { "name": "@tpmjs/create-basic-tools", - "version": "1.0.5", + "version": "1.0.6", "description": "CLI generator for scaffolding production-ready TPMJS tool packages", "type": "module", "bin": { diff --git a/packages/tools/create-basic-tools/src/utils/file-writer.ts b/packages/tools/create-basic-tools/src/utils/file-writer.ts index f85a8da..57aec05 100644 --- a/packages/tools/create-basic-tools/src/utils/file-writer.ts +++ b/packages/tools/create-basic-tools/src/utils/file-writer.ts @@ -27,7 +27,9 @@ export async function copyTemplate( destPath: string, replacements?: Record ): Promise { - const templatePath = path.join(__dirname, '../../templates', templateName); + // After tsup compilation, __dirname points to dist/ + // Templates are at package root, so we only need to go up one level + const templatePath = path.join(__dirname, '../templates', templateName); let content = await fs.readFile(templatePath, 'utf-8'); // Apply replacements if provided