tkeron 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,32 @@
1
+ # v4.4.0
2
+
3
+ ## Component Subdirectory Lookup
4
+
5
+ ### New Features
6
+
7
+ - **Added**: Components (`.com.html`, `.com.md`, `.com.ts`) are now resolved via glob search (`**/${tagName}.com.*`) across any subdirectory of `rootDir`, not just at the exact root path
8
+ - `currentDir` (same directory as the referencing HTML file) retains the highest priority
9
+ - If not found locally, tkeron glob-searches all subdirectories of `rootDir` recursively
10
+ - First glob match is used when multiple subdirectory matches exist
11
+ - The error message for hyphen-less component names now correctly reports the path found via glob
12
+
13
+ ### Tests
14
+
15
+ - **Added**: `tests/processCom.test.ts` — 4 new tests covering subdirectory lookup for `.com.html`
16
+ - **Added**: `tests/processComMd.test.ts` — 3 new tests covering subdirectory lookup for `.com.md`
17
+ - **Added**: `tests/processComTs.test.ts` — 3 new tests covering subdirectory lookup for `.com.ts`
18
+ - **Updated**: `tests/examples.test.ts` — updated assertions to match glob-based component resolution
19
+
20
+ ---
21
+
22
+ # v4.3.1
23
+
24
+ ## Bug Fixes
25
+
26
+ - **Fixed**: `tk -v` / `tk version` / `tk --version` incorrectly displayed `0.0.1` instead of the actual version — `getCommands()` was called without passing the version; now receives `packageJson.version`
27
+
28
+ ---
29
+
1
30
  # v4.3.0
2
31
 
3
32
  ## Markdown Components
package/index.ts CHANGED
@@ -4,13 +4,14 @@ import { buildWrapper } from "./src/buildWrapper";
4
4
  import { develop } from "./src/develop";
5
5
  import { initWrapper } from "./src/initWrapper";
6
6
  import { showBanner } from "./src/banner";
7
+ import packageJson from "./package.json";
7
8
 
8
9
  if (process.argv.length === 2) {
9
10
  await showBanner();
10
11
  process.exit(0);
11
12
  }
12
13
 
13
- getCommands()
14
+ getCommands("tkeron", packageJson.version)
14
15
  .addCommand("build")
15
16
  .addAlias("b")
16
17
  .addDescription("Build the project")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tkeron",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "CLI tool for backend-driven frontend development with TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/processCom.ts CHANGED
