New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jelement-cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jelement-cli - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

66

lib/create.js

@@ -23,27 +23,19 @@ #!/usr/bin/env node

function init() {
inputComponentName()
.then(nameAnswer => {
if (nameAnswer.component) {
compontName = uppercamelcase(nameAnswer.component)
inputComponentPath()
.then(pathAnswer => {
const targetPath = path.join(cwd, pathAnswer.path || './')
to = path.resolve(targetPath, `${compontName}.vue`)
if (fs.existsSync(to)) {
componentExistHandler(compontName)
.then(existAnswer => {
if (existAnswer.ok) {
handleTemplate()
}
})
} else {
handleTemplate()
}
})
} else {
console.log(chalk.bgRed('[组件名]必填 - Please enter the component file name'))
process.exit(1);
}
})
async function init() {
const { component } = await inputComponentName()
if (component) {
compontName = uppercamelcase(component)
const pathAnswer = await inputComponentPath()
const targetPath = path.join(cwd, pathAnswer.path || './')
to = path.resolve(targetPath, `${compontName}.vue`)
if (fs.existsSync(to)) {
const { ok } = await componentExistHandler(compontName)
if (ok) handleTemplate()
} else {
handleTemplate()
}
} else {
console.log(chalk.bgRed('[组件名]必填 - Please enter the component file name'))
process.exit(1);
}
}

@@ -106,20 +98,16 @@

function selectTemplate() {
return selectBaseType()
.then(answer => {
return accordingToSpecificTemplate(answer.selected)
})
async function selectTemplate() {
const { selected } = await selectBaseType()
return accordingToSpecificTemplate(selected)
}
function handleTemplate() {
selectTemplate()
.then(answer => {
const templatePath = path.resolve(__dirname, '../template', answer.path)
const content = fs.readFileSync(templatePath, 'utf8')
write(to, content)
console.log(chalk.green('模板已生成...'))
console.log(chalk.green(`生成路径: ${to}`))
})
async function handleTemplate() {
const answer = await selectTemplate()
const templatePath = path.resolve(__dirname, '../template', answer.path)
const content = fs.readFileSync(templatePath, 'utf8')
write(to, content)
console.log(chalk.green('模板已生成...'))
console.log(chalk.green(`生成路径: ${to}`))
}
module.exports = init
{
"name": "jelement-cli",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "preferGlobal": true,

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