node package manager
Painless code sharing. npm Orgs help your team discover, share, and reuse code. Create a free org ยป

selfrefactor

selfrefactor

Collections of small useful CLI functions

Requirements

  • babel-cli
  • documentation
  • yarn

Start-up script

npm i -g babel-cli yarn documentation

Help file content

{
  help: see all commands
  lint:
  '''
  Pass 'filePath' to lint a file.
  Linting depends on several factors:
  - if ends with 'componenent.js' - React lint
  - if includes '__tests__' - Jest lint
  - if ends with 'saga.js' - Redux-saga lint
  - if ends with '.js' - default Javascript lint
  '''
  testUrl:
  '''
  Run load speed tests with given public URL address
  - url(u) //=> http://foo.ngrok.com
  '''
  hjson: 'filePath' for input HJSON and 'output' for output JSON
  ngrok:
  '''
  - port(p) - for exposed port.
  - subdomain
  - region
  - ngrokToken - auth token or place it in process.env.NGROK_TOKEN
  '''
  lintFolder: just run it from the directory you want to lint
  minify:
  '''
  - filePath(f)
  - output(o)
  '''
  deploy:
  '''
  Deploy to Git
  - text(t) - commit title
  '''
  trapper:
  '''
  Watch file in the current directory and runs it on changes
  - filePath = file to watch

  In the folowing code:

  const arg = 2
  const a = x => x + 1

  This evaluation will be piped to console.log:

  a(arg)

  Async functions are supported
  '''
  zip:
  '''
  Zip folder to destination archive
  - filePath - source directory
  - output - .zip destination
  '''
  colors:
  '''
  Creates css color variables file using color declaration in given file

  - filePath - color declarations of type:
  {
    blue:{
      min:"#444222",
      min:"#aaa222"
    }
  }
  - output - location of output css file //=> foo.css
  '''
}