@@ -83,11 +83,12 @@ const processComponents = async (
83
83
  if (tagName) {
84
84
  if (!tagName.includes("-")) {
85
85
  const localPath = join(currentDir, `${tagName}.com.html`);
86
- const rootPath = join(rootDir, `${tagName}.com.html`);
87
- if (
88
- (await Bun.file(localPath).exists()) ||
89
- (await Bun.file(rootPath).exists())
90
- ) {
86
+ const globMatches = getFilePaths(
87
+ rootDir,
88
+ `**/${tagName}.com.html`,
89
+ true,
90
+ );
91
+ if ((await Bun.file(localPath).exists()) || globMatches.length > 0) {
91
92
  log.error(
92
93
  `\n❌ Error: Component name '${tagName}' must contain at least one hyphen.`,
93
94
  );
@@ -96,7 +97,7 @@ const processComponents = async (
96
97
  ` Rename '${tagName}.com.html' to 'tk-${tagName}.com.html' or similar.`,
97
98
  );
98
99
  log.error(
99
- ` File: ${(await Bun.file(localPath).exists()) ? localPath : rootPath}\n`,
100
+ ` File: ${(await Bun.file(localPath).exists()) ? localPath : globMatches[0]}\n`,
100
101
  );
101
102
  throw new Error(
102
103
  `Component name '${tagName}' must contain at least one hyphen`,
@@ -104,14 +105,20 @@ const processComponents = async (
104
105
  }
105
106
  } else {
106
107
  const localPath = join(currentDir, `${tagName}.com.html`);
107
- const rootPath = join(rootDir, `${tagName}.com.html`);
108
108
 
109
109
  let componentPath: string | null = null;
110
110
 
111
111
  if (await Bun.file(localPath).exists()) {
112
112
  componentPath = localPath;
113
- } else if (await Bun.file(rootPath).exists()) {
114
- componentPath = rootPath;
113
+ } else {
114
+ const globMatches = getFilePaths(
115
+ rootDir,
116
+ `**/${tagName}.com.html`,
117
+ true,
118
+ );
119
+ if (globMatches.length > 0) {
120
+ componentPath = globMatches[0];
121
+ }
115
122
  }
116
123
 
117
124
  if (componentPath) {
@@ -83,11 +83,8 @@ const processComponents = async (
83
83
  if (tagName) {
84
84
  if (!tagName.includes("-")) {
85
85
  const localPath = join(currentDir, `${tagName}.com.md`);
86
- const rootPath = join(rootDir, `${tagName}.com.md`);
87
- if (
88
- (await Bun.file(localPath).exists()) ||
89
- (await Bun.file(rootPath).exists())
90
- ) {
86
+ const globMatches = getFilePaths(rootDir, `**/${tagName}.com.md`, true);
87
+ if ((await Bun.file(localPath).exists()) || globMatches.length > 0) {
91
88
  log.error(
92
89
  `\n❌ Error: Component name '${tagName}' must contain at least one hyphen.`,
93
90
  );
@@ -96,7 +93,7 @@ const processComponents = async (
96
93
  ` Rename '${tagName}.com.md' to 'tk-${tagName}.com.md' or similar.`,
97
94
  );
98
95
  log.error(
99
- ` File: ${(await Bun.file(localPath).exists()) ? localPath : rootPath}\n`,
96
+ ` File: ${(await Bun.file(localPath).exists()) ? localPath : globMatches[0]}\n`,
100
97
  );
101
98
  throw new Error(
102
99
  `Component name '${tagName}' must contain at least one hyphen`,
@@ -104,14 +101,20 @@ const processComponents = async (
104
101
  }
105
102
  } else {
106
103
  const localPath = join(currentDir, `${tagName}.com.md`);
107
- const rootPath = join(rootDir, `${tagName}.com.md`);
108
104
 
109
105
  let componentPath: string | null = null;
110
106
 
111
107
  if (await Bun.file(localPath).exists()) {
112
108
  componentPath = localPath;
113
- } else if (await Bun.file(rootPath).exists()) {
114
- componentPath = rootPath;
109
+ } else {
110
+ const globMatches = getFilePaths(
111
+ rootDir,
112
+ `**/${tagName}.com.md`,
113
+ true,
114
+ );
115
+ if (globMatches.length > 0) {
116
+ componentPath = globMatches[0];
117
+ }
115
118
  }
116
119
 
117
120
  if (componentPath) {
@@ -85,11 +85,8 @@ const processComponentsTs = async (
85
85
  if (tagName) {
86
86
  if (!tagName.includes("-")) {
87
87
  const localPath = join(currentDir, `${tagName}.com.ts`);
88
- const rootPath = join(rootDir, `${tagName}.com.ts`);
89
- if (
90
- (await Bun.file(localPath).exists()) ||
91
- (await Bun.file(rootPath).exists())
92
- ) {
88
+ const globMatches = getFilePaths(rootDir, `**/${tagName}.com.ts`, true);
89
+ if ((await Bun.file(localPath).exists()) || globMatches.length > 0) {
93
90
  log.error(
94
91
  `\n❌ Error: Component name '${tagName}' must contain at least one hyphen.`,
95
92
  );
@@ -98,7 +95,7 @@ const processComponentsTs = async (
98
95
  ` Rename '${tagName}.com.ts' to 'tk-${tagName}.com.ts' or similar.`,
99
96
  );
100
97
  log.error(
101
- ` File: ${(await Bun.file(localPath).exists()) ? localPath : rootPath}\n`,
98
+ ` File: ${(await Bun.file(localPath).exists()) ? localPath : globMatches[0]}\n`,
102
99
  );
103
100
  throw new Error(
104
101
  `Component name '${tagName}' must contain at least one hyphen`,
@@ -106,14 +103,20 @@ const processComponentsTs = async (
106
103
  }
107
104
  } else {
108
105
  const localPath = join(currentDir, `${tagName}.com.ts`);
109
- const rootPath = join(rootDir, `${tagName}.com.ts`);
110
106
 
111
107
  let componentPath: string | null = null;
112
108
 
113
109
  if (await Bun.file(localPath).exists()) {
114
110
  componentPath = localPath;
115
- } else if (await Bun.file(rootPath).exists()) {
116
- componentPath = rootPath;
111
+ } else {
112
+ const globMatches = getFilePaths(
113
+ rootDir,
114
+ `**/${tagName}.com.ts`,
115
+ true,
116
+ );
117
+ if (globMatches.length > 0) {
118
+ componentPath = globMatches[0];
119
+ }
117
120
  }
118
121
 
119
122
  if (componentPath) {