How to use the minimist.license function in minimist

To help you get started, we’ve selected a few minimist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ReactiveX / rxjs / tools / add-license-to-file.js View on Github external
var fs = require('fs');
var dist = require('minimist')(process.argv).dist;
var license = require('minimist')(process.argv).license;

function addLicenseToFile (license, destination) {
  if (!license) {
    throw new Error('license path is required as 1st argument');
  }

  addLicenseTextToFile(fs.readFileSync(license).toString(), destination);
}

function addLicenseTextToFile(licenseText, destination) {
  if (!destination) {
    throw new Error('destination file path is required as 2nd argument');
  }

  fs.writeFileSync(destination, `/**
  @license