@contractspec/tool.create-contractspec-plugin 1.57.0 → 1.59.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/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1239 -0
- package/dist/{index.mjs → node/index.js} +184 -177
- package/dist/node/templates/example-generator.js +1080 -0
- package/dist/node/utils.js +25 -0
- package/dist/templates/example-generator.d.ts +26 -0
- package/dist/templates/example-generator.d.ts.map +1 -0
- package/dist/templates/example-generator.js +1081 -0
- package/dist/utils.d.ts +22 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +26 -0
- package/package.json +39 -18
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a template string with provided data
|
|
3
|
+
*/
|
|
4
|
+
export type TemplateData = Record<string, string | number | boolean>;
|
|
5
|
+
export declare function renderTemplate(template: string, data: TemplateData): string;
|
|
6
|
+
/**
|
|
7
|
+
* Format date for templates
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatDate(date?: Date): string;
|
|
10
|
+
/**
|
|
11
|
+
* Capitalize first letter
|
|
12
|
+
*/
|
|
13
|
+
export declare function capitalize(str: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Convert kebab-case to PascalCase
|
|
16
|
+
*/
|
|
17
|
+
export declare function kebabToPascal(str: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Convert kebab-case to camelCase
|
|
20
|
+
*/
|
|
21
|
+
export declare function kebabToCamel(str: string): string;
|
|
22
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAErE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAM3E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhD"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/utils.ts
|
|
3
|
+
import * as mustache from "mustache";
|
|
4
|
+
function renderTemplate(template, data) {
|
|
5
|
+
return mustache.render(template, data);
|
|
6
|
+
}
|
|
7
|
+
function formatDate(date = new Date) {
|
|
8
|
+
return date.toISOString().split("T")[0] ?? "";
|
|
9
|
+
}
|
|
10
|
+
function capitalize(str) {
|
|
11
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
12
|
+
}
|
|
13
|
+
function kebabToPascal(str) {
|
|
14
|
+
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
15
|
+
}
|
|
16
|
+
function kebabToCamel(str) {
|
|
17
|
+
const pascal = kebabToPascal(str);
|
|
18
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
renderTemplate,
|
|
22
|
+
kebabToPascal,
|
|
23
|
+
kebabToCamel,
|
|
24
|
+
formatDate,
|
|
25
|
+
capitalize
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/tool.create-contractspec-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for creating ContractSpec plugins from templates",
|
|
6
6
|
"keywords": [
|
|
@@ -14,24 +14,25 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
16
16
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
17
|
-
"build": "bun build:
|
|
18
|
-
"build:bundle": "
|
|
19
|
-
"build:types": "
|
|
20
|
-
"dev": "bun
|
|
17
|
+
"build": "bun run prebuild && bun run build:bundle && bun run build:types",
|
|
18
|
+
"build:bundle": "contractspec-bun-build transpile",
|
|
19
|
+
"build:types": "contractspec-bun-build types",
|
|
20
|
+
"dev": "contractspec-bun-build dev",
|
|
21
21
|
"clean": "rimraf dist .turbo",
|
|
22
22
|
"lint": "bun lint:fix",
|
|
23
23
|
"lint:fix": "eslint src --fix",
|
|
24
24
|
"lint:check": "eslint src",
|
|
25
|
-
"test": "bun test"
|
|
25
|
+
"test": "bun test",
|
|
26
|
+
"prebuild": "contractspec-bun-build prebuild",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
26
28
|
},
|
|
27
29
|
"bin": {
|
|
28
30
|
"create-contractspec-plugin": "./dist/index.js"
|
|
29
31
|
},
|
|
30
32
|
"exports": {
|
|
31
|
-
".": "./
|
|
32
|
-
"./templates": "./
|
|
33
|
-
"./
|
|
34
|
-
"./utils": "./dist/utils.js"
|
|
33
|
+
".": "./src/index.ts",
|
|
34
|
+
"./templates/example-generator": "./src/templates/example-generator.ts",
|
|
35
|
+
"./utils": "./src/utils.ts"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
37
38
|
"dist",
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"README.md"
|
|
40
41
|
],
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@contractspec/lib.contracts": "1.
|
|
43
|
-
"@contractspec/lib.schema": "1.
|
|
43
|
+
"@contractspec/lib.contracts": "1.59.0",
|
|
44
|
+
"@contractspec/lib.schema": "1.59.0",
|
|
44
45
|
"@inquirer/prompts": "^8.2.0",
|
|
45
46
|
"zod": "^4.3.5",
|
|
46
47
|
"commander": "^12.1.0",
|
|
@@ -49,16 +50,35 @@
|
|
|
49
50
|
"mustache": "^4.2.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@contractspec/tool.
|
|
53
|
-
"@contractspec/tool.typescript": "1.57.0",
|
|
53
|
+
"@contractspec/tool.typescript": "1.59.0",
|
|
54
54
|
"@types/fs-extra": "^11.0.4",
|
|
55
55
|
"@types/mustache": "^4.2.5",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"@contractspec/tool.bun": "1.58.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public",
|
|
61
|
-
"registry": "https://registry.npmjs.org/"
|
|
61
|
+
"registry": "https://registry.npmjs.org/",
|
|
62
|
+
"exports": {
|
|
63
|
+
".": {
|
|
64
|
+
"types": "./dist/index.d.ts",
|
|
65
|
+
"bun": "./dist/index.js",
|
|
66
|
+
"node": "./dist/node/index.mjs",
|
|
67
|
+
"default": "./dist/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./templates/example-generator": {
|
|
70
|
+
"types": "./dist/templates/example-generator.d.ts",
|
|
71
|
+
"bun": "./dist/templates/example-generator.js",
|
|
72
|
+
"node": "./dist/node/templates/example-generator.mjs",
|
|
73
|
+
"default": "./dist/templates/example-generator.js"
|
|
74
|
+
},
|
|
75
|
+
"./utils": {
|
|
76
|
+
"types": "./dist/utils.d.ts",
|
|
77
|
+
"bun": "./dist/utils.js",
|
|
78
|
+
"node": "./dist/node/utils.mjs",
|
|
79
|
+
"default": "./dist/utils.js"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
62
82
|
},
|
|
63
83
|
"license": "MIT",
|
|
64
84
|
"repository": {
|
|
@@ -66,5 +86,6 @@
|
|
|
66
86
|
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
67
87
|
"directory": "packages/tools/create-contractspec-plugin"
|
|
68
88
|
},
|
|
69
|
-
"homepage": "https://contractspec.io"
|
|
89
|
+
"homepage": "https://contractspec.io",
|
|
90
|
+
"types": "./dist/index.d.ts"
|
|
70
91
|
}
|