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

riot-cli

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riot-cli - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

11

CHANGELOG.md
# riot-cli
### v5.1.0
- Add: the `esm` option https://github.com/riot/cli/pull/32
### v5.0.0

@@ -7,2 +10,8 @@ - Update the `riot-compiler` using the latest version

### v4.1.0
- Add: the `esm` option https://github.com/riot/cli/pull/32
### v4.0.2
- avoid to set the `global.isSilent` flag to true if the cli will be imported via node
### v4.0.1

@@ -14,2 +23,2 @@ - Fix #30

- Change all the API methods will return always a Promise
- Remove `shelljs` from the dependencies for the I/O operations
- Remove `shelljs` from the dependencies for the I/O operations

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

MODULAR_END_FRAG: '});',
ES_MODULE_RIOT_IMPORT: `import riot from 'riot';
`,
TAG_CREATED_CORRECTLY: function(path) {

@@ -23,0 +25,0 @@ return `${path} created correctly!`

6

lib/helpers.js

@@ -159,7 +159,7 @@ 'use strict'

* var obj = { foo: 'baz' }
* extend(obj, {bar: 'bar', foo: 'bar'})
* mergeDeep(obj, {bar: 'bar', foo: 'bar'})
* console.log(obj) => {bar: 'bar', foo: 'bar'}
*
*/
extend(src) {
mergeDeep(src) {
var obj, args = arguments

@@ -170,3 +170,3 @@ for (var i = 1; i < args.length; ++i) {

if (typeof obj[key] === 'object' && typeof src[key] === 'object')
src[key] = this.extend(src[key], obj[key])
src[key] = this.mergeDeep(src[key], obj[key])
else if (typeof obj[key] !== 'undefined')

@@ -173,0 +173,0 @@ src[key] = obj[key]

@@ -44,29 +44,51 @@ #!/usr/bin/env node

make(opt) { return new Make(opt) },
watch(opt) { return new Watch(opt) }
}
watch(opt) { return new Watch(opt) },
cli: co.wrap(function*(ar) {
// Get CLI arguments
let args, config
/* istanbul ignore next */
const cli = co.wrap(function*(ar) {
// Get CLI arguments
let args, config
// was an error thrown parsing the options?
try {
args = optionator.parse(
ar ? ['node', path.resolve('lib')].concat(ar) : process.argv,
options
)
config = args.config ? yield helpers.loadConfigFile(args.config) : {}
} catch (e) {
helpers.err(e)
return e
}
// was an error thrown parsing the options?
try {
args = optionator.parse(
ar ? ['node', path.resolve('lib')].concat(ar) : process.argv,
options
)
config = args.config ? yield helpers.loadConfigFile(args.config) : {}
} catch (e) {
helpers.err(e)
return e
// avoid unhandled rejections
process.on('unhandledRejection', r => {throw r})
// Translate args into options hash
// extending args with the options loaded via config file
const opt = generateOptions(Object.assign({}, args, config))
// Call matching method
const method =
Object.keys(API).filter(v => args[v])[0] ||
(opt.from || opt.stdin ? 'make' : 'help')
// check whether the output should be colorized
chalk.constructor({ enabled: !!opt.colors })
// create isSilent as global variable
global.isSilent = args.silent
// flag used to detect wheter a task is triggered via command line or not
opt.isCli = true
return API[method](opt)
})
}
// avoid unhandled rejections
process.on('unhandledRejection', r => {throw r})
// Translate args into options hash
// extending args with the options loaded via config file
helpers.extend(args, config)
const opt = {
/**
* Generate the CLI options object from the user arguments received
* @param {Object} args - cli arguments
* @returns {Object} CLI options object
*/
function generateOptions(args) {
return {
compiler: {

@@ -97,29 +119,8 @@ compact: args.compact,

}
}
// Call matching method
const method =
Object.keys(API).filter(v => args[v])[0] ||
(opt.from || opt.stdin ? 'make' : 'help')
// check whether the output should be colorized
chalk.constructor({ enabled: !!opt.colors })
// create isSilent as global variable
global.isSilent = args.silent
// flag used to detect wheter a task is triggered via command line or not
opt.isCli = true
return API[method](opt)
})
// this could be handy to someone who wants to have
// also access to the private cli parser function
API._cli = cli
// Run from CLI or as Node module
if (module.parent) {
module.exports = API
global.isSilent = true
/* istanbul ignore next */
} else cli()
} else API.cli()

@@ -73,2 +73,7 @@ 'use strict'

{
option: 'esm',
type: 'Boolean',
description: 'es6 module'
},
{
option: 'silent',

@@ -75,0 +80,0 @@ alias: 's',

@@ -28,3 +28,3 @@ 'use strict'

// make sure the parsers object is always valid
opt.parsers = helpers.extend(
opt.parsers = helpers.mergeDeep(
compiler.parsers,

@@ -31,0 +31,0 @@ opt.parsers || {}

@@ -12,3 +12,4 @@ 'use strict'

START_FRAG = constants.MODULAR_START_FRAG,
END_FRAG = constants.MODULAR_END_FRAG
END_FRAG = constants.MODULAR_END_FRAG,
ES_MODULE_RIOT_IMPORT = constants.ES_MODULE_RIOT_IMPORT

@@ -41,3 +42,3 @@ /**

if (opt.parsers)
helpers.extend(compiler.parsers, opt.parsers)
helpers.mergeDeep(compiler.parsers, opt.parsers)

@@ -155,5 +156,7 @@ /**

function encapsulate (from, opt) {
return !opt.compiler.modular ? from : `${START_FRAG}${from}${END_FRAG}`
if (opt.compiler.modular) return `${START_FRAG}${from}${END_FRAG}`
if (opt.compiler.esm) return `${ES_MODULE_RIOT_IMPORT}${from}`
return from
}
module.exports = Make
{
"name": "riot-cli",
"version": "5.0.0",
"version": "5.1.0",
"description": "Riot command line utility",

@@ -33,3 +33,3 @@ "main": "lib/index.js",

"co-mocha": "^1.2.2",
"coveralls": "^3.0.0",
"coveralls": "^3.0.1",
"eslint": "^4.19.1",

@@ -39,3 +39,3 @@ "eslint-config-riot": "^1.0.0",

"istanbul": "^0.4.5",
"mocha": "^5.0.5",
"mocha": "^5.2.0",
"shelljs": "^0.8.2"

@@ -50,3 +50,3 @@ },

"dependencies": {
"chalk": "^2.3.2",
"chalk": "^2.4.1",
"chokidar": "^2.0.3",

@@ -56,4 +56,4 @@ "co": "^4.6.0",

"riot-compiler": "^3.5.1",
"rollup": "^0.57.1"
"rollup": "^0.59.4"
}
}
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