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

clair-scripts

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clair-scripts - npm Package Compare versions

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:
}

9

package.json
{
"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)
)
}
}
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