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

@quase/cli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quase/cli - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

19

dist/index.js

@@ -62,2 +62,14 @@ "use strict";

function _default(callback, opts, notifierOpts) {
const defaultConfigFile = opts.defaultConfigFile;
if (defaultConfigFile) {
opts = Object.assign({}, opts);
opts.flags = Object.assign({}, opts.flags);
opts.flags.config = {
type: "string",
alias: "c",
default: defaultConfigFile
};
}
const cli = meow(opts);

@@ -69,3 +81,10 @@

if (defaultConfigFile) {
try {
cli.config = require(require("path").resolve(cli.flags.config));
} catch (e) {// Ignore
}
}
callback(cli);
}

6

package.json
{
"name": "@quase/cli",
"version": "0.1.0",
"description": "Cli",
"version": "0.2.0",
"description": "A simple cli helper.",
"license": "MIT",

@@ -14,5 +14,5 @@ "homepage": "https://github.com/quase/quasejs",

"is-installed-globally": "^0.1.0",
"meow": "https://github.com/sindresorhus/meow.git#master",
"meow": "https://github.com/sindresorhus/meow.git#4f7ded3d6b8349fc8514b672a7d5deca2d5f2e98",
"update-notifier": "^2.3.0"
}
}
## About
It's like `meow` but includes `update-notifier`.
A simple cli helper.
We also change the update message if Yarn is detected.
Includes `meow` and `update-notifier` with some extensions:
- We change the update message if Yarn is detected.
- Passing a `defaultConfigFile` value automates the requiring of a config file. The user will be able to override the default using `--config=another-file.js`.
## Usage example
`bin/my-name`
`bin/index.js`
```js
#!/usr/bin/env node
"use strict";
require( "@quase/cli" )(
( { input, flags, pkg, help, showHelp } ) => {
require( "@quase/cli" ).default(
( { input, flags, pkg, help, config /* the config object, if "defaultConfigFile" was used */ } ) => {
},
{}, // Meow options
{
defaultConfigFile: "config.js"
}, // Meow options + optional defaultConfigFile
{
options: {}, // UpdateNotifier options

@@ -31,7 +35,5 @@ notify: {} // .notify() options

{
...
"bin": {
"my-name": "bin/my-name"
"my-name": "bin/index.js"
},
...
}

@@ -43,1 +45,16 @@ ```

See https://github.com/yeoman/update-notifier for details.
## Copy-paste example
`bin/index.js`
```js
#!/usr/bin/env node
/* eslint-disable no-shebang */
require( "@quase/cli" ).default( ( { flags, pkg, config } ) => {
require( "../dist" ).default( Object.assign( {}, config || pkg[ "my-name" ], flags ) );
}, {
defaultConfigFile: "my-name-config.js"
} );
```

@@ -56,2 +56,15 @@ const chalk = require( "chalk" );

export default function( callback, opts, notifierOpts ) {
const defaultConfigFile = opts.defaultConfigFile;
if ( defaultConfigFile ) {
opts = Object.assign( {}, opts );
opts.flags = Object.assign( {}, opts.flags );
opts.flags.config = {
type: "string",
alias: "c",
default: defaultConfigFile
};
}
const cli = meow( opts );

@@ -63,3 +76,11 @@

if ( defaultConfigFile ) {
try {
cli.config = require( require( "path" ).resolve( cli.flags.config ) );
} catch ( e ) {
// Ignore
}
}
callback( cli );
}
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