You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@yhtml5/check-list

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yhtml5/check-list - npm Package Compare versions

Comparing version

to
1.2.2

LICENSE

4

bin/check.js

@@ -17,2 +17,4 @@ #!/usr/bin/env node

questions,
questionTitle,
questionInterval,
} = {}) {

@@ -26,3 +28,3 @@ const failedRules = rules.filter((rule, index) => !checkRule({ ...rule, index }))

const shouldAsk = (process.env.DEBUG !== 'true') && questions && questions.length
const ok = shouldAsk ? await ask(questions) : true
const ok = shouldAsk ? await ask({ questions, questionInterval, questionTitle }) : true

@@ -29,0 +31,0 @@ if (ok) {

@@ -16,2 +16,4 @@ 'use strict'

questions = [],
questionTitle,
questionInterval,
rules = [],

@@ -29,3 +31,3 @@ } = config.checkList || {}

console.log('> rules:\n', rules)
console.log('> questions:\n', questions)
console.log('> question:\n', questions, questionInterval)
console.log('')

@@ -37,3 +39,5 @@ }

questions,
questionTitle,
questionInterval,
rules,
}

@@ -60,2 +60,4 @@ 'use strict'

}],
questionTitle:'请仔细阅读',
questionInterval: 10000,
questions: [

@@ -62,0 +64,0 @@ '是否已同步git提交?',

const inquirer = require('inquirer')
function ask(questions) {
return inquirer
.prompt([
{ name: 'remind', type: 'confirm', message: 'Do you need to be reminded' },
])
.then(function (answers) {
if (answers.remind) {
const _questions = questions.map((question, index) => ({
name: String(index),
type: 'confirm',
message: question
}))
return inquirer
.prompt(_questions)
.then(function (answers) {
const ok = !Object.values(answers).includes(false)
return ok
})
}
return true
})
const askQuestion = ({ questions }) =>
inquirer.prompt([
{ name: 'remind', type: 'confirm', message: 'Do you need to be reminded' },
]).then(function (answers) {
if (answers.remind) {
const _questions = questions.map((question, index) => ({
name: String(index),
type: 'confirm',
message: question
}))
return inquirer
.prompt(_questions)
.then(function (answers) {
const ok = !Object.values(answers).includes(false)
return ok
})
}
return true
})
const timer = async time => new Promise(function (resolve, reject) {
setTimeout(resolve, time)
})
const printQuestion = async ({
questions,
questionInterval,
questionTitle,
}) => {
let count = 0
let countDownSecond = (questionInterval / 1000) - 2
const getCountDownText = second => questionTitle
? ` ${questionTitle} ${second} 秒`
: ` Please read carefully: ${second} second`
const countDown = setInterval(() => {
process.stdout.clearLine()
process.stdout.cursorTo(0)
process.stdout.write(getCountDownText(countDownSecond))
countDownSecond--
}, 1000)
console.log()
console.log('Check list questions: ')
for (const question of questions) {
console.log(` ${count}. ${question}`)
count++
}
console.log()
await timer(questionInterval)
clearInterval(countDown)
console.log()
return true
}
const ask = options =>
options.questionInterval
? printQuestion(options)
: askQuestion(options)
module.exports = ask
{
"name": "@yhtml5/check-list",
"version": "1.1.1",
"version": "1.2.2",
"main": "index.js",

@@ -14,3 +14,3 @@ "author": "yhtml5",

"debug": "DEBUG=true node ./bin/check ./demo/config.js",
"prepublishOnly": "echo will publish && npm version patch && git add package.json && git commit -m 'auto publish'"
"prepublishOnly": "echo will publish && npm version patch"
},

@@ -17,0 +17,0 @@ "dependencies": {

# Check List
## 概念
check list 是一个自动化代码检测工具, 弥补了 eslint/单元测试 等工具之外的不足. 帮助你提升项目的稳定性
check list 是一个自动化检测工具, 补充了 eslint/单元测试 等工具之外的功能.
确保代码的质量, 它可以集成到自动化部署脚本中, 也可以配合husky, 实现代码提交前检测
它可以集成到自动化部署脚本中, 也可以配合husky, 实现代码代码提交前检测
在一个多人协作过程的项目中, 我们会遇到许多问题

@@ -20,5 +19,5 @@ - 删除关键性文件, 造成严重问题

npm run check
npm run check
=> check()
=> rule: handler[type]
=> rule: handler[type]
=> handler: title/regex/require/limit

@@ -57,3 +56,3 @@ => lib: checkCode/getDirSize/checkRequiredFiles

```js
{
{
type: 'title',

@@ -60,0 +59,0 @@ describe: 'Check List Rules:',