Socket
Socket
Sign inDemoInstall

maruko-cli

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maruko-cli - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

53

bin/bootstrapGen.js

@@ -103,2 +103,21 @@ const fs = require('fs')

async checkExist(path,pathAlias = `${this.fileNameCap}.${this.result.command}`){
if(fs.existsSync(path)){
const input = await inquirer.prompt({
name:'cover',
type:'confirm',
message:`${pathAlias} 已存在,是否覆盖原始文件`,
default: false,
})
return {
cover:input.cover
}
}
return {
cover:true
}
}
async componentGen(destPath){

@@ -109,2 +128,6 @@ // 生成组件

const destDir = destPath + '/' + destDirName;
const { cover } = await this.checkExist(destDir);
if(!cover) return;
shell.cd(destPath);

@@ -125,5 +148,9 @@ shell.mkdir(destDirName);

async dtoGen(destPath){
async dtoGen(destPath,optional = false){
// 生成 DTO
const sourceDir = this.templatePath + '/@dto/*';
const { cover } = await this.checkExist(destPath + `/${this.fileName}.${this.result.command}.ts`);
if(!cover) return;
shell.cd(destPath);

@@ -140,3 +167,9 @@ shell.cp('-R',sourceDir,destPath);

await this.genOptionalFile();
if(optional){
this.fileQueue.push(
this.fileNameCap + '.dto'
)
}else{
await this.genOptionalFile();
}
}

@@ -149,3 +182,3 @@

optionalCommand = '';
const { alias,command } = this.result;
const { alias } = this.result;
if(alias === 'd'){

@@ -155,2 +188,6 @@ optionalMsg = '是否同步生成对应的 Service 文件'

optionalCommand = 'service';
}else if(alias === 's'){
optionalMsg = '是否同步生成对应的 Dto 文件'
optionalPath = config.pathSuffix.dto.validPaths[0];
optionalCommand = 'dto';
}

@@ -173,2 +210,6 @@

const sourceDir = this.templatePath + '/@enum/*';
const { cover } = await this.checkExist(destPath + `/${this.fileName}.${this.result.command}.ts`);
if(!cover) return;
shell.cd(destPath);

@@ -190,2 +231,6 @@ shell.cp('-R',sourceDir,destPath);

const sourceDir = this.templatePath + '/@service/*';
const { cover } = await this.checkExist(destPath + `/${this.fileName}.${this.result.command}.ts`);
if(!cover) return;
shell.cd(destPath);

@@ -208,2 +253,4 @@ shell.cp('-R',sourceDir,destPath);

)
}else{
await this.genOptionalFile();
}

@@ -210,0 +257,0 @@ }

2

package.json
{
"name": "maruko-cli",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc