@mikemajesty/microservice-crud 6.1.5 → 6.1.7
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/package.json +1 -1
- package/src/cli.js +11 -9
- package/src/templates/module/swagger.js +1 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -46,7 +46,7 @@ const { getModuleSwagger: getModuleSwaggerMongo } = require('./templates/mongo/m
|
|
|
46
46
|
|
|
47
47
|
const createModule = async (name) => {
|
|
48
48
|
if (!name) throw new Error('--name is required')
|
|
49
|
-
name = name
|
|
49
|
+
name = getName(name)
|
|
50
50
|
const dirRoot = `${__dirname}/scafold/module/${name}`
|
|
51
51
|
|
|
52
52
|
console.log("dirRoot", dirRoot)
|
|
@@ -73,7 +73,7 @@ const createModule = async (name) => {
|
|
|
73
73
|
|
|
74
74
|
const createInfra = async (name) => {
|
|
75
75
|
if (!name) throw new Error('--name is required')
|
|
76
|
-
name = name
|
|
76
|
+
name = getName(name)
|
|
77
77
|
const dirRoot = `${__dirname}/scafold/infra/${name}`
|
|
78
78
|
|
|
79
79
|
console.log("dirRoot", dirRoot)
|
|
@@ -101,7 +101,7 @@ const createInfra = async (name) => {
|
|
|
101
101
|
|
|
102
102
|
const createLib = async (name) => {
|
|
103
103
|
if (!name) throw new Error('--name is required')
|
|
104
|
-
name = name
|
|
104
|
+
name = getName(name)
|
|
105
105
|
const dirRoot = `${__dirname}/scafold/libs/${name}`
|
|
106
106
|
|
|
107
107
|
try {
|
|
@@ -219,7 +219,7 @@ const createPostgresCrud = async (name) => {
|
|
|
219
219
|
|
|
220
220
|
const createMongoCrud = async (name) => {
|
|
221
221
|
if (!name) throw new Error('--name is required')
|
|
222
|
-
name = name
|
|
222
|
+
name = getName(name)
|
|
223
223
|
|
|
224
224
|
const dirRoot = `${__dirname}/scafold/mongo/${name}`
|
|
225
225
|
|
|
@@ -416,7 +416,8 @@ export async function cli(args) {
|
|
|
416
416
|
const pathDest = `${dest}/src/core/${name}`;
|
|
417
417
|
const pathCore = path.resolve(src, '../../core');
|
|
418
418
|
|
|
419
|
-
|
|
419
|
+
const namePathCore = pathCore + `/${name}`;
|
|
420
|
+
fse.copySync(namePathCore, pathDest, { overwrite: true });
|
|
420
421
|
|
|
421
422
|
fse.copySync(pathSchema, destPathSchema, { overwrite: true });
|
|
422
423
|
|
|
@@ -424,12 +425,13 @@ export async function cli(args) {
|
|
|
424
425
|
fs.rmSync(source, { recursive: true });
|
|
425
426
|
}
|
|
426
427
|
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
const namePathSchema = pathSchema + `/${name}.ts`;
|
|
429
|
+
if (fs.existsSync(namePathSchema)) {
|
|
430
|
+
fs.rmSync(namePathSchema, { recursive: true });
|
|
429
431
|
}
|
|
430
432
|
|
|
431
|
-
if (fs.existsSync(
|
|
432
|
-
fs.rmSync(
|
|
433
|
+
if (fs.existsSync(namePathCore)) {
|
|
434
|
+
fs.rmSync(namePathCore, { recursive: true });
|
|
433
435
|
}
|
|
434
436
|
|
|
435
437
|
}
|
|
@@ -2,7 +2,7 @@ const getModuleSwaggerModule = (name) => `import { Swagger } from '@/utils/docs/
|
|
|
2
2
|
|
|
3
3
|
export const SwaggerResponse = {
|
|
4
4
|
get: {
|
|
5
|
-
200: Swagger.defaultResponseJSON({
|
|
5
|
+
200: Swagger.defaultResponseJSON<string>({
|
|
6
6
|
status: 200,
|
|
7
7
|
json: 'text',
|
|
8
8
|
description: 'get ${name}.'
|