@opcat-labs/cli-opcat 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/assets/apply_asm.cjs +130 -0
- package/assets/templates/.gitkeep +0 -0
- package/assets/templates/counter.tar.gz +0 -0
- package/assets/templates/demo-contract.tar.gz +0 -0
- package/assets/templates/demo-lib.tar.gz +0 -0
- package/assets/tsconfig.json +22 -0
- package/bin/main.js +4 -0
- package/dist/app.module.d.ts +3 -0
- package/dist/app.module.d.ts.map +1 -0
- package/dist/app.module.js +26 -0
- package/dist/app.module.js.map +1 -0
- package/dist/commands/compile.command.d.ts +13 -0
- package/dist/commands/compile.command.d.ts.map +1 -0
- package/dist/commands/compile.command.js +103 -0
- package/dist/commands/compile.command.js.map +1 -0
- package/dist/commands/compile.d.ts +10 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +251 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/deploy.command.d.ts +11 -0
- package/dist/commands/deploy.command.d.ts.map +1 -0
- package/dist/commands/deploy.command.js +79 -0
- package/dist/commands/deploy.command.js.map +1 -0
- package/dist/commands/project.command.d.ts +11 -0
- package/dist/commands/project.command.d.ts.map +1 -0
- package/dist/commands/project.command.js +94 -0
- package/dist/commands/project.command.js.map +1 -0
- package/dist/commands/project.d.ts +24 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +217 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/system.command.d.ts +6 -0
- package/dist/commands/system.command.d.ts.map +1 -0
- package/dist/commands/system.command.js +41 -0
- package/dist/commands/system.command.js.map +1 -0
- package/dist/commands/version.command.d.ts +6 -0
- package/dist/commands/version.command.d.ts.map +1 -0
- package/dist/commands/version.command.js +32 -0
- package/dist/commands/version.command.js.map +1 -0
- package/dist/common/utils.d.ts +68 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/common/utils.js +263 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +18 -0
- package/dist/main.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.unTarTemplates = exports.createAsmDir = exports.extractBaseNames = exports.resolvePaths = exports.camelCaseCapitalized = exports.camelCase = exports.kebabCase = exports.titleCase = exports.isProjectRoot = exports.writeAsset = exports.readAsset = exports.changeExtension = exports.deletefile = exports.writefile = exports.readfile = exports.replaceInFile = exports.stepCmd = exports.step = exports.readdirRecursive = exports.shExecWithoutOutput = exports.shExec = void 0;
|
|
30
|
+
const ora_1 = __importDefault(require("ora"));
|
|
31
|
+
const util_1 = __importDefault(require("util"));
|
|
32
|
+
const shelljs_1 = __importDefault(require("shelljs"));
|
|
33
|
+
const fs_1 = __importDefault(require("fs"));
|
|
34
|
+
const glob_1 = require("glob");
|
|
35
|
+
const chalk_1 = require("chalk");
|
|
36
|
+
const promises_1 = require("fs/promises");
|
|
37
|
+
const path_1 = require("path");
|
|
38
|
+
const process_1 = require("process");
|
|
39
|
+
const hjson_1 = __importDefault(require("hjson"));
|
|
40
|
+
const tar = __importStar(require("tar"));
|
|
41
|
+
exports.shExec = util_1.default.promisify(shelljs_1.default.exec);
|
|
42
|
+
function shExecWithoutOutput(command) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
shelljs_1.default.exec(command, { silent: true }, (code, stdout, stderr) => {
|
|
45
|
+
if (code !== 0) {
|
|
46
|
+
reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
resolve(stdout);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.shExecWithoutOutput = shExecWithoutOutput;
|
|
55
|
+
async function readdirRecursive(dir) {
|
|
56
|
+
const files = await (0, promises_1.readdir)(dir, { withFileTypes: true });
|
|
57
|
+
const paths = files.map(async (file) => {
|
|
58
|
+
const p = (0, path_1.join)(dir, file.name);
|
|
59
|
+
if (file.isDirectory())
|
|
60
|
+
return await readdirRecursive(p);
|
|
61
|
+
return p;
|
|
62
|
+
});
|
|
63
|
+
return (await Promise.all(paths)).flat(1);
|
|
64
|
+
}
|
|
65
|
+
exports.readdirRecursive = readdirRecursive;
|
|
66
|
+
/**
|
|
67
|
+
* Helper for any steps for a consistent UX.
|
|
68
|
+
* @template T
|
|
69
|
+
* @param {string} step Name of step to show user.
|
|
70
|
+
* @param {() => Promise<T>} fn An async function to execute.
|
|
71
|
+
* @returns {Promise<T>}
|
|
72
|
+
*/
|
|
73
|
+
async function step(str, fn) {
|
|
74
|
+
const spin = (0, ora_1.default)({ text: `${str}...`, discardStdin: true }).start();
|
|
75
|
+
try {
|
|
76
|
+
const result = await fn();
|
|
77
|
+
spin.succeed((0, chalk_1.green)(str));
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
spin.fail(str);
|
|
82
|
+
console.error(' ' + (0, chalk_1.red)(err)); // maintain expected indentation
|
|
83
|
+
(0, process_1.exit)(-1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.step = step;
|
|
87
|
+
/**
|
|
88
|
+
* Helper for any steps that need to call a shell command.
|
|
89
|
+
* @param {string} step - Name of step to show user
|
|
90
|
+
* @param {string} cmd - Shell command to execute.
|
|
91
|
+
* @returns {Promise<string>}
|
|
92
|
+
*/
|
|
93
|
+
async function stepCmd(step, cmd, exitOnError = true) {
|
|
94
|
+
const spin = (0, ora_1.default)({ text: `${step}...\n`, discardStdin: true }).start();
|
|
95
|
+
try {
|
|
96
|
+
const result = await (0, exports.shExec)(cmd);
|
|
97
|
+
spin.succeed((0, chalk_1.green)(step));
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.log(' ' + (0, chalk_1.red)(err.stack));
|
|
102
|
+
spin.fail(step);
|
|
103
|
+
if (exitOnError) {
|
|
104
|
+
(0, process_1.exit)(-1);
|
|
105
|
+
}
|
|
106
|
+
return err;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.stepCmd = stepCmd;
|
|
110
|
+
/**
|
|
111
|
+
* Helper to replace text in a file.
|
|
112
|
+
* @param {string} file - Path to file
|
|
113
|
+
* @param {string} a - Old text.
|
|
114
|
+
* @param {string} b - New text.
|
|
115
|
+
*/
|
|
116
|
+
function replaceInFile(file, a, b) {
|
|
117
|
+
let content = fs_1.default.readFileSync(file, 'utf8');
|
|
118
|
+
content = content.replaceAll(a, b);
|
|
119
|
+
fs_1.default.writeFileSync(file, content);
|
|
120
|
+
}
|
|
121
|
+
exports.replaceInFile = replaceInFile;
|
|
122
|
+
/**
|
|
123
|
+
* Helper to read a JSON file
|
|
124
|
+
* @param {string} file
|
|
125
|
+
* @param {boolean} if returns json format
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
function readfile(file, json = true) {
|
|
129
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
130
|
+
if (json) {
|
|
131
|
+
return hjson_1.default.parse(content);
|
|
132
|
+
}
|
|
133
|
+
return content;
|
|
134
|
+
}
|
|
135
|
+
exports.readfile = readfile;
|
|
136
|
+
/**
|
|
137
|
+
* Helper to write a JSON object to a file
|
|
138
|
+
* @param {string} path - Path of file
|
|
139
|
+
* @param {object | string} content - Object or text to save
|
|
140
|
+
*/
|
|
141
|
+
function writefile(file, content) {
|
|
142
|
+
if (typeof content === 'string') {
|
|
143
|
+
fs_1.default.writeFileSync(file, content);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
fs_1.default.writeFileSync(file, JSON.stringify(content, null, 2));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.writefile = writefile;
|
|
150
|
+
/**
|
|
151
|
+
* Helper function to delete a file or directory.
|
|
152
|
+
* @param {string} itemPath Path to the file or directory to delete.
|
|
153
|
+
*/
|
|
154
|
+
function deletefile(itemPath) {
|
|
155
|
+
try {
|
|
156
|
+
// Check if the item is a directory or file
|
|
157
|
+
if (fs_1.default.statSync(itemPath).isDirectory()) {
|
|
158
|
+
fs_1.default.rmdirSync(itemPath, { recursive: true });
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
fs_1.default.unlinkSync(itemPath);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
// If the error is about the item not existing, just continue
|
|
166
|
+
// For other errors, throw the error for further handling
|
|
167
|
+
if (error.code !== 'ENOENT') {
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.deletefile = deletefile;
|
|
173
|
+
/**
|
|
174
|
+
* Helper to change file extension in a path
|
|
175
|
+
* @param {string} file - The path of a file
|
|
176
|
+
* @param {string} extension
|
|
177
|
+
* @returns {string}
|
|
178
|
+
*/
|
|
179
|
+
function changeExtension(file, extension) {
|
|
180
|
+
const name = (0, path_1.basename)(file, (0, path_1.extname)(file));
|
|
181
|
+
return (0, path_1.join)((0, path_1.dirname)(file), name + '.' + extension);
|
|
182
|
+
}
|
|
183
|
+
exports.changeExtension = changeExtension;
|
|
184
|
+
/**
|
|
185
|
+
* Read config in src/configs
|
|
186
|
+
* @param {string} config Filename
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
function readAsset(filename) {
|
|
190
|
+
return readfile((0, path_1.join)((0, path_1.dirname)(__filename), '..', '..', 'assets', filename), false);
|
|
191
|
+
}
|
|
192
|
+
exports.readAsset = readAsset;
|
|
193
|
+
function writeAsset(absolutePath, assetFileName) {
|
|
194
|
+
const fileName = absolutePath.substring(absolutePath.lastIndexOf(path_1.sep) + 1);
|
|
195
|
+
const fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
|
|
196
|
+
if (fs_1.default.existsSync(absolutePath)) {
|
|
197
|
+
console.log((0, chalk_1.yellow)(`Found ${fileName}, move to ${fileName}.backup`));
|
|
198
|
+
fs_1.default.renameSync(absolutePath, changeExtension(absolutePath, `${fileExtension}.backup`));
|
|
199
|
+
}
|
|
200
|
+
writefile(absolutePath, readAsset(assetFileName || fileName));
|
|
201
|
+
}
|
|
202
|
+
exports.writeAsset = writeAsset;
|
|
203
|
+
function isProjectRoot() {
|
|
204
|
+
return fs_1.default.existsSync('package.json') && fs_1.default.existsSync('tsconfig.json');
|
|
205
|
+
}
|
|
206
|
+
exports.isProjectRoot = isProjectRoot;
|
|
207
|
+
function titleCase(str) {
|
|
208
|
+
return str
|
|
209
|
+
.split('-')
|
|
210
|
+
.map((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())
|
|
211
|
+
.join(' ')
|
|
212
|
+
.replace('Scrypt', 'sCrypt');
|
|
213
|
+
}
|
|
214
|
+
exports.titleCase = titleCase;
|
|
215
|
+
function kebabCase(str) {
|
|
216
|
+
return str.toLowerCase().replace(' ', '-');
|
|
217
|
+
}
|
|
218
|
+
exports.kebabCase = kebabCase;
|
|
219
|
+
function camelCase(str) {
|
|
220
|
+
const a = str.toLowerCase().replace(/[-_\s.]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''));
|
|
221
|
+
return a.substring(0, 1).toLowerCase() + a.substring(1);
|
|
222
|
+
}
|
|
223
|
+
exports.camelCase = camelCase;
|
|
224
|
+
function camelCaseCapitalized(str) {
|
|
225
|
+
const a = camelCase(str);
|
|
226
|
+
return a.substring(0, 1).toUpperCase() + a.substring(1);
|
|
227
|
+
}
|
|
228
|
+
exports.camelCaseCapitalized = camelCaseCapitalized;
|
|
229
|
+
function resolvePaths(patterns, options = {}) {
|
|
230
|
+
try {
|
|
231
|
+
let res = [];
|
|
232
|
+
for (const pattern of patterns) {
|
|
233
|
+
const files = glob_1.glob.globSync(pattern.replaceAll(path_1.sep, '/'), options);
|
|
234
|
+
res = res.concat(files);
|
|
235
|
+
}
|
|
236
|
+
return res;
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
throw new Error(`Error resolving paths: ${err.message}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
exports.resolvePaths = resolvePaths;
|
|
243
|
+
function extractBaseNames(input) {
|
|
244
|
+
return input.map((filePath) => (0, path_1.basename)(filePath, (0, path_1.extname)(filePath)));
|
|
245
|
+
}
|
|
246
|
+
exports.extractBaseNames = extractBaseNames;
|
|
247
|
+
async function createAsmDir() {
|
|
248
|
+
const step = 'Creating .asm dir ';
|
|
249
|
+
const asmDir = (0, path_1.join)('.', '.asm');
|
|
250
|
+
await stepCmd(step, `mkdir ${asmDir} && echo {} > ${asmDir}/asm.json`);
|
|
251
|
+
writefile((0, path_1.join)(asmDir, 'apply_asm.cjs'), readAsset('apply_asm.cjs'));
|
|
252
|
+
}
|
|
253
|
+
exports.createAsmDir = createAsmDir;
|
|
254
|
+
async function unTarTemplates(projectName, outDir) {
|
|
255
|
+
const tarPath = (0, path_1.join)((0, path_1.dirname)(__filename), '..', '..', 'assets', 'templates', `${projectName}.tar.gz`);
|
|
256
|
+
return tar.x({
|
|
257
|
+
file: tarPath,
|
|
258
|
+
C: outDir,
|
|
259
|
+
strip: 1,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
exports.unTarTemplates = unTarTemplates;
|
|
263
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,gDAAwB;AACxB,sDAAyB;AACzB,4CAAoB;AACpB,+BAAyC;AACzC,iCAA2C;AAC3C,0CAAsC;AACtC,+BAA6D;AAC7D,qCAA+B;AAC/B,kDAA0B;AAC1B,yCAA2B;AAEd,QAAA,MAAM,GAAG,cAAI,CAAC,SAAS,CAAC,iBAAE,CAAC,IAAI,CAAC,CAAC;AAE9C,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,iBAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAC1D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,CAAC,IA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C,EAAE,MAAM;QACT,KAAK,EAAE,CAAC;KACT,CAAC,CAAC;AACL,CAAC;AAdD,wCAcC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,kBAM9B"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bootstrap = void 0;
|
|
4
|
+
const nest_commander_1 = require("nest-commander");
|
|
5
|
+
const app_module_1 = require("./app.module");
|
|
6
|
+
async function bootstrap() {
|
|
7
|
+
try {
|
|
8
|
+
await nest_commander_1.CommandFactory.run(app_module_1.AppModule);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.error('bootstrap failed!', error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.bootstrap = bootstrap;
|
|
15
|
+
if (require.main === module) {
|
|
16
|
+
bootstrap();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,6CAAyC;AAElC,KAAK,UAAU,SAAS;IAC7B,IAAI,CAAC;QACH,MAAM,+BAAc,CAAC,GAAG,CAAC,sBAAS,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAND,8BAMC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,CAAC;AACd,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opcat-labs/cli-opcat",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool for creating and managing sCrypt projects.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"author": "sCrypt.Inc",
|
|
7
|
+
"bin": {
|
|
8
|
+
"scrypt-cli-opcat": "bin/main.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"bin",
|
|
13
|
+
"assets"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20.0.0"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"postinstall": "ts-patch install -s",
|
|
21
|
+
"#testcli": "use testcli not test to run this command before publish, do not run this command in branch & pr ci",
|
|
22
|
+
"testcli": "sh -x test/test-all-commands.sh",
|
|
23
|
+
"build": "nest build && yarn tar",
|
|
24
|
+
"tar": "cd templates && node tar.js",
|
|
25
|
+
"cli:dev": "nest start --",
|
|
26
|
+
"cli": "node dist/main"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@nestjs/common": "^10.0.0",
|
|
30
|
+
"@nestjs/core": "^10.0.0",
|
|
31
|
+
"@nestjs/platform-express": "^10.0.0",
|
|
32
|
+
"@opcat-labs/scrypt-ts-transpiler-opcat": "1.0.0",
|
|
33
|
+
"chalk": "4",
|
|
34
|
+
"envinfo": "^7.14.0",
|
|
35
|
+
"glob": "^11.0.0",
|
|
36
|
+
"hjson": "^3.2.2",
|
|
37
|
+
"nest-commander": "^3.14.0",
|
|
38
|
+
"ora": "5",
|
|
39
|
+
"shelljs": "^0.8.5",
|
|
40
|
+
"tar": "^7.4.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@nestjs/cli": "^10.0.0",
|
|
44
|
+
"@nestjs/schematics": "^10.0.0",
|
|
45
|
+
"@nestjs/testing": "^10.0.0",
|
|
46
|
+
"@types/express": "^4.17.17",
|
|
47
|
+
"@types/jest": "^29.5.2",
|
|
48
|
+
"@types/node": "^20.3.1"
|
|
49
|
+
}
|
|
50
|
+
}
|