@cosmwasm/ts-codegen 0.35.7 → 1.0.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/LICENSE-Apache +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +2 -2
- package/{types/src/builder → builder}/builder.d.ts +2 -2
- package/builder/builder.js +172 -0
- package/builder/index.js +17 -0
- package/bundler/bundler.d.ts +8 -0
- package/bundler/bundler.js +79 -0
- package/bundler/index.js +17 -0
- package/cli.d.ts +2 -0
- package/cli.js +24 -0
- package/cmds.d.ts +2 -0
- package/cmds.js +14 -0
- package/commands/create-boilerplate.d.ts +3 -0
- package/commands/create-boilerplate.js +132 -0
- package/commands/generate.d.ts +3 -0
- package/commands/generate.js +175 -0
- package/commands/install.d.ts +3 -0
- package/commands/install.js +107 -0
- package/{src/builder/builder.ts → esm/builder/builder.js} +39 -139
- package/esm/builder/index.js +1 -0
- package/esm/bundler/bundler.js +47 -0
- package/esm/bundler/index.js +1 -0
- package/esm/cli.js +20 -0
- package/{src → esm}/cmds.js +0 -1
- package/{src/commands/create-boilerplate.ts → esm/commands/create-boilerplate.js} +35 -70
- package/{src/commands/generate.ts → esm/commands/generate.js} +19 -24
- package/{src/commands/install.ts → esm/commands/install.js} +22 -35
- package/esm/file.js +18 -0
- package/esm/generators/client.js +67 -0
- package/esm/generators/create-helpers.js +36 -0
- package/esm/generators/message-composer.js +55 -0
- package/esm/generators/msg-builder.js +58 -0
- package/esm/generators/react-query.js +76 -0
- package/esm/generators/recoil.js +58 -0
- package/esm/generators/types.js +58 -0
- package/{src/index.ts → esm/index.js} +3 -6
- package/esm/plugins/client.js +59 -0
- package/esm/plugins/message-builder.js +52 -0
- package/esm/plugins/message-composer.js +46 -0
- package/esm/plugins/plugin-base.js +47 -0
- package/esm/plugins/provider-bundle.js +58 -0
- package/esm/plugins/provider.js +73 -0
- package/esm/plugins/react-query.js +69 -0
- package/esm/plugins/recoil.js +51 -0
- package/esm/plugins/types.js +38 -0
- package/{src → esm}/ts-codegen.js +1 -2
- package/{src/utils/clean.ts → esm/utils/clean.js} +7 -7
- package/{src/utils/cleanse.ts → esm/utils/cleanse.js} +18 -22
- package/esm/utils/files.js +42 -0
- package/{src/utils/parse.ts → esm/utils/parse.js} +4 -13
- package/esm/utils/prompt.js +59 -0
- package/{src/utils/schemas.ts → esm/utils/schemas.js} +16 -44
- package/esm/utils/unused.js +47 -0
- package/file.js +20 -0
- package/generators/client.js +95 -0
- package/generators/create-helpers.js +43 -0
- package/generators/message-composer.js +83 -0
- package/generators/msg-builder.js +86 -0
- package/generators/react-query.js +104 -0
- package/generators/recoil.js +86 -0
- package/generators/types.js +86 -0
- package/{module/helpers → helpers}/contractContextBase.js +5 -2
- package/{module/helpers → helpers}/contractContextBaseShortHandCtor.js +5 -2
- package/{module/helpers → helpers}/contractsContextTSX.js +5 -2
- package/{module/helpers/index.js → helpers/index.d.ts} +1 -1
- package/helpers/index.js +19 -0
- package/index.js +39 -0
- package/package.json +27 -51
- package/plugins/client.js +86 -0
- package/plugins/index.d.ts +1 -0
- package/plugins/index.js +17 -0
- package/plugins/message-builder.js +79 -0
- package/plugins/message-composer.js +73 -0
- package/{types/src/plugins → plugins}/plugin-base.d.ts +1 -1
- package/plugins/plugin-base.js +77 -0
- package/plugins/provider-bundle.js +85 -0
- package/{types/src/plugins → plugins}/provider.d.ts +2 -2
- package/plugins/provider.js +102 -0
- package/plugins/react-query.js +96 -0
- package/plugins/recoil.js +78 -0
- package/plugins/types.js +65 -0
- package/ts-codegen.js +8 -0
- package/utils/clean.js +49 -0
- package/utils/cleanse.js +89 -0
- package/utils/files.js +73 -0
- package/utils/header.js +14 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +17 -0
- package/utils/parse.d.ts +1 -0
- package/utils/parse.js +43 -0
- package/utils/prompt.d.ts +3 -0
- package/utils/prompt.js +65 -0
- package/utils/schemas.d.ts +11 -0
- package/utils/schemas.js +81 -0
- package/utils/unused.js +73 -0
- package/main/builder/builder.js +0 -308
- package/main/builder/index.js +0 -16
- package/main/bundler/bundler.js +0 -61
- package/main/bundler/index.js +0 -16
- package/main/cli.js +0 -51
- package/main/cmds.js +0 -15
- package/main/commands/create-boilerplate.js +0 -166
- package/main/commands/generate.js +0 -196
- package/main/commands/install.js +0 -138
- package/main/file.js +0 -35
- package/main/generators/client.js +0 -90
- package/main/generators/create-helpers.js +0 -38
- package/main/generators/message-composer.js +0 -77
- package/main/generators/msg-builder.js +0 -84
- package/main/generators/react-query.js +0 -102
- package/main/generators/recoil.js +0 -81
- package/main/generators/types.js +0 -82
- package/main/helpers/contractContextBase.js +0 -8
- package/main/helpers/contractContextBaseShortHandCtor.js +0 -8
- package/main/helpers/contractsContextTSX.js +0 -8
- package/main/helpers/index.js +0 -38
- package/main/index.js +0 -119
- package/main/plugins/client.js +0 -112
- package/main/plugins/index.js +0 -16
- package/main/plugins/message-builder.js +0 -102
- package/main/plugins/message-composer.js +0 -98
- package/main/plugins/plugin-base.js +0 -103
- package/main/plugins/provider-bundle.js +0 -108
- package/main/plugins/provider.js +0 -126
- package/main/plugins/react-query.js +0 -120
- package/main/plugins/recoil.js +0 -108
- package/main/plugins/types.js +0 -89
- package/main/ts-codegen.js +0 -20
- package/main/utils/clean.js +0 -53
- package/main/utils/cleanse.js +0 -87
- package/main/utils/files.js +0 -57
- package/main/utils/header.js +0 -11
- package/main/utils/index.js +0 -16
- package/main/utils/parse.js +0 -44
- package/main/utils/prompt.js +0 -98
- package/main/utils/schemas.js +0 -144
- package/main/utils/unused.js +0 -57
- package/module/builder/builder.js +0 -143
- package/module/builder/index.js +0 -1
- package/module/bundler/bundler.js +0 -36
- package/module/bundler/index.js +0 -1
- package/module/cli.js +0 -19
- package/module/cmds.js +0 -8
- package/module/commands/create-boilerplate.js +0 -102
- package/module/commands/generate.js +0 -163
- package/module/commands/install.js +0 -98
- package/module/file.js +0 -18
- package/module/generators/client.js +0 -65
- package/module/generators/create-helpers.js +0 -33
- package/module/generators/message-composer.js +0 -52
- package/module/generators/msg-builder.js +0 -58
- package/module/generators/react-query.js +0 -75
- package/module/generators/recoil.js +0 -53
- package/module/generators/types.js +0 -55
- package/module/index.js +0 -14
- package/module/plugins/client.js +0 -63
- package/module/plugins/index.js +0 -1
- package/module/plugins/message-builder.js +0 -55
- package/module/plugins/message-composer.js +0 -49
- package/module/plugins/plugin-base.js +0 -66
- package/module/plugins/provider-bundle.js +0 -56
- package/module/plugins/provider.js +0 -68
- package/module/plugins/react-query.js +0 -72
- package/module/plugins/recoil.js +0 -57
- package/module/plugins/types.js +0 -42
- package/module/ts-codegen.js +0 -6
- package/module/utils/clean.js +0 -44
- package/module/utils/cleanse.js +0 -78
- package/module/utils/files.js +0 -40
- package/module/utils/header.js +0 -8
- package/module/utils/index.js +0 -1
- package/module/utils/parse.js +0 -35
- package/module/utils/prompt.js +0 -63
- package/module/utils/schemas.js +0 -85
- package/module/utils/unused.js +0 -43
- package/src/builder/index.ts +0 -1
- package/src/bundler/bundler.ts +0 -67
- package/src/bundler/index.ts +0 -1
- package/src/cli.js +0 -21
- package/src/file.js +0 -20
- package/src/generators/client.ts +0 -109
- package/src/generators/create-helpers.ts +0 -71
- package/src/generators/message-composer.ts +0 -86
- package/src/generators/msg-builder.ts +0 -78
- package/src/generators/react-query.ts +0 -102
- package/src/generators/recoil.ts +0 -92
- package/src/generators/types.ts +0 -94
- package/src/helpers/index.ts +0 -3
- package/src/plugins/client.ts +0 -124
- package/src/plugins/index.ts +0 -1
- package/src/plugins/message-builder.ts +0 -85
- package/src/plugins/message-composer.ts +0 -89
- package/src/plugins/plugin-base.ts +0 -122
- package/src/plugins/provider-bundle.ts +0 -98
- package/src/plugins/provider.ts +0 -115
- package/src/plugins/react-query.ts +0 -115
- package/src/plugins/recoil.ts +0 -89
- package/src/plugins/types.ts +0 -74
- package/src/utils/files.ts +0 -73
- package/src/utils/index.ts +0 -1
- package/src/utils/prompt.js +0 -65
- package/src/utils/unused.ts +0 -52
- package/types/src/bundler/bundler.d.ts +0 -4
- package/types/src/cli.d.ts +0 -1
- package/types/src/cmds.d.ts +0 -1
- package/types/src/commands/create-boilerplate.d.ts +0 -2
- package/types/src/commands/generate.d.ts +0 -2
- package/types/src/commands/install.d.ts +0 -2
- package/types/src/generators/msg-builder.ts +0 -5
- package/types/src/plugins/msg-builder.d.ts +0 -12
- package/types/src/plugins/use-contracts.d.ts +0 -12
- package/types/src/types.d.ts +0 -16
- package/types/src/utils/parse.d.ts +0 -1
- package/types/src/utils/prompt.d.ts +0 -3
- package/types/src/utils/schemas.d.ts +0 -10
- /package/{types/src/builder → builder}/index.d.ts +0 -0
- /package/{types/src/bundler → bundler}/index.d.ts +0 -0
- /package/{src/helpers/contractContextBase.ts → esm/helpers/contractContextBase.js} +0 -0
- /package/{src/helpers/contractContextBaseShortHandCtor.ts → esm/helpers/contractContextBaseShortHandCtor.js} +0 -0
- /package/{src/helpers/contractsContextTSX.ts → esm/helpers/contractsContextTSX.js} +0 -0
- /package/{types/src/helpers/index.d.ts → esm/helpers/index.js} +0 -0
- /package/{types/src/plugins/index.d.ts → esm/plugins/index.js} +0 -0
- /package/{src/utils/header.ts → esm/utils/header.js} +0 -0
- /package/{types/src/utils/index.d.ts → esm/utils/index.js} +0 -0
- /package/{types/src/file.d.ts → file.d.ts} +0 -0
- /package/{types/src/generators → generators}/client.d.ts +0 -0
- /package/{types/src/generators → generators}/create-helpers.d.ts +0 -0
- /package/{types/src/generators → generators}/message-composer.d.ts +0 -0
- /package/{types/src/generators → generators}/msg-builder.d.ts +0 -0
- /package/{types/src/generators → generators}/react-query.d.ts +0 -0
- /package/{types/src/generators → generators}/recoil.d.ts +0 -0
- /package/{types/src/generators → generators}/types.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractContextBase.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractContextBaseShortHandCtor.d.ts +0 -0
- /package/{types/src/helpers → helpers}/contractsContextTSX.d.ts +0 -0
- /package/{types/src/index.d.ts → index.d.ts} +0 -0
- /package/{types/src/plugins → plugins}/client.d.ts +0 -0
- /package/{types/src/plugins → plugins}/message-builder.d.ts +0 -0
- /package/{types/src/plugins → plugins}/message-composer.d.ts +0 -0
- /package/{types/src/plugins → plugins}/provider-bundle.d.ts +0 -0
- /package/{types/src/plugins → plugins}/react-query.d.ts +0 -0
- /package/{types/src/plugins → plugins}/recoil.d.ts +0 -0
- /package/{types/src/plugins → plugins}/types.d.ts +0 -0
- /package/{types/src/ts-codegen.d.ts → ts-codegen.d.ts} +0 -0
- /package/{types/src/utils → utils}/clean.d.ts +0 -0
- /package/{types/src/utils → utils}/cleanse.d.ts +0 -0
- /package/{types/src/utils → utils}/files.d.ts +0 -0
- /package/{types/src/utils → utils}/header.d.ts +0 -0
- /package/{types/src/utils → utils}/unused.d.ts +0 -0
package/main/utils/prompt.js
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.prompt = exports.getFuzzySearchNames = exports.getFuzzySearch = void 0;
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
-
var _fuzzy = require("fuzzy");
|
12
|
-
var _inquirerer = require("inquirerer");
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
var getFuzzySearch = function getFuzzySearch(list) {
|
16
|
-
return function (answers, input) {
|
17
|
-
input = input || '';
|
18
|
-
return new Promise(function (resolve) {
|
19
|
-
setTimeout(function () {
|
20
|
-
var fuzzyResult = (0, _fuzzy.filter)(input, list);
|
21
|
-
resolve(fuzzyResult.map(function (el) {
|
22
|
-
return el.original;
|
23
|
-
}));
|
24
|
-
}, 25);
|
25
|
-
});
|
26
|
-
};
|
27
|
-
};
|
28
|
-
exports.getFuzzySearch = getFuzzySearch;
|
29
|
-
var getFuzzySearchNames = function getFuzzySearchNames(nameValueItemList) {
|
30
|
-
var list = nameValueItemList.map(function (_ref) {
|
31
|
-
var name = _ref.name,
|
32
|
-
value = _ref.value;
|
33
|
-
return name;
|
34
|
-
});
|
35
|
-
return function (answers, input) {
|
36
|
-
input = input || '';
|
37
|
-
return new Promise(function (resolve) {
|
38
|
-
setTimeout(function () {
|
39
|
-
var fuzzyResult = (0, _fuzzy.filter)(input, list);
|
40
|
-
resolve(fuzzyResult.map(function (el) {
|
41
|
-
return nameValueItemList.find(function (_ref2) {
|
42
|
-
var name = _ref2.name,
|
43
|
-
value = _ref2.value;
|
44
|
-
return el.original == name;
|
45
|
-
});
|
46
|
-
}));
|
47
|
-
}, 25);
|
48
|
-
});
|
49
|
-
};
|
50
|
-
};
|
51
|
-
exports.getFuzzySearchNames = getFuzzySearchNames;
|
52
|
-
var transform = function transform(questions) {
|
53
|
-
return questions.map(function (q) {
|
54
|
-
if (q.type === 'fuzzy') {
|
55
|
-
var choices = q.choices;
|
56
|
-
delete q.choices;
|
57
|
-
return _objectSpread(_objectSpread({}, q), {}, {
|
58
|
-
type: 'autocomplete',
|
59
|
-
source: getFuzzySearch(choices)
|
60
|
-
});
|
61
|
-
} else if (q.type === 'fuzzy:objects') {
|
62
|
-
var _choices = q.choices;
|
63
|
-
delete q.choices;
|
64
|
-
return _objectSpread(_objectSpread({}, q), {}, {
|
65
|
-
type: 'autocomplete',
|
66
|
-
source: getFuzzySearchNames(_choices)
|
67
|
-
});
|
68
|
-
} else {
|
69
|
-
return q;
|
70
|
-
}
|
71
|
-
});
|
72
|
-
};
|
73
|
-
var prompt = /*#__PURE__*/function () {
|
74
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
75
|
-
var questions,
|
76
|
-
argv,
|
77
|
-
_args = arguments;
|
78
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
79
|
-
while (1) switch (_context.prev = _context.next) {
|
80
|
-
case 0:
|
81
|
-
questions = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
82
|
-
argv = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
83
|
-
questions = transform(questions);
|
84
|
-
_context.next = 5;
|
85
|
-
return (0, _inquirerer.prompt)(questions, argv);
|
86
|
-
case 5:
|
87
|
-
return _context.abrupt("return", _context.sent);
|
88
|
-
case 6:
|
89
|
-
case "end":
|
90
|
-
return _context.stop();
|
91
|
-
}
|
92
|
-
}, _callee);
|
93
|
-
}));
|
94
|
-
return function prompt() {
|
95
|
-
return _ref3.apply(this, arguments);
|
96
|
-
};
|
97
|
-
}();
|
98
|
-
exports.prompt = prompt;
|
package/main/utils/schemas.js
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.readSchemas = exports.findQueryMsg = exports.findExecuteMsg = exports.findAndParseTypes = void 0;
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
12
|
-
var _glob = require("glob");
|
13
|
-
var _fs = require("fs");
|
14
|
-
var _cleanse = require("./cleanse");
|
15
|
-
var _jsonSchemaToTypescript = require("@pyramation/json-schema-to-typescript");
|
16
|
-
var _parse = require("./parse");
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
19
|
-
;
|
20
|
-
var readSchemas = /*#__PURE__*/function () {
|
21
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
|
22
|
-
var schemaDir, _ref$clean, clean, fn, files, schemas, idlObject, contract_name, contract_version, idl_version, responses, instantiate, execute, query, migrate, sudo;
|
23
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
24
|
-
while (1) switch (_context.prev = _context.next) {
|
25
|
-
case 0:
|
26
|
-
schemaDir = _ref.schemaDir, _ref$clean = _ref.clean, clean = _ref$clean === void 0 ? true : _ref$clean;
|
27
|
-
fn = clean ? _cleanse.cleanse : function (str) {
|
28
|
-
return str;
|
29
|
-
};
|
30
|
-
files = (0, _glob.sync)(schemaDir + '/**/*.json').filter(function (file) {
|
31
|
-
return !file.match(/\/raw\//);
|
32
|
-
});
|
33
|
-
schemas = files.map(function (file) {
|
34
|
-
return JSON.parse((0, _fs.readFileSync)(file, 'utf-8'));
|
35
|
-
});
|
36
|
-
if (!(schemas.length > 1)) {
|
37
|
-
_context.next = 6;
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
return _context.abrupt("return", {
|
41
|
-
schemas: fn(schemas)
|
42
|
-
});
|
43
|
-
case 6:
|
44
|
-
if (!(schemas.length === 0)) {
|
45
|
-
_context.next = 8;
|
46
|
-
break;
|
47
|
-
}
|
48
|
-
throw new Error('Error [too few files]: requires one schema file per contract');
|
49
|
-
case 8:
|
50
|
-
if (!(schemas.length !== 1)) {
|
51
|
-
_context.next = 10;
|
52
|
-
break;
|
53
|
-
}
|
54
|
-
throw new Error('Error [too many files]: CosmWasm v1.1 schemas supports one file');
|
55
|
-
case 10:
|
56
|
-
idlObject = schemas[0];
|
57
|
-
contract_name = idlObject.contract_name, contract_version = idlObject.contract_version, idl_version = idlObject.idl_version, responses = idlObject.responses, instantiate = idlObject.instantiate, execute = idlObject.execute, query = idlObject.query, migrate = idlObject.migrate, sudo = idlObject.sudo;
|
58
|
-
if (!(typeof idl_version !== 'string')) {
|
59
|
-
_context.next = 14;
|
60
|
-
break;
|
61
|
-
}
|
62
|
-
return _context.abrupt("return", {
|
63
|
-
schemas: fn(schemas)
|
64
|
-
});
|
65
|
-
case 14:
|
66
|
-
return _context.abrupt("return", {
|
67
|
-
schemas: [].concat((0, _toConsumableArray2["default"])(Object.values(fn({
|
68
|
-
instantiate: instantiate,
|
69
|
-
execute: execute,
|
70
|
-
query: query,
|
71
|
-
migrate: migrate,
|
72
|
-
sudo: sudo
|
73
|
-
})).filter(Boolean)), (0, _toConsumableArray2["default"])(Object.values(fn(_objectSpread({}, responses))).filter(Boolean))),
|
74
|
-
responses: responses,
|
75
|
-
idlObject: idlObject
|
76
|
-
});
|
77
|
-
case 15:
|
78
|
-
case "end":
|
79
|
-
return _context.stop();
|
80
|
-
}
|
81
|
-
}, _callee);
|
82
|
-
}));
|
83
|
-
return function readSchemas(_x) {
|
84
|
-
return _ref2.apply(this, arguments);
|
85
|
-
};
|
86
|
-
}();
|
87
|
-
exports.readSchemas = readSchemas;
|
88
|
-
var findQueryMsg = function findQueryMsg(schemas) {
|
89
|
-
var QueryMsg = schemas.find(function (schema) {
|
90
|
-
return schema.title === 'QueryMsg';
|
91
|
-
});
|
92
|
-
return QueryMsg;
|
93
|
-
};
|
94
|
-
exports.findQueryMsg = findQueryMsg;
|
95
|
-
var findExecuteMsg = function findExecuteMsg(schemas) {
|
96
|
-
var ExecuteMsg = schemas.find(function (schema) {
|
97
|
-
return schema.title.startsWith('ExecuteMsg');
|
98
|
-
});
|
99
|
-
return ExecuteMsg;
|
100
|
-
};
|
101
|
-
exports.findExecuteMsg = findExecuteMsg;
|
102
|
-
var findAndParseTypes = /*#__PURE__*/function () {
|
103
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(schemas) {
|
104
|
-
var Types, allTypes, typ, _i, _Object$keys, key, result, typeHash;
|
105
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
106
|
-
while (1) switch (_context2.prev = _context2.next) {
|
107
|
-
case 0:
|
108
|
-
Types = schemas;
|
109
|
-
allTypes = [];
|
110
|
-
_context2.t0 = _regenerator["default"].keys(Types);
|
111
|
-
case 3:
|
112
|
-
if ((_context2.t1 = _context2.t0()).done) {
|
113
|
-
_context2.next = 12;
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
typ = _context2.t1.value;
|
117
|
-
if (Types[typ].definitions) {
|
118
|
-
for (_i = 0, _Object$keys = Object.keys(Types[typ].definitions); _i < _Object$keys.length; _i++) {
|
119
|
-
key = _Object$keys[_i];
|
120
|
-
// set title
|
121
|
-
Types[typ].definitions[key].title = key;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
_context2.next = 8;
|
125
|
-
return (0, _jsonSchemaToTypescript.compile)(Types[typ], Types[typ].title);
|
126
|
-
case 8:
|
127
|
-
result = _context2.sent;
|
128
|
-
allTypes.push(result);
|
129
|
-
_context2.next = 3;
|
130
|
-
break;
|
131
|
-
case 12:
|
132
|
-
typeHash = (0, _parse.parser)(allTypes);
|
133
|
-
return _context2.abrupt("return", typeHash);
|
134
|
-
case 14:
|
135
|
-
case "end":
|
136
|
-
return _context2.stop();
|
137
|
-
}
|
138
|
-
}, _callee2);
|
139
|
-
}));
|
140
|
-
return function findAndParseTypes(_x2) {
|
141
|
-
return _ref3.apply(this, arguments);
|
142
|
-
};
|
143
|
-
}();
|
144
|
-
exports.findAndParseTypes = findAndParseTypes;
|
package/main/utils/unused.js
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports.unused = void 0;
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
-
var t = _interopRequireWildcard(require("@babel/types"));
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
13
|
-
//@ts-nocheck
|
14
|
-
|
15
|
-
// https://github.com/chuyik/babel-plugin-danger-remove-unused-import
|
16
|
-
// https://github.com/chuyik/babel-plugin-danger-remove-unused-import/blob/c5454c21e94698a2464a12baa5590761932a71a8/License#L1
|
17
|
-
|
18
|
-
var unused = {
|
19
|
-
Program: {
|
20
|
-
exit: function exit(path) {
|
21
|
-
var UnRefBindings = new Map();
|
22
|
-
for (var _i = 0, _Object$entries = Object.entries(path.scope.bindings); _i < _Object$entries.length; _i++) {
|
23
|
-
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
24
|
-
name = _Object$entries$_i[0],
|
25
|
-
binding = _Object$entries$_i[1];
|
26
|
-
if (!binding.path.parentPath || binding.kind !== 'module') continue;
|
27
|
-
var source = binding.path.parentPath.get('source');
|
28
|
-
var importName = source.node.value;
|
29
|
-
if (!t.isStringLiteral(source)) continue;
|
30
|
-
var key = "".concat(importName, "(").concat(source.node.loc && source.node.loc.start.line, ")");
|
31
|
-
if (!UnRefBindings.has(key)) {
|
32
|
-
UnRefBindings.set(key, binding);
|
33
|
-
}
|
34
|
-
if (binding.referenced) {
|
35
|
-
UnRefBindings.set(key, null);
|
36
|
-
} else {
|
37
|
-
var nodeType = binding.path.node.type;
|
38
|
-
if (nodeType === 'ImportSpecifier') {
|
39
|
-
binding.path.remove();
|
40
|
-
} else if (nodeType === 'ImportDefaultSpecifier') {
|
41
|
-
binding.path.remove();
|
42
|
-
} else if (nodeType === 'ImportNamespaceSpecifier') {
|
43
|
-
binding.path.remove();
|
44
|
-
} else if (binding.path.parentPath) {
|
45
|
-
binding.path.parentPath.remove();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
UnRefBindings.forEach(function (binding, key) {
|
50
|
-
if (binding && binding.path.parentPath) {
|
51
|
-
binding.path.parentPath.remove();
|
52
|
-
}
|
53
|
-
});
|
54
|
-
}
|
55
|
-
}
|
56
|
-
};
|
57
|
-
exports.unused = unused;
|
@@ -1,143 +0,0 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
-
import { defaultOptions, BuilderContext } from "wasm-ast-types";
|
3
|
-
import { header } from '../utils/header';
|
4
|
-
import { join } from "path";
|
5
|
-
import { writeFileSync } from 'fs';
|
6
|
-
import { sync as mkdirp } from "mkdirp";
|
7
|
-
import { basename } from 'path';
|
8
|
-
import { readSchemas } from '../utils';
|
9
|
-
import deepmerge from 'deepmerge';
|
10
|
-
import { pascal } from "case";
|
11
|
-
import { createFileBundle, recursiveModuleBundle } from "../bundler";
|
12
|
-
import generate from '@babel/generator';
|
13
|
-
import * as t from '@babel/types';
|
14
|
-
import { ReactQueryPlugin } from "../plugins/react-query";
|
15
|
-
import { RecoilPlugin } from "../plugins/recoil";
|
16
|
-
import { MessageBuilderPlugin } from "../plugins/message-builder";
|
17
|
-
import { MessageComposerPlugin } from "../plugins/message-composer";
|
18
|
-
import { ClientPlugin } from "../plugins/client";
|
19
|
-
import { TypesPlugin } from "../plugins/types";
|
20
|
-
import { ContractsContextProviderPlugin } from "../plugins/provider";
|
21
|
-
import { createHelpers } from "../generators/create-helpers";
|
22
|
-
import { ContractsProviderBundlePlugin } from "../plugins/provider-bundle";
|
23
|
-
const defaultOpts = {
|
24
|
-
bundle: {
|
25
|
-
enabled: true,
|
26
|
-
scope: 'contracts',
|
27
|
-
bundleFile: 'bundle.ts'
|
28
|
-
},
|
29
|
-
useShorthandCtor: true
|
30
|
-
};
|
31
|
-
;
|
32
|
-
;
|
33
|
-
;
|
34
|
-
;
|
35
|
-
function getContract(contractOpt) {
|
36
|
-
if (typeof contractOpt === 'string') {
|
37
|
-
const name = basename(contractOpt);
|
38
|
-
const contractName = pascal(name);
|
39
|
-
return {
|
40
|
-
name: contractName,
|
41
|
-
dir: contractOpt
|
42
|
-
};
|
43
|
-
}
|
44
|
-
return {
|
45
|
-
name: pascal(contractOpt.name),
|
46
|
-
dir: contractOpt.dir
|
47
|
-
};
|
48
|
-
}
|
49
|
-
export class TSBuilder {
|
50
|
-
loadDefaultPlugins() {
|
51
|
-
[].push.apply(this.plugins, [new TypesPlugin(this.options), new ClientPlugin(this.options), new MessageComposerPlugin(this.options), new ReactQueryPlugin(this.options), new RecoilPlugin(this.options), new MessageBuilderPlugin(this.options), new ContractsContextProviderPlugin(this.options)]);
|
52
|
-
}
|
53
|
-
constructor({
|
54
|
-
contracts,
|
55
|
-
outPath,
|
56
|
-
options,
|
57
|
-
plugins
|
58
|
-
}) {
|
59
|
-
_defineProperty(this, "contracts", void 0);
|
60
|
-
_defineProperty(this, "outPath", void 0);
|
61
|
-
_defineProperty(this, "options", void 0);
|
62
|
-
_defineProperty(this, "plugins", []);
|
63
|
-
_defineProperty(this, "builderContext", new BuilderContext());
|
64
|
-
_defineProperty(this, "files", []);
|
65
|
-
this.contracts = contracts;
|
66
|
-
this.outPath = outPath;
|
67
|
-
this.options = deepmerge(deepmerge(defaultOptions, defaultOpts), options ?? {});
|
68
|
-
this.loadDefaultPlugins();
|
69
|
-
if (plugins && plugins.length) {
|
70
|
-
[].push.apply(this.plugins, plugins);
|
71
|
-
}
|
72
|
-
this.plugins.forEach(plugin => plugin.setBuilder(this));
|
73
|
-
}
|
74
|
-
async build() {
|
75
|
-
await this.process();
|
76
|
-
await this.after();
|
77
|
-
}
|
78
|
-
|
79
|
-
// lifecycle functions
|
80
|
-
async process() {
|
81
|
-
for (const contractOpt of this.contracts) {
|
82
|
-
const contract = getContract(contractOpt);
|
83
|
-
//resolve contract schema.
|
84
|
-
const contractInfo = await readSchemas({
|
85
|
-
schemaDir: contract.dir
|
86
|
-
});
|
87
|
-
|
88
|
-
//lifecycle and plugins.
|
89
|
-
await this.render(contract.name, contractInfo);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
async render(name, contractInfo) {
|
93
|
-
for (const plugin of this.plugins) {
|
94
|
-
let files = await plugin.render(name, contractInfo, this.outPath);
|
95
|
-
if (files && files.length) {
|
96
|
-
[].push.apply(this.files, files);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
async after() {
|
101
|
-
//create useContracts bundle file
|
102
|
-
const contractsProviderBundlePlugin = new ContractsProviderBundlePlugin(this.options);
|
103
|
-
contractsProviderBundlePlugin.setBuilder(this);
|
104
|
-
|
105
|
-
//contractContextProviders.ts
|
106
|
-
const files = await contractsProviderBundlePlugin.render("contractContextProviders", {
|
107
|
-
schemas: []
|
108
|
-
}, this.outPath);
|
109
|
-
if (files && files.length) {
|
110
|
-
[].push.apply(this.files, files);
|
111
|
-
}
|
112
|
-
const helpers = createHelpers({
|
113
|
-
outPath: this.outPath,
|
114
|
-
contracts: this.contracts,
|
115
|
-
options: this.options,
|
116
|
-
plugins: this.plugins
|
117
|
-
}, this.builderContext);
|
118
|
-
if (helpers && helpers.length) {
|
119
|
-
[].push.apply(this.files, helpers);
|
120
|
-
}
|
121
|
-
if (this.options.bundle.enabled) {
|
122
|
-
this.bundle();
|
123
|
-
}
|
124
|
-
}
|
125
|
-
async bundle() {
|
126
|
-
const allFiles = this.files;
|
127
|
-
const bundleFile = this.options.bundle.bundleFile;
|
128
|
-
const bundlePath = join(this.options?.bundle?.bundlePath ?? this.outPath, bundleFile);
|
129
|
-
const bundleVariables = {};
|
130
|
-
const importPaths = [];
|
131
|
-
allFiles.forEach(file => {
|
132
|
-
createFileBundle(`${this.options.bundle.scope}.${file.contract}`, file.filename, bundlePath, importPaths, bundleVariables);
|
133
|
-
});
|
134
|
-
const ast = recursiveModuleBundle(bundleVariables);
|
135
|
-
let code = generate(t.program([...importPaths, ...ast])).code;
|
136
|
-
if (this.options?.bundle?.bundlePath) {
|
137
|
-
mkdirp(this.options?.bundle?.bundlePath);
|
138
|
-
}
|
139
|
-
mkdirp(this.outPath);
|
140
|
-
if (code.trim() === '') code = 'export {};';
|
141
|
-
writeFileSync(bundlePath, header + code);
|
142
|
-
}
|
143
|
-
}
|
package/module/builder/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './builder';
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import * as t from '@babel/types';
|
2
|
-
import * as dotty from 'dotty';
|
3
|
-
import { relative, dirname, extname } from 'path';
|
4
|
-
export const recursiveModuleBundle = obj => {
|
5
|
-
return Object.keys(obj).map(key => {
|
6
|
-
if (obj[key]?.__export) {
|
7
|
-
// e.g. abci
|
8
|
-
// 1. create variable for abci
|
9
|
-
// 2. splat ALL _0, parms into abci
|
10
|
-
// 3. export that variable
|
11
|
-
|
12
|
-
const nmspc = t.variableDeclaration('const', [t.variableDeclarator(t.identifier(key), t.objectExpression(Object.keys(obj[key]).filter(a => a !== '__export').filter(a => a.startsWith('_')).map(a => t.spreadElement(t.identifier(a)))))]);
|
13
|
-
const others = Object.keys(obj[key]).filter(a => a !== '__export').filter(a => !a.startsWith('_'));
|
14
|
-
if (others.length) {
|
15
|
-
throw new Error('namespace and package not supported, yet.');
|
16
|
-
}
|
17
|
-
|
18
|
-
// return nmspc;
|
19
|
-
return t.exportNamedDeclaration(nmspc, []);
|
20
|
-
} else {
|
21
|
-
// you can make a namespace for obj[key]
|
22
|
-
// e.g. libs
|
23
|
-
return t.exportNamedDeclaration(t.tsModuleDeclaration(t.identifier(key), t.tsModuleBlock(recursiveModuleBundle(obj[key]))));
|
24
|
-
}
|
25
|
-
});
|
26
|
-
};
|
27
|
-
export const importNamespace = (ident, path) => t.importDeclaration([t.importNamespaceSpecifier(t.identifier(ident))], t.stringLiteral(path.replace(extname(path), '')));
|
28
|
-
let counter = 0;
|
29
|
-
export const createFileBundle = (pkg, filename, bundleFile, importPaths, bundleVariables) => {
|
30
|
-
let rel = relative(dirname(bundleFile), filename);
|
31
|
-
if (!rel.startsWith('.')) rel = `./${rel}`;
|
32
|
-
const variable = `_${counter++}`;
|
33
|
-
importPaths.push(importNamespace(variable, rel));
|
34
|
-
dotty.put(bundleVariables, pkg + '.__export', true);
|
35
|
-
dotty.put(bundleVariables, pkg + '.' + variable, true);
|
36
|
-
};
|
package/module/bundler/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './bundler';
|
package/module/cli.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { prompt } from './utils/prompt';
|
2
|
-
import { Commands as commands } from './cmds';
|
3
|
-
const question = [{
|
4
|
-
_: true,
|
5
|
-
type: 'fuzzy',
|
6
|
-
name: 'cmd',
|
7
|
-
message: 'what do you want to do?',
|
8
|
-
choices: Object.keys(commands)
|
9
|
-
}];
|
10
|
-
export const cli = async argv => {
|
11
|
-
var {
|
12
|
-
cmd
|
13
|
-
} = await prompt(question, argv);
|
14
|
-
if (typeof commands[cmd] === 'function') {
|
15
|
-
await commands[cmd](argv);
|
16
|
-
} else {
|
17
|
-
console.log('command not found.');
|
18
|
-
}
|
19
|
-
};
|
package/module/cmds.js
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import _create_boilerplate from './commands/create-boilerplate';
|
2
|
-
import _generate from './commands/generate';
|
3
|
-
import _install from './commands/install';
|
4
|
-
const Commands = {};
|
5
|
-
Commands['create-boilerplate'] = _create_boilerplate;
|
6
|
-
Commands['generate'] = _generate;
|
7
|
-
Commands['install'] = _install;
|
8
|
-
export { Commands };
|
@@ -1,102 +0,0 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
-
import * as shell from 'shelljs';
|
5
|
-
import { prompt } from '../utils/prompt';
|
6
|
-
import dargs from 'dargs';
|
7
|
-
const glob = require('glob').sync;
|
8
|
-
const fs = require('fs');
|
9
|
-
const path = require('path');
|
10
|
-
const repo = 'https://github.com/cosmology-tech/ts-codegen-module-boilerplate';
|
11
|
-
export default (async argv => {
|
12
|
-
if (!shell.which('git')) {
|
13
|
-
shell.echo('Sorry, this script requires git');
|
14
|
-
return shell.exit(1);
|
15
|
-
}
|
16
|
-
const {
|
17
|
-
name
|
18
|
-
} = await prompt([{
|
19
|
-
type: 'string',
|
20
|
-
name: 'name',
|
21
|
-
message: 'Enter your new module name'
|
22
|
-
}], argv);
|
23
|
-
shell.exec(`git clone ${repo} ${name}`);
|
24
|
-
shell.cd(name);
|
25
|
-
const questions = JSON.parse(fs.readFileSync(`.questions.json`));
|
26
|
-
const fullname = shell.exec('git config --global user.name', {
|
27
|
-
silent: true
|
28
|
-
}).trim();
|
29
|
-
const email = shell.exec('git config --global user.email', {
|
30
|
-
silent: true
|
31
|
-
}).trim();
|
32
|
-
|
33
|
-
// @__USERNAME__/__MODULENAME__
|
34
|
-
// __PACKAGE_IDENTIFIER__
|
35
|
-
const args = dargs(_objectSpread(_objectSpread({
|
36
|
-
_: []
|
37
|
-
}, argv), {}, {
|
38
|
-
__MODULENAME__: name,
|
39
|
-
__USERFULLNAME__: fullname,
|
40
|
-
__USEREMAIL__: email
|
41
|
-
}), {
|
42
|
-
allowCamelCase: true
|
43
|
-
});
|
44
|
-
const results = await prompt(questions, args);
|
45
|
-
let scopedResults;
|
46
|
-
const license = await prompt([{
|
47
|
-
name: '__LICENSE__',
|
48
|
-
message: 'Which license?',
|
49
|
-
choices: ['MIT', 'closed'],
|
50
|
-
type: 'list',
|
51
|
-
required: true
|
52
|
-
}], []);
|
53
|
-
if (results.__ACCESS__ === 'public') {
|
54
|
-
scopedResults = await prompt([{
|
55
|
-
type: 'confirm',
|
56
|
-
name: 'scoped',
|
57
|
-
message: 'use npm scopes?',
|
58
|
-
required: true
|
59
|
-
}], []);
|
60
|
-
}
|
61
|
-
const files = [].concat(glob(process.cwd() + '/**/.*')).concat(glob(process.cwd() + '/**/*'));
|
62
|
-
for (let i = 0; i < files.length; i++) {
|
63
|
-
const templateFile = files[i];
|
64
|
-
if (fs.lstatSync(templateFile).isDirectory()) continue;
|
65
|
-
let content = fs.readFileSync(templateFile).toString();
|
66
|
-
if (path.basename(templateFile) === 'LICENSE' && license.__LICENSE__ === 'closed') {
|
67
|
-
content = `Copyright (c) 2023 __USERFULLNAME__ <__USEREMAIL__> - All Rights Reserved
|
68
|
-
Unauthorized copying via any medium is strictly prohibited
|
69
|
-
Proprietary and confidential`;
|
70
|
-
}
|
71
|
-
Object.keys(results).forEach(key => {
|
72
|
-
if (/^__/.test(key)) {
|
73
|
-
content = content.replace(new RegExp(key, 'g'), results[key]);
|
74
|
-
}
|
75
|
-
});
|
76
|
-
if (results.__ACCESS__ === 'public') {
|
77
|
-
if (scopedResults.scoped) {
|
78
|
-
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}`);
|
79
|
-
} else {
|
80
|
-
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `${results.__MODULENAME__}`);
|
81
|
-
}
|
82
|
-
} else {
|
83
|
-
content = content.replace(/__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}`);
|
84
|
-
}
|
85
|
-
|
86
|
-
// if (path.basename(templateFile) === 'README.md') {
|
87
|
-
// content = `# ${results.__MODULENAME__}`;
|
88
|
-
// }
|
89
|
-
|
90
|
-
fs.writeFileSync(templateFile, content);
|
91
|
-
}
|
92
|
-
shell.rm('-rf', '.git');
|
93
|
-
shell.rm('-rf', '.questions.json');
|
94
|
-
console.log(`
|
95
|
-
|
96
|
-
|||
|
97
|
-
(o o)
|
98
|
-
ooO--(_)--Ooo-
|
99
|
-
|
100
|
-
✨ Great work!
|
101
|
-
`);
|
102
|
-
});
|