How to use sade - 10 common examples

To help you get started, we’ve selected a few sade 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 sveltejs / sapper / src / cli.ts View on Github external
import * as fs from 'fs';
import * as path from 'path';
import sade from 'sade';
import colors from 'kleur';
import * as pkg from '../package.json';
import { elapsed, repeat, left_pad, format_milliseconds } from './utils';
import { InvalidEvent, ErrorEvent, FatalEvent, BuildEvent, ReadyEvent } from './interfaces';

const prog = sade('sapper').version(pkg.version);

if (process.argv[2] === 'start') {
	// remove this in a future version
	console.error(colors.bold().red(`'sapper start' has been removed`));
	console.error(`Use 'node [build_dir]' instead`);
	process.exit(1);
}

const start = Date.now();

prog.command('dev')
	.describe('Start a development server')
	.option('-p, --port', 'Specify a port')
	.option('-o, --open', 'Open a browser window')
	.option('--dev-port', 'Specify a port for development server')
	.option('--hot', 'Use hot module replacement (requires webpack)', true)
github jaredpalmer / tsdx / src / index.ts View on Github external
import * as Messages from './messages';
import { createRollupConfig } from './createRollupConfig';
import { createJestConfig } from './createJestConfig';
import { createEslintConfig } from './createEslintConfig';
import { resolveApp, safePackageName, clearConsole } from './utils';
import { concatAllArray } from 'jpjs';
import getInstallCmd from './getInstallCmd';
import getInstallArgs from './getInstallArgs';
import { Input, Select } from 'enquirer';
import { PackageJson, TsdxOptions } from './types';
import { createProgressEstimator } from './createProgressEstimator';
import { templates } from './templates';
import { composePackageJson } from './templates/utils';
const pkg = require('../package.json');

const prog = sade('tsdx');

let appPackageJson: PackageJson;

try {
  appPackageJson = fs.readJSONSync(resolveApp('package.json'));
} catch (e) {}

// check for custom tsdx.config.js
let tsdxConfig = {
  rollup(config: RollupOptions, _options: TsdxOptions): RollupOptions {
    return config;
  },
};

