@timeax/scaffold 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timeax/scaffold",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "description": "A CLI tool that scaffolds project file structures based on a user-defined, type-safe configuration file.",
6
6
  "keywords": [
7
7
  "scaffold"
@@ -22,14 +22,24 @@
22
22
  "types": "dist/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.cjs"
25
+ "import": {
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/index.d.cts",
31
+ "default": "./dist/index.cjs"
32
+ }
28
33
  },
29
34
  "./ast": {
30
- "types": "./dist/ast.d.ts",
31
- "import": "./dist/ast.mjs",
32
- "require": "./dist/ast.cjs"
35
+ "import": {
36
+ "types": "./dist/ast.d.mts",
37
+ "default": "./dist/ast.mjs"
38
+ },
39
+ "require": {
40
+ "types": "./dist/ast.d.cts",
41
+ "default": "./dist/ast.cjs"
42
+ }
33
43
  }
34
44
  },
35
45
  "bin": {
@@ -46,6 +56,7 @@
46
56
  },
47
57
  "devDependencies": {
48
58
  "@types/node": "^24.10.1",
59
+ "@types/pluralize": "^0.0.33",
49
60
  "prettier": "^3.7.1",
50
61
  "tsup": "^8.5.1",
51
62
  "typescript": "^5.9.3",
@@ -55,6 +66,7 @@
55
66
  "chokidar": "^5.0.0",
56
67
  "commander": "^14.0.2",
57
68
  "esbuild": "^0.27.0",
58
- "minimatch": "^10.1.1"
69
+ "minimatch": "^10.1.1",
70
+ "pluralize": "^8.0.0"
59
71
  }
60
72
  }
@@ -19,6 +19,7 @@ import {
19
19
  } from "../util/fs-utils";
20
20
  import type { Logger } from "../util/logger";
21
21
  import { defaultLogger } from "../util/logger";
22
+ import pluralize from "pluralize";
22
23
 
23
24
  export interface InteractiveDeleteParams {
24
25
  absolutePath: string;
@@ -163,12 +164,18 @@ export async function applyStructure(opts: ApplyOptions): Promise<void> {
163
164
  desiredPaths.add(relFromRoot);
164
165
 
165
166
  const stubName = entry.stub ?? inheritedStub;
167
+ const extension = path.extname(relFromRoot);
168
+ const fileName = path.basename(relFromRoot, extension);
166
169
 
167
170
  const ctx: HookContext = {
168
171
  projectRoot: projectRootAbs,
169
172
  targetPath: relFromRoot,
170
173
  absolutePath: absFile,
171
174
  isDirectory: false,
175
+ fileName,
176
+ dirName: path.dirname(relFromRoot),
177
+ extension,
178
+ pluralFileName: pluralize.plural(fileName),
172
179
  stubName,
173
180
  };
174
181
 
@@ -264,11 +271,18 @@ export async function applyStructure(opts: ApplyOptions): Promise<void> {
264
271
  continue;
265
272
  }
266
273
 
274
+ const extension = path.extname(abs);
275
+ const fileName = path.basename(abs, extension);
276
+
267
277
  const ctx: HookContext = {
268
278
  projectRoot,
269
279
  targetPath: cachedPath,
270
280
  absolutePath: abs,
271
281
  isDirectory: false,
282
+ fileName,
283
+ dirName: path.dirname(cachedPath),
284
+ extension,
285
+ pluralFileName: pluralize.plural(fileName),
272
286
  stubName: entry?.createdByStub,
273
287
  };
274
288
 
@@ -54,6 +54,14 @@ export interface HookContext {
54
54
  * produced a given file.
55
55
  */
56
56
  stubName?: string;
57
+
58
+ fileName: string;
59
+ dirName: string;
60
+ extension?: string;
61
+ /**
62
+ * Plural form of the file name (without extension), if applicable.
63
+ */
64
+ pluralFileName: string;
57
65
  }
58
66
 
59
67
  /**