New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

clicom

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clicom

### When i can use it? If you need a simple cli application, that execute your small js files as **one** long **command** with params.

latest
Source
npmnpm
Version
1.0.402
Version published
Maintainers
1
Created
Source

Clicom

When i can use it?

If you need a simple cli application, that execute your small js files as one long command with params.

Example

If before building application you want:

  • Fetch some data from Internet and write part of it into configuration
  • Flush your console

Example project structure:

-appRootPath
    - YOUR PROJECT
    - package.json
    - __clicom__ // Scripts folder
        - fetchdata.js // Your example script
    - cc.js // Entrypoint
fetchdata.js
// Import some dependencies
const {join} = require('path')
const {writeFile} = require('fs/promises')
const {appRootPath} = require('./cfg')

// Main code
const mainThread = async (flag) => {
    // Parse argument from flag
    const url = flag.replace(/^prefetch=/g, '')

    // Get data from web
    const data = await fetch(url)
        .then(res => {
            return res.toJson()
        })
    
    // And write last information in file
    await writeFile(
        join(appRootPath, '/', 'lastdata'),
        data
    )
}

// Export this plugin 
module.exports = {
    // Function, that return boolean value (need execute 'executor' or not for flag in parametr)
    isMatch: (flag) => /^prefetch=/g.test(flag),
    executor: mainThread
}
cc.js
const cc = require('clicom')

const myPlugins = [
    // Plugin from example above
    require('./__clicom__/fetchdata.js')
]

// Execute plugins with default plugings
cc.default(
    Object.assign( cc.DefaultPlugins, myPlugins)
)
package.json
"scripts": {
    //       (or cc.js)          (built-in plugin) (start project)          
    "run": "node cc prefetch=google.com flush && node ."
}

Built-in plugins

Flush-console

Flag: 'flush'
Args: no
Description:
Just flush console

Wait

Flag: 'wait' or 'w'
Args: [1 - delay in ms]
Description:
Some pause with passed delay

Flag: 'text-logo'
Args: [1 - Words with not-space delimiter (^ char)]
Example: text-logo=Hello^world
Description:
Output some data in console with pretty char border

FAQs

Package last updated on 09 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts