Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require("@axetroy/graceful")();
const path = require("path");
const program = require("caporal");
const pkg = require("./package.json");
const CONFIG = require("./src/config")();
// 可用的编译类型
const availableTypes = {
wechat: 1,
alipay: 1
};
const p = program.version(pkg.version).description(pkg.description);
p
.command("dev")
.option("--src <dir>", "源码目录", program.STRING, "src")
.option("--output <dir>", "输出目录", program.STRING, "dist")
.option(
"--type ",
"微信(wechat)/支付宝(alipay)",
program.STRING,
"wechat"
)
.description("以开发模式运行")
.action(function(argv, options) {
process.env.NODE_ENV = "development";
CONFIG.isProduction = false;
CONFIG.type = options.type;</dir></dir>
* @param opt {string} The port option flag value
* @returns {port} The processed out option flag value
*/
const serverPortOptionValidator = (opt) => {
const portNr = parseInt(opt);
if (!(Number.isInteger(portNr) && portNr >= 0 && portNr <= 65535)) {
throw new Error(`The provided value ${opt} is not valid port number!`);
}
return portNr;
};
// Get the version from package.json
const version = require('./package.json').version;
// Provide it in the CLI
program.version(version, '-v, --version');
// CLI setting for the "build" command
program.command('build', 'Build your resume to the destination format(s).')
.argument('<source>', 'The path to the source JSON resume file.')
.option('-f, --format ', 'Set output format (HTML|PDF|YAML|DOCX|PNG|ALL)', formatOptionValidator, 'all')
.option('-o, --out ', 'Set output directory', outOptionValidator, DEFAULT_OUTPUT_PATH)
.option('-n, --name ', 'Set output file name', nameOptionValidator, DEFAULT_NAME)
.option('-t, --theme ', 'Set the theme you wish to use', themeOptionValidator, DEFAULT_THEME)
.action((args, options) => {
logInfo(`+++ KissMyResume v${version} +++`);
const sourcePath = path.resolve(process.cwd(), args.source );
switch (options.format) {
async function CLI () {
/* GULP */
gutil.patch ();
/* APP */
const {pkg} = await readPkg ({ cwd: __dirname });
updateNotifier ({ pkg }).notify ();
const app = caporal.version ( pkg.version );
/* OPTIONS */
app.option ( '--source, --src, -s
function parseArgs() {
program
.version(packageVersion)
// the "build" command
.command('build', 'Build Handsontable Community Edition or Handsontable PRO package')
.option(
'-i, --input <dir>',
'Path to a directory where Handsontable Community Edition or Handsontable PRO repository was downloaded',
resolve
)
.option(
'-o, --output-dir <dir>',
'Output directory where generated bundle will be saved',
resolve,
void 0,
true
)
.option(</dir></dir>
async function CLI () {
/* APP */
const {pkg} = await readPkg ({ cwd: __dirname });
updateNotifier ({ pkg }).notify ();
const app = caporal.version ( pkg.version );
/* COMMAND */
app.option ( '--src
#!/usr/bin/env node
const program = require('caporal');
const pkg = require('../package.json');
const runCLI = require('../lib/cli').default;
program
.version(pkg.version)
.description('okidoc-md')
.argument('[configPath]', 'Config file path', program.STRING, './docs.yml')
.argument('[outputDir]', 'Markdown output dir', program.STRING, './docs')
.option('-c --config ', 'Config file path', program.STRING)
.option('-o --output ', 'Markdown output base dir', program.STRING)
.action((args, options) => {
runCLI({
configPath: options.config || args.configPath,
outputDir: options.output || args.outputDir,
}).catch(error => {
console.error('An error occurred while building documentation.', error);
process.exit(1);
});
});
rammyrcPath: Util.discoverRammyrc(process.cwd()),
};
if (config.rammyrcPath) logger.debug(`Discovered config: ${config.rammyrcPath}`);
const rammy = new Rammy(config);
const handleError = (error) => {
if (error instanceof Util.RammyError) {
logger.error(error.message);
if (error.comment) logger.warn(error.comment);
}
else console.error(error);
process.exit(1);
};
cli.logger(logger);
cli.version(packageData.version);
//--------- Init
cli
.command('init', 'Initialise a Rammy LaTeX project')
.argument('[dir]', 'Target directory', null, process.cwd())
.option('-g, --git', 'Initialise a Git repo with .gitignore', cli.BOOL, false)
.action((args, options) => {
Promise.resolve()
.then(() => rammy.initProject({directory: path.resolve(args.dir), initGit: options.git}))
.catch(handleError);
});
cli
.command('init-module', 'Initialise a Rammy module')
.argument('', 'Name of the module')
.argument('[dir]', 'Target directory', null, process.cwd())
.action((args) => {
logger.info(logger.emoji.rocket, 'Done.');
process.exit(0);
}).catch(error => {
logger.error(error);
process.exit(1);
});
};
}
let description = pkg.description;
if (Env.isCI) {
description += ' [CI Build]';
}
const commands = prog
.version(pkg.version)
.description(description)
.command('run', 'Run generic component')
.argument('[name]', 'Generic component name')
.argument('[path]', 'Path to tests', /.+/, process.cwd())
.option('--exclude-modules [modules]', 'List of modules to exclude', prog.LIST, [])
.option('--include-modules [modules]', 'List of modules to run', prog.LIST, [])
.option('--custom-config', 'Custom configuration', prog.LIST, [])
.option('--tf-version', 'Terraform version', /.*/, false)
.option('--tf-workspace', 'Terraform workspace', /.*/, false)
.option('--tf-vars', 'Terraform variables as environmental variables', prog.LIST, [])
.option('--tf-varfiles', 'Terraform variables as tfvars files', prog.LIST, [])
.option('--sync', 'Synchronize with cnci', prog.BOOL, false)
.option('-s ', 'Skip component', prog.REPEATABLE)
.option('--registry-path [path]', 'Custom path for .recink', /.+/, ComponentRegistry.DEFAULT_STORAGE_PATH)
.complete(() => [ 'preprocess', 'cache', 'emit', 'npm', 'test', 'coverage' ])
#!/usr/bin/env node
import * as program from 'caporal'
import * as fs from 'fs'
import * as path from 'path'
import * as got from 'got'
import Store from './store'
import { server } from './server'
const pkg = require('../package.json')
const DEFAULT_PORT = 3000
program.version(pkg.version)
program
.command('start', 'Start server with a database file')
.argument('', 'File to start the database with')
.option(
'--port ',
'Port number to listen on',
program.INT,
DEFAULT_PORT,
true,
)
.action(async (args, options, logger) => {
try {
const store = new Store()
await store.init(args.file)
await server(store, parseInt(options.port, 10) || DEFAULT_PORT)
#!/usr/bin/env node
const program = require('caporal');
const pkg = require('../package.json');
const runCLI = require('../cli');
const DEFAULT_CONFIG_PATH = './site.yml';
program
.version(pkg.version)
.description('okidoc-site')
.command(
'develop',
`Start development server. Watches files, rebuilds, and hot reloads if something changes`,
)
.argument(
'[configPath]',
'Config file path',
program.STRING,
DEFAULT_CONFIG_PATH,
)
.action(({ configPath }, {}, logger) => {
runCLI('develop', { configPath }, logger);
})
.command('build', `Build a Gatsby project`)