if (fs.existsSync(paths.appConfig)) {
  tsdxConfig = require(paths.appConfig);
github anikethsaha / create-web-app / src / index.ts View on Github external
#!/usr/bin/env node

import sade from "sade";
import notifier from "update-notifier";
import create from "./commands/create";
import list from "./commands/list";
import run from "./commands/run";
import { projectName } from "./utils/generator";

// tslint:disable-next-line: no-var-requires
const pkg = require("../package.json");
notifier({ pkg }).notify();

const prog = sade("cwa").version(pkg.version);

prog
  .command("list")
  .describe("List All The templates Available")
  .action(list);
prog
  .command("run [projectname]")
  .describe("[WIP] Gives the command to run the Project")
  .option("--src", "Please Mention the source if the default is changed","")
  .action(run);
prog
  .command("create")
  .describe("create a project passing the template and your project name")
  .action(create);

prog.parse(process.argv);
github tungv / jerni / packages / heq-client / src / cli.js View on Github external
#!/usr/bin/env node

import sade from 'sade';

import { version, bin } from '../package.json';
import subscribeCommand from './subscribeCommand';

const binName = Object.keys(bin)[0];
const program = sade(binName);

program
  .version(version)
  .option('--json', 'output logs in JSON format', false)
  .option(
    '--verbose, -x',
    'level of log can be either SILLY, DEBUG, INFO, WARN, ERROR, or FATAL',
    'INFO'
  );

program
  .command('subscribe', '', {
    default: true,
  })
  .describe(
    'start to subscribe to an heq server and persist data to a datastore'
github developit / karmatic / src / cli.js View on Github external
#!/usr/bin/env node

import sade from 'sade';
import chalk from 'chalk';
import './lib/patch';
import karmatic from '.';
import { cleanStack } from './lib/util';

const { version } = require('../package.json');

let toArray = val => Array.isArray(val) ? val : val == null ? [] : [val];

let prog = sade('karmatic');

prog
	.version(version)
	.option('--files', 'Minimatch pattern for test files')
	.option('--headless', 'Run using Chrome Headless', true)
	.option('--coverage', 'Report code coverage of tests', true);

prog
	.command('run [...files]', '', { default: true })
	.describe('Run tests once and exit')
	.action(run);

prog
	.command('watch [...files]')
	.describe('Run tests on any change')
	.action( (str, opts) => run(str, opts, true) );
github developit / microbundle / src / prog.js View on Github external
export default handler => {
	const ENABLE_MODERN = process.env.MICROBUNDLE_MODERN !== 'false';

	const DEFAULT_FORMATS = ENABLE_MODERN ? 'modern,es,cjs,umd' : 'es,cjs,umd';

	const cmd = type => (str, opts) => {
		opts.watch = opts.watch || type === 'watch';
		opts.compress =
			opts.compress != null ? opts.compress : opts.target !== 'node';
		opts.entries = toArray(str || opts.entry).concat(opts._);
		handler(opts);
	};

	let prog = sade('microbundle');

	prog
		.version(version)
		.option('--entry, -i', 'Entry module(s)')
		.option('--output, -o', 'Directory to place build files into')
		.option('--format, -f', 'Only build specified formats', DEFAULT_FORMATS)
		.option('--watch, -w', 'Rebuilds on any change', false)
		.option('--target', 'Specify your target environment (node or web)', 'web')
		.option('--external', `Specify external dependencies, or 'none'`)
		.option('--globals', `Specify globals dependencies, or 'none'`)
		.example('microbundle --globals react=React,jquery=$')
		.option('--define', 'Replace constants with hard-coded values')
		.example('microbundle --define API_KEY=1234')
		.option('--alias', `Map imports to different modules`)
		.example('microbundle --alias react=preact')
		.option('--compress', 'Compress output using Terser', null)
github sveltejs / svelte-cli / src / index.js View on Github external
import sade from 'sade';
import * as pkg from '../package.json';

const prog = sade('svelte-cli').version(pkg.version);

prog
	.command('compile <input>')

	.option('-o, --output', 'Output (if absent, prints to stdout)')
	.option('-f, --format', 'Type of output (amd, cjs, es, iife, umd)')
	.option('-g, --globals', 'Comma-separate list of `module ID:Global` pairs')
	.option('-n, --name', 'Name for IIFE/UMD export (inferred from filename by default)')
	.option('-m, --sourcemap', 'Generate sourcemap (`-m inline` for inline map)')
	.option('-d, --dev', 'Add dev mode warnings and errors')
	.option('--amdId', 'ID for AMD module (default is anonymous)')
	.option('--generate', 'Change generate format between `dom` and `ssr`')
	.option('--no-css', `Don't include CSS (useful with SSR)`)
	.option('--immutable', 'Support immutable data structures')

	.example('compile App.html &gt; App.js')
github yuanqing / create-figma-plugin / packages / build / src / cli.js View on Github external
#!/usr/bin/env node

import sade from 'sade'
import { build } from './build'
import { watch } from './watch'

sade('create-figma-plugin-build', true)
  .option('-d, --dev', 'Build in development mode', false)
  .option('-w, --watch', 'Rebuild the plugin on changes', false)
  .action(async function ({ dev: isDevelopment, watch: isWatch }) {
    if (isWatch === true) {
      watch()
      return
    }
    await build(isDevelopment, true)
  })
  .parse(process.argv)
github bertilxi / typepack / src / index.ts View on Github external
require("ts-node/register/transpile-only");
const { version } = require("../package.json");
import sade from "sade";
import { bootstrap } from "./service/store";
import build from "./command/build";
import dev from "./command/dev";

const cli = sade("typepack");

cli
  .version(version)
  .option("--debug, -d", "Run CLI in debug mode")

  .command("build")
  .describe("Start production build")
  .option("--env, -e", "Build mode", "production")
  .action(bootstrap(build))

  .command("dev")
  .describe("Start development server")
  .option("--open, -o", "Should the app be opened in the browser or not", false)
  .option("--port, -p", "A port number to start the application", 3000)
  .option("--env, -e", "Build mode", "development")
  .action(bootstrap(dev))

sade

Smooth (CLI) operator 🎶

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular sade functions