Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dn-middleware-pkginfo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dn-middleware-pkginfo - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

53

lib/index.js

@@ -9,3 +9,3 @@ const fs = require('fs');

*/
module.exports = function () {
module.exports = function (opts) {

@@ -17,5 +17,27 @@ //外层函数的用于接收「参数对象」

if (!this.inquirer) {
throw new Error('请升级 dbl-next 到最新版本');
throw new Error('请升级 dawn 到最新版本');
}
opts.items = opts.items || [{
name: 'name',
type: 'input',
default: path.basename(this.cwd),
message: '请输入项目名称',
validate: function (name) {
return !!name;
}
}, {
name: 'version',
type: 'input',
message: '请输入初始版本',
default: '1.0.0',
validate: function (version) {
return !!version;
}
}, {
name: 'description',
type: 'input',
message: '请输入项目描述'
}];
let pkgFile = `${this.cwd}/package.json`;

@@ -25,26 +47,5 @@ if (fs.existsSync(pkgFile)) {

let pkg = require(pkgFile);
let result = await this.inquirer.prompt([{
name: 'name',
type: 'input',
default: path.basename(this.cwd),
message: '请输入项目名称',
validate: function (name) {
return !!name;
}
}, {
name: 'version',
type: 'input',
message: '请输入初始版本',
default: '1.0.0',
validate: function (version) {
return !!version;
}
}, {
name: 'description',
type: 'input',
message: '请输入项目描述'
}]);
pkg.name = result.name;
pkg.version = result.version;
pkg.description = result.description;
let result = await this.inquirer.prompt(opts.items);
Object.assign(pkg, result);
this.project = pkg;
await this.utils.writeFile(pkgFile, JSON.stringify(pkg, null, ' '));

@@ -51,0 +52,0 @@ this.console.info('完成');

{
"name": "dn-middleware-pkginfo",
"version": "1.0.3",
"description": "",
"version": "1.1.0",
"description": "用于根据用户输入配置 package 中的信息",
"main": "./lib/index.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -1,1 +0,1 @@

# 中件间工程模板
# 中间件工程模板
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