@dedot/codegen 0.4.1-next.b1afe683.1 → 0.4.1
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/cjs/utils.js +3 -3
- package/package.json +10 -10
- package/utils.js +1 -1
package/cjs/utils.js
CHANGED
|
@@ -31,7 +31,7 @@ const fs = __importStar(require("fs"));
|
|
|
31
31
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
32
32
|
const path = __importStar(require("path"));
|
|
33
33
|
const prettier = __importStar(require("prettier"));
|
|
34
|
-
const
|
|
34
|
+
const dirname_js_1 = require("./dirname.js");
|
|
35
35
|
exports.WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
|
|
36
36
|
exports.TUPLE_TYPE_REGEX = /^\[(.*)]$/;
|
|
37
37
|
const commentBlock = (...docs) => {
|
|
@@ -49,12 +49,12 @@ ${flatLines.map((line) => `* ${line.replaceAll(/\s+/g, ' ').trim()}`).join('\n')
|
|
|
49
49
|
};
|
|
50
50
|
exports.commentBlock = commentBlock;
|
|
51
51
|
const beautifySourceCode = async (source) => {
|
|
52
|
-
const prettierOptions = await prettier.resolveConfig(path.resolve((0,
|
|
52
|
+
const prettierOptions = await prettier.resolveConfig(path.resolve((0, dirname_js_1.currentDirname)(), '../../../.prettierrc.cjs'));
|
|
53
53
|
return prettier.format(source, { parser: 'babel-ts', ...prettierOptions });
|
|
54
54
|
};
|
|
55
55
|
exports.beautifySourceCode = beautifySourceCode;
|
|
56
56
|
const compileTemplate = (templateFile) => {
|
|
57
|
-
const templateFilePath = path.resolve((0,
|
|
57
|
+
const templateFilePath = path.resolve((0, dirname_js_1.currentDirname)(), templateFile);
|
|
58
58
|
return handlebars_1.default.compile(fs.readFileSync(templateFilePath, 'utf8'));
|
|
59
59
|
};
|
|
60
60
|
exports.compileTemplate = compileTemplate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/codegen",
|
|
3
|
-
"version": "0.4.1
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Generate types",
|
|
5
5
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
6
6
|
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/codegen",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"copy": "cp -R ./src/chaintypes/templates ./dist/chaintypes && cp -R ./src/chaintypes/templates ./dist/cjs/chaintypes && cp -R ./src/typink/templates ./dist/typink && cp -R ./src/typink/templates ./dist/cjs/typink"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/api": "0.4.1
|
|
22
|
-
"@dedot/codecs": "0.4.1
|
|
23
|
-
"@dedot/contracts": "0.4.1
|
|
24
|
-
"@dedot/providers": "0.4.1
|
|
25
|
-
"@dedot/runtime-specs": "0.4.1
|
|
26
|
-
"@dedot/shape": "0.4.1
|
|
27
|
-
"@dedot/types": "0.4.1
|
|
28
|
-
"@dedot/utils": "0.4.1
|
|
21
|
+
"@dedot/api": "0.4.1",
|
|
22
|
+
"@dedot/codecs": "0.4.1",
|
|
23
|
+
"@dedot/contracts": "0.4.1",
|
|
24
|
+
"@dedot/providers": "0.4.1",
|
|
25
|
+
"@dedot/runtime-specs": "0.4.1",
|
|
26
|
+
"@dedot/shape": "0.4.1",
|
|
27
|
+
"@dedot/types": "0.4.1",
|
|
28
|
+
"@dedot/utils": "0.4.1",
|
|
29
29
|
"handlebars": "^4.7.8",
|
|
30
30
|
"prettier": "^3.3.3"
|
|
31
31
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"directory": "dist"
|
|
35
35
|
},
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "05b2a88dd2c78b17d68f0dd211e50be79e79852e",
|
|
38
38
|
"module": "./index.js",
|
|
39
39
|
"types": "./index.d.ts",
|
|
40
40
|
"exports": {
|
package/utils.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as fs from 'fs';
|
|
|
2
2
|
import handlebars from 'handlebars';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import * as prettier from 'prettier';
|
|
5
|
-
import { currentDirname } from './dirname';
|
|
5
|
+
import { currentDirname } from './dirname.js';
|
|
6
6
|
export const WRAPPER_TYPE_REGEX = /^(\w+)<(.*)>$/;
|
|
7
7
|
export const TUPLE_TYPE_REGEX = /^\[(.*)]$/;
|
|
8
8
|
export const commentBlock = (...docs) => {
|