Socket
Socket
Sign inDemoInstall

@climax/core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@climax/core

The "Electron" for CLI applications: build and distribute cross-platform CLI clients with NodeJS.


Version published
Maintainers
1
Created
Source

Climax · npm version Build Status Coverage Status JavaScript Style Guide Gitter Climax Community

You can think Climax as the "Electron for CLI applications". But in fact it does even a bit more than that:

  • CLI-based Development
    We provide a CLI to help you generate (almost) everything. Fun fact: the Climax CLI utilizes Climax. We do eat our own :hamburger:.
  • Cross-Platform Build & Release
    Generate and release cross-platform signed binaries in a matter of minutes with just a little bit of config, whether it inludes a npm package or not.
  • Auto-Update Feature
    Adding auto-update capabilities to your CLI clients has never been that easy: it is already implemented to work with your CI. And it's obviously fully secured.
  • Conventions
    We provide a set of conventions regarding your CLI architecture in order to remove the pain of looking around for some.

Features

  • Commander-like declaration
  • Options and value filters
  • Single and list prompts
  • Loading bars and spinners
  • Auto-update
  • Binaries generation

Getting started

:warning: Attention

As long as the first beta releases won't be published, the alpha releases may be proven highly unstable and WILL include multiple breaking changes.

:zap: Info

This entire process will be automatically generated via Climax CLI as soon as its first alpha version will be released.

Installation

npm i @climax/core

Hello World

First, let's fill the meta info and declare the binary path:

package.json

{
  // ...

  "name": "say.js",
  "description": "A dummy program repeating what you type.",
  "version": "1.0.0",
  "bin": {
    "say": "./bin/say.js"
  },

  // ...
}

:zap: Info

The name, description and version specified whithin your package.json are the ones used by default by Climax once you pass its source to program#info(). The bin key is also used to show help, warning and error messages.

Then let's write our first piece of code:

bin/say.js

#!/usr/bin/env node

const { is, program } = require('@climax/core')
const info = require('../package.json')

program.info(info)
  .value('message', 'What do you want to say?', is.aMandatory.string.longerThan(0))
  .option('-t, --twice', 'Say it twice.', is.anOptional.boolean)
  .action(({ options, values }) => {
    for (let i = 0; i <= Number(options.twice); i++) {
      console.log(values.message)
    }
  })

program.command('hello')
  .description('Say hi to whoever you want.')
  .value('name', 'Whom do you want to say hello to?', is.aMandatory.string.longerThan(0))
  .option('-L, --in-language', 'In which language?', is.anOptional.list(['en', 'fr']).else('en'))
  .action(({ options, values }) => {
    const greeting = options.inLanguage === 'en'
      ? `Hello ${values.name}!`
      : `Bonjour ${values.name}!`

    console.log(greeting)
  })

program.init()

Finally we can link our local "binary" file (not compiled yet since they are interprated by NodeJS thanks to the Sha-Bang):

npm link

Let's try it

$ say Bazinga!
Bazinga!

$ say hello E.T -L fr
Bonjour E.T!

Current Working Progress

  • Initial Climax project config
  • Initial Climax project CI
  • Basic Program bootstrap with commands, options and values
  • Basic options and values filters
  • 0.1.0-beta release
  • Help integration
  • 0.2.0-beta release
  • Cross-platform binaries
  • Auto-update via (Travis + Github)
  • CLI: Binaries scripts generation (Travis + Github)
  • CLI: Auto-update config generation (Travis + Github)
  • CLI: Basic scaffold generation
  • CLI: 0.1.0-beta release
  • 0.3.0-beta release
  • Single prompt
  • 0.4.0-beta release
  • List prompt
  • 0.5.0-beta release

Documentation

In progress...

Contributing

Getting Started

git clone https://github.com/climax/core.git
cd core
npm i

Running Tests

It is recommanded to work in TDD mode, including continuously run tests while writing your code:

npm run test:watch

License

Climax is MIT licensed.

FAQs

Package last updated on 01 Apr 2019

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

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