clair-scripts
Advanced tools
Comparing version 3.1.0-alpha to 3.1.0
61
index.js
@@ -1,3 +0,58 @@ | ||
exports.rollup = require('./src/rollup') | ||
exports.md2vue = require('./src/md2vue') | ||
exports.createBoilerplate = require('./src/boilerplate') | ||
#!/usr/bin/env node | ||
const path = require('path') | ||
const { existsSync } = require('fs-extra') | ||
const logger = require('./src/utils/logger') | ||
const rollup = require('./src/rollup') | ||
const createBoilerplate = require('./src/boilerplate') | ||
// check config file | ||
const conf = path.join(process.cwd(), 'clair.config.js') | ||
if (!existsSync(conf)) { | ||
logger.error( | ||
'No such file called `clair.config.js` in' + | ||
'current working directory' | ||
) | ||
process.exit() | ||
} | ||
// try to require config file | ||
let config = null | ||
try { | ||
config = require(conf) | ||
} catch (e) { | ||
logger.error(e) | ||
process.exit() | ||
} | ||
const argv = process.argv.slice(2) | ||
switch (argv[0]) { | ||
case 'watch-build': | ||
process.env.NODE_ENV = 'development' | ||
rollup.watchBuild(config.rollup) | ||
break | ||
case 'build': | ||
process.env.NODE_ENV = 'production' | ||
Promise.resolve() | ||
.then(() => rollup.build(config.rollup)) | ||
.catch(e => { | ||
logger.log(e) | ||
process.exit() | ||
}) | ||
break | ||
case 'add': | ||
if (argv[1]) { | ||
const obj = Object.assign({ | ||
name: argv[1], | ||
prefix: 'c', | ||
dir: 'src/components' | ||
}, config.boilerplate) | ||
createBoilerplate(obj) | ||
} | ||
break | ||
default: | ||
} |
{ | ||
"name": "clair-scripts", | ||
"version": "3.1.0-alpha", | ||
"version": "3.1.0", | ||
"description": "building scripts for clair project", | ||
@@ -12,2 +12,5 @@ "main": "index.js", | ||
"license": "MIT", | ||
"bin": { | ||
"clair": "./index.js" | ||
}, | ||
"devDependencies": { | ||
@@ -20,6 +23,4 @@ "standard": "^10.0.3" | ||
"glob": "^7.1.2", | ||
"md2vue": "^3.0.0-alpha", | ||
"rollup": "^0.50.0", | ||
"yaml-front-matter": "^3.4.0" | ||
"rollup": "^0.50.0" | ||
} | ||
} |
# clair-scripts | ||
Util for clair project development. | ||
building scripts for clair project | ||
- [md2vue](https://github.com/AngusFu/md2vue) | ||
- [dokiv](https://github.com/AngusFu/dokiv) | ||
- https://github.com/AngusFu/md2vue | ||
- https://github.com/AngusFu/vueify |
@@ -24,3 +24,3 @@ const path = require('path') | ||
logger.warn( | ||
`[Warning] Skipping component ${component}` + | ||
`Skipping component ${component}` + | ||
`, it already exisits at ${dest}.` | ||
@@ -54,4 +54,4 @@ ) | ||
.then(() => { | ||
logger.log(`[ done ] component ${component} is created at ${dest}.`) | ||
logger.info(`Component ${component} is created at ${dest}.`) | ||
}) | ||
} |
const rollup = require('rollup') | ||
const chokidar = require('chokidar') | ||
const fs = require('fs-extra') | ||
const { ensureFileSync } = require('fs-extra') | ||
const logger = require('./utils/logger') | ||
exports.build = function ({ name, input, output, plugins }) { | ||
logger.log(`[Rollup] release-build starts.`) | ||
logger.log('Rollup', `release-build starts`) | ||
@@ -17,3 +17,3 @@ // returns a Promise | ||
output.map(({ file, format }) => { | ||
fs.ensureFileSync(file) | ||
ensureFileSync(file) | ||
return bundle.write({ name, file, format }) | ||
@@ -24,3 +24,3 @@ }) | ||
.then(ret => { | ||
logger.log(`[Rollup] release-build done.`) | ||
logger.log('Rollup', 'release-build done') | ||
return ret | ||
@@ -34,3 +34,3 @@ }) | ||
exports.watchBuild = function ({ name, input, output, plugins }) { | ||
logger.log(`[Rollup] watch-build starts.`) | ||
logger.log('Rollup', 'watch-build starts') | ||
@@ -52,3 +52,3 @@ // https://rollupjs.org/#rollup-watch | ||
if (code === 'END') { | ||
logger.log(`[Rollup]: build done.`) | ||
logger.log('Rollup', 'build done') | ||
@@ -58,5 +58,5 @@ watcher.removeListener('event', listener) | ||
if (err) { | ||
logger.log(`[Rollup]: Error ${err}`) | ||
logger.error(err) | ||
} else { | ||
logger.log(`[Rollup]: ${code}`) | ||
logger.log('Rollup', code) | ||
} | ||
@@ -63,0 +63,0 @@ }) |
@@ -0,1 +1,2 @@ | ||
const chalk = require('chalk') | ||
const reTime = /\d{2}:\d{2}:\d{2}/ | ||
@@ -5,23 +6,34 @@ const time = () => new Date().toString().match(reTime)[0] | ||
module.exports = { | ||
log (msg) { | ||
info (...msg) { | ||
console.log( | ||
`[%s] %s`, | ||
time(), | ||
msg | ||
`[%s] [%s] %s`, | ||
chalk.yellow(time()), | ||
chalk.green('info'), | ||
...msg | ||
) | ||
}, | ||
warn (msg) { | ||
console.warn( | ||
`[%s] %s`, | ||
time(), | ||
msg | ||
error (msg) { | ||
console.log( | ||
`[%s] [%s] %s`, | ||
chalk.yellow(time()), | ||
chalk.red('error'), | ||
chalk.red(msg.toString()) | ||
) | ||
}, | ||
error (msg) { | ||
console.error( | ||
`[%s] %s`, | ||
time(), | ||
msg | ||
log (tag, ...msg) { | ||
console.log( | ||
`[%s] [%s] %s`, | ||
chalk.yellow(time()), | ||
chalk.green(tag.toLowerCase()), | ||
...msg | ||
) | ||
}, | ||
warn (msg) { | ||
console.log( | ||
`[%s] [%s] %s`, | ||
chalk.yellow(time()), | ||
chalk.yellow('warn'), | ||
chalk.yellow(msg) | ||
) | ||
} | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4
1
0
8045
11
218
6
- Removedmd2vue@^3.0.0-alpha
- Removedyaml-front-matter@^3.4.0
- Removedacorn@3.3.0(transitive)
- Removedacorn-jsx@3.0.1(transitive)
- Removedacorn-object-spread@1.0.0(transitive)
- Removedalphanum-sort@1.0.2(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedautoprefixer@6.7.7(transitive)
- Removedbalanced-match@0.4.2(transitive)
- Removedbrowserslist@1.7.7(transitive)
- Removedbuble@0.15.2(transitive)
- Removedcaniuse-api@1.6.1(transitive)
- Removedcaniuse-db@1.0.30001695(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclap@1.2.3(transitive)
- Removedclone@1.0.4(transitive)
- Removedcoa@1.0.4(transitive)
- Removedcolor@0.11.4(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolor-string@0.3.0(transitive)
- Removedcolormin@1.1.2(transitive)
- Removedcolors@1.1.2(transitive)
- Removedcommander@1.0.0(transitive)
- Removedconvert-source-map@1.9.0(transitive)
- Removedcss-color-names@0.0.4(transitive)
- Removedcssnano@3.10.0(transitive)
- Removedcsso@2.3.2(transitive)
- Removedde-indent@1.0.2(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddefined@1.0.1(transitive)
- Removedelectron-to-chromium@1.5.88(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesprima@2.7.3(transitive)
- Removedflatten@1.0.3(transitive)
- Removedhas@1.0.4(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedhash-sum@1.0.2(transitive)
- Removedhe@1.2.0(transitive)
- Removedhighlight.js@9.18.5(transitive)
- Removedhtml-comment-regex@1.1.2(transitive)
- Removedindent@0.0.2(transitive)
- Removedindexes-of@1.0.1(transitive)
- Removedis-absolute-url@2.1.0(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedis-svg@2.1.0(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedjs-yaml@3.7.0(transitive)
- Removedjson5@0.5.1(transitive)
- Removedlodash.memoize@4.1.2(transitive)
- Removedlodash.uniq@4.5.0(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedmagic-string@0.14.0(transitive)
- Removedmarked@0.3.19(transitive)
- Removedmath-expression-evaluator@1.4.0(transitive)
- Removedmd2vue@3.1.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednormalize-range@0.1.2(transitive)
- Removednormalize-url@1.9.1(transitive)
- Removednum2fraction@1.2.2(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedpostcss@5.2.18(transitive)
- Removedpostcss-calc@5.3.1(transitive)
- Removedpostcss-colormin@2.2.2(transitive)
- Removedpostcss-convert-values@2.6.1(transitive)
- Removedpostcss-discard-comments@2.0.4(transitive)
- Removedpostcss-discard-duplicates@2.1.0(transitive)
- Removedpostcss-discard-empty@2.1.0(transitive)
- Removedpostcss-discard-overridden@0.1.1(transitive)
- Removedpostcss-discard-unused@2.2.3(transitive)
- Removedpostcss-filter-plugins@2.0.3(transitive)
- Removedpostcss-merge-idents@2.1.7(transitive)
- Removedpostcss-merge-longhand@2.0.2(transitive)
- Removedpostcss-merge-rules@2.1.2(transitive)
- Removedpostcss-message-helpers@2.0.0(transitive)
- Removedpostcss-minify-font-values@1.0.5(transitive)
- Removedpostcss-minify-gradients@1.0.5(transitive)
- Removedpostcss-minify-params@1.2.2(transitive)
- Removedpostcss-minify-selectors@2.1.1(transitive)
- Removedpostcss-normalize-charset@1.1.1(transitive)
- Removedpostcss-normalize-url@3.0.8(transitive)
- Removedpostcss-ordered-values@2.2.3(transitive)
- Removedpostcss-reduce-idents@2.4.0(transitive)
- Removedpostcss-reduce-initial@1.0.1(transitive)
- Removedpostcss-reduce-transforms@1.0.4(transitive)
- Removedpostcss-selector-parser@2.2.3(transitive)
- Removedpostcss-svgo@2.1.6(transitive)
- Removedpostcss-unique-selectors@2.0.2(transitive)
- Removedpostcss-value-parser@3.3.1(transitive)
- Removedpostcss-zindex@2.2.0(transitive)
- Removedprepend-http@1.0.4(transitive)
- Removedprismjs@1.29.0(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedq@1.5.1(transitive)
- Removedquery-string@4.3.4(transitive)
- Removedreduce-css-calc@1.3.0(transitive)
- Removedreduce-function-call@1.0.3(transitive)
- Removedsax@1.2.4(transitive)
- Removedsort-keys@1.1.2(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.03.2.3(transitive)
- Removedsvgo@0.7.2(transitive)
- Removedthrough@2.3.8(transitive)
- Removeduniq@1.0.1(transitive)
- Removeduniqs@2.0.0(transitive)
- Removedvendors@1.0.4(transitive)
- Removedvlq@0.2.3(transitive)
- Removedvue-hot-reload-api@2.3.4(transitive)
- Removedvue-template-compiler@2.7.16(transitive)
- Removedvue-template-es2015-compiler@1.9.1(transitive)
- Removedvueify@9.4.1(transitive)
- Removedwhet.extend@0.9.9(transitive)
- Removedyallist@2.1.2(transitive)
- Removedyaml-front-matter@3.4.1(transitive)