Git Product home page Git Product logo

requirements's Introduction

requirements

npm coveralls dependency Status snyk code style: prettier

Validate your project's software requirements.

requirements-screenshot

install

$ npm install -D requirements
$ yarn add --dev requirements

setup

Scaffold a new requirements.config.js configuration file

$ npx requirements --init

config

Configure the requirements.config.js file in your project root.

module.exports = {
  software: {
    node: '*',
    yarn: '~1.17.3',
    nginx: {
      semver: '>= 1.16.x',
      optional: true, // optional (won't fail)
      installMessage: '<install instruction>', // custom message when binary is not found
      updateMessage: '<update instruction>', // custom message when binary has wrong version
    },
    httpd: {
      semver: '^1.x',
      flag: '-v', // custom version flag
    },
  },
};

check requirements

Run requirements command in the project root. By default it will try to find the requirements.config.js file.

$ npx requirements

Or use a custom path:

$ npx requirements --config <filepath>

CLI options

$ npx requirements --help
Options:
  --help, -h     Show help                                             [boolean]
  --version, -v  Show version number                                   [boolean]
  --init, -i     Create a requirements.config.js file
  --config, -c   Path to the configuration file
                                             [default: "requirements.config.js"]
  --force, -f    Succeeds even if not all requirements are satisfied
                                                      [boolean] [default: false]
  --quiet, -q    Only output when errors are present                   [boolean]
  --debug        Print raw data                                        [boolean]

require('requirements')

const { checkSoftware, renderTable } = require('requirements');

(async () => {
  const result = await checkSoftware({ node: '*' });
  console.log(renderTable(result));
})();

checkSoftware() returns an Array with results

[
  {
    bin: 'node',
    semver: '*',
    installed: true,
    version: '12.8.1',
    satisfies: true,
  },
];

testing

# test functionality
yarn build
node bin/requirements.js --config tests/requirements.config.js

# unit tests
yarn test

license

The MIT License (MIT)

Copyright (c) 2017-2020 Steven Chim

requirements's People

Contributors

renovate[bot] avatar chimurai avatar renovate-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.