koatty_cli
Advanced tools
Comparing version 3.11.0 to 3.11.1
@@ -16,5 +16,6 @@ { | ||
// "controller", "-t", "grpc", "hello", | ||
"new", | ||
// "new", "hello", | ||
"service", | ||
"-i", | ||
"hello", | ||
// "service", "hello", | ||
// "middleware", "hello", | ||
@@ -21,0 +22,0 @@ // "model", "test" |
{ | ||
"problems.showCurrentInStatus": true, | ||
"js/ts.implicitProjectConfig.checkJs": true, | ||
"editor.inlineSuggest.showToolbar": "onHover" | ||
"editor.inlineSuggest.showToolbar": "onHover", | ||
"commentTranslate.source": "Google" | ||
} |
@@ -5,2 +5,15 @@ # Changelog | ||
### [3.11.1](https://github.com/koatty/koatty_cli/compare/v3.11.0...v3.11.1) (2024-01-07) | ||
### Features | ||
* interface ([bca375c](https://github.com/koatty/koatty_cli/commit/bca375c5e5b46db3df4dca5f54d7670a7682bfb9)) | ||
### Bug Fixes | ||
* version ([3b5a62c](https://github.com/koatty/koatty_cli/commit/3b5a62c806d7c6a942e5cc0865ca3a5300f5c16f)) | ||
* version ([46b6881](https://github.com/koatty/koatty_cli/commit/46b688121e0f636351af1992671849c7daaa866b)) | ||
## [3.11.0](https://github.com/koatty/koatty_cli/compare/v3.10.3...v3.11.0) (2024-01-03) | ||
@@ -7,0 +20,0 @@ |
{ | ||
"name": "koatty_cli", | ||
"version": "3.11.0", | ||
"version": "3.11.1", | ||
"description": "Koatty command line tool.", | ||
"scripts": { | ||
"eslint": "eslint --ext .js ./src", | ||
"prepublishOnly": "npm test", | ||
"release": "npm run prepublishOnly && standard-version", | ||
"prepublishOnly": "npm test && git push --follow-tags origin", | ||
"prerelease": "npm test", | ||
"release": "standard-version --release-as patch", | ||
"release:pre": "npm run release -- --prerelease", | ||
"release:major": "npm run release -- --release-as major", | ||
"release:minor": "npm run release -- --release-as minor", | ||
"pub": "git push --follow-tags origin && npm publish", | ||
"test": "npm run eslint && jest --rootDir ./test --passWithNoTests" | ||
@@ -12,0 +14,0 @@ }, |
@@ -17,3 +17,2 @@ # koatty_cli | ||
``` | ||
## Create a module in the koatty project | ||
@@ -23,4 +22,11 @@ | ||
```shell | ||
koatty controller test | ||
// http controller | ||
kt controller test | ||
// grpc controller | ||
kt controller -t grpc test | ||
// websocket controller | ||
kt controller -t websocket test | ||
``` | ||
@@ -31,4 +37,7 @@ | ||
```shell | ||
koatty service test | ||
kt service test | ||
// service with interface | ||
kt service -i test | ||
``` | ||
@@ -39,3 +48,3 @@ | ||
```shell | ||
koatty middleware test | ||
kt middleware test | ||
@@ -48,9 +57,5 @@ ``` | ||
//default use thinkorm | ||
koatty model test | ||
//default use typeorm | ||
kt model test | ||
//use typeorm | ||
koatty model -o typeorm test | ||
``` | ||
@@ -64,3 +69,3 @@ | ||
koatty aspect test | ||
kt aspect test | ||
@@ -73,3 +78,3 @@ ``` | ||
@BeforeEach("TestAspect") //类的每一个方法执行之前执行 | ||
export class TestController extends BaseController { | ||
export class TestController { | ||
app: App; | ||
@@ -83,3 +88,2 @@ | ||
} | ||
} | ||
@@ -95,3 +99,3 @@ | ||
koatty dto test | ||
kt dto test | ||
@@ -116,3 +120,3 @@ ``` | ||
@Controller() | ||
export class TestController extends BaseController { | ||
export class TestController { | ||
app: App; | ||
@@ -126,3 +130,2 @@ | ||
} | ||
} | ||
@@ -137,3 +140,3 @@ | ||
```shell | ||
koatty new projectName -t middleware | ||
kt new projectName -t middleware | ||
@@ -150,3 +153,3 @@ cd ./projectName | ||
```shell | ||
koatty new projectName -t plugin | ||
kt new projectName -t plugin | ||
@@ -153,0 +156,0 @@ cd ./projectName |
@@ -6,3 +6,3 @@ /* | ||
* @Date: 2020-12-22 17:51:07 | ||
* @LastEditTime: 2024-01-04 06:56:42 | ||
* @LastEditTime: 2024-01-07 14:28:09 | ||
*/ | ||
@@ -186,7 +186,3 @@ const path = require('path'); | ||
}; | ||
if (type == "service") { | ||
replaceMap['_SUB_PATH'] = subModule ? '../../..' : '../..'; | ||
} | ||
//if target file is exist, ignore it | ||
@@ -497,17 +493,23 @@ if (ufs.isExist(destFile) && type != "controller") { | ||
const sourcePath = path.resolve(templatePath, `service.template`); | ||
let sourcePath = path.resolve(templatePath, `service.template`); | ||
const serviceName = `${args.newName}.ts`; | ||
const serviceDest = path.resolve(`${args.destPath}`, serviceName); | ||
let serviceDest = path.resolve(`${args.destPath}`, serviceName); | ||
if (opt.interface == true) { | ||
args.replaceMap['_SUB_PATH'] = args.subModule ? '../../..' : '../..'; | ||
serviceDest = path.resolve(`${args.destPath}/impl`, serviceName); | ||
sourcePath = path.resolve(templatePath, `service.impl.template`); | ||
args.destMap[args.sourcePath] = ""; | ||
const tplPath = path.resolve(templatePath, `service.interface.template`); | ||
const newName = `I${args.newName}.ts`; | ||
const destPath = path.resolve(args.destPath, newName); | ||
if (!ufs.isExist(destPath)) { | ||
args.destMap[tplPath] = destPath; | ||
} | ||
} | ||
if (!ufs.isExist(serviceDest)) { | ||
args.destMap[sourcePath] = serviceDest; | ||
} | ||
// args.destMap[args.sourcePath] = ""; | ||
// const tplPath = path.resolve(templatePath, `service.interface.template`); | ||
// const newName = `I${args.newName}.ts`; | ||
// const destPath = path.resolve(args.destPath, newName); | ||
// if (!ufs.isExist(destPath)) { | ||
// args.destMap[tplPath] = destPath; | ||
// } | ||
return args; | ||
@@ -514,0 +516,0 @@ } |
@@ -62,4 +62,8 @@ #!/usr/bin/env node | ||
.description('create service class') | ||
.action((serviceName) => { | ||
create_module(serviceName, 'service', undefined); | ||
.option( | ||
'-i, --interface', | ||
'create service\'s and service interface, default false.' | ||
) | ||
.action((serviceName, cmdObj) => { | ||
create_module(serviceName, 'service', cleanArgs(cmdObj)); | ||
}); | ||
@@ -66,0 +70,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* @Date: 2024-01-04 05:26:15 | ||
* @LastEditTime: 2024-01-04 05:46:27 | ||
* @LastEditTime: 2024-01-07 12:24:25 | ||
* @License: BSD (3-Clause) | ||
@@ -9,0 +9,0 @@ * @Copyright (c): <richenlin(at)gmail.com> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50716
1084
148