@timeax/scaffold 0.1.1 → 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/dist/ast.d.cts +1 -1
- package/dist/ast.d.ts +1 -1
- package/dist/cli.cjs +65 -51
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +63 -50
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-C0067l3c.d.cts → config-DBARTF0g.d.cts} +7 -0
- package/dist/{config-C0067l3c.d.ts → config-DBARTF0g.d.ts} +7 -0
- package/dist/index.cjs +52 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +50 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
- package/src/core/apply-structure.ts +14 -0
- package/src/schema/hooks.ts +8 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timeax/scaffold",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
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"
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^24.10.1",
|
|
59
|
+
"@types/pluralize": "^0.0.33",
|
|
59
60
|
"prettier": "^3.7.1",
|
|
60
61
|
"tsup": "^8.5.1",
|
|
61
62
|
"typescript": "^5.9.3",
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"chokidar": "^5.0.0",
|
|
66
67
|
"commander": "^14.0.2",
|
|
67
68
|
"esbuild": "^0.27.0",
|
|
68
|
-
"minimatch": "^10.1.1"
|
|
69
|
+
"minimatch": "^10.1.1",
|
|
70
|
+
"pluralize": "^8.0.0"
|
|
69
71
|
}
|
|
70
|
-
}
|
|
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
|
|
package/src/schema/hooks.ts
CHANGED
|
@@ -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
|
/**
|