@contractspec/tool.create-contractspec-plugin 1.57.0 → 1.58.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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
import * as mustache from "mustache";
|
|
3
|
+
function renderTemplate(template, data) {
|
|
4
|
+
return mustache.render(template, data);
|
|
5
|
+
}
|
|
6
|
+
function formatDate(date = new Date) {
|
|
7
|
+
return date.toISOString().split("T")[0] ?? "";
|
|
8
|
+
}
|
|
9
|
+
function capitalize(str) {
|
|
10
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
11
|
+
}
|
|
12
|
+
function kebabToPascal(str) {
|
|
13
|
+
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
14
|
+
}
|
|
15
|
+
function kebabToCamel(str) {
|
|
16
|
+
const pascal = kebabToPascal(str);
|
|
17
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
renderTemplate,
|
|
21
|
+
kebabToPascal,
|
|
22
|
+
kebabToCamel,
|
|
23
|
+
formatDate,
|
|
24
|
+
capitalize
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template for the example-generator plugin
|
|
3
|
+
* Creates a markdown documentation generator from ContractSpec specs
|
|
4
|
+
*/
|
|
5
|
+
export declare function createExampleGeneratorTemplate(): {
|
|
6
|
+
files: {
|
|
7
|
+
'package.json': string;
|
|
8
|
+
'README.md': string;
|
|
9
|
+
'src/index.ts': string;
|
|
10
|
+
'src/types.ts': string;
|
|
11
|
+
'src/config.ts': string;
|
|
12
|
+
'src/generator.ts': string;
|
|
13
|
+
'src/utils/test-utils.ts': string;
|
|
14
|
+
'tests/generator.test.ts': string;
|
|
15
|
+
'tests/utils.test.ts': string;
|
|
16
|
+
'.github/workflows/ci.yml': string;
|
|
17
|
+
'tests/smoke.test.ts': string;
|
|
18
|
+
'.eslintrc.json': string;
|
|
19
|
+
'tsconfig.json': string;
|
|
20
|
+
'tsdown.config.js': string;
|
|
21
|
+
LICENSE: string;
|
|
22
|
+
'src/templates/index.ts': string;
|
|
23
|
+
'src/templates/types.ts': string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=example-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example-generator.d.ts","sourceRoot":"","sources":["../../src/templates/example-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,8BAA8B;;;;;;;;;;;;;;;;;;;;EAmkC7C"}
|