Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config.init(); // Load from config
config.layerArgs(argv); // Add in commandline overrides
presets.init();
if (!sox.exists()) {
sox.install();
} else {
// Sox is installed
if (argv._.length === 0) { // No command
var ui = require("./ui");
ui(function(complete) {
start(complete);
});
} else {
var opt = argv._[0];
if (opt == "info") {
start({});
return;
}
// Some command
// Load preset
var preset = presets.get(opt);
if (preset === null) {
console.log(chalk.red("Preset '" + opt + "' not found."));
console.log("Try: " + presets.getKeys().join(", "));
} else {
// Got a valid preset
start(preset);
}
}
if (!argv.dry) fail(colors.red("Cannot continue, the local branch is behind the remote changes!"));
else console.log(colors.red("This is a dry run. The full run would fail due to the local branch being behind\n"));
} else if (/Your branch is up\-to\-date/.test(gitStatus) || /Your branch is ahead/.test(gitStatus)) {
// all good
console.log(colors.green("git status is good - I can continue..."));
}
const releaseTypes = ["major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease"];
const releaseType = argv._[0] || "patch";
let newVersion = releaseType;
const oldVersion = pack.version as string;
if (releaseTypes.indexOf(releaseType) > -1) {
if (releaseType.startsWith("pre") && argv._.length >= 2) {
// increment to pre-release with an additional prerelease string
newVersion = semver.inc(oldVersion, releaseType, argv._[1]);
} else {
newVersion = semver.inc(oldVersion, releaseType);
}
console.log(`bumping version ${colors.blue(oldVersion)} to ${colors.gray(releaseType)} version ${colors.green(newVersion)}\n`);
} else {
// increment to specific version
newVersion = semver.clean(newVersion);
if (newVersion == null) {
fail(`invalid version string "${newVersion}"`);
} else {
// valid version string => check if its actually newer
if (!semver.gt(newVersion, pack.version)) {
fail(`new version ${newVersion} is NOT > than package.json version ${pack.version}`);
}
// if (!semver.gt(newVersion, ioPack.common.version)) {
// fail(`new version ${newVersion} is NOT > than io-package.json version ${ioPack.common.version}`);
return new Promise((resolve, reject) => {
let path = argv.path;
// If `path` is not set, use the first argument (if it exists)
if (_.isUndefined(path) && _.isArray(argv._) && argv._.length > 0) {
path = argv._[0];
}
if (!_.isUndefined(path)) {
return resolve(path);
}
// Otherwise, ask for a proper path
return inquirer.prompt([ question ])
.then((answers) => resolve(answers.path))
.catch((err) => reject(err));
});
}
browserify: function() {
var bundler = browserify('./src/js/index.js', {
debug: !production,
cache: {},
paths: ['./node_modules', './src/js'],
});
bundler.transform(babelify)
bundler.transform(envify)
// determine if we're doing a build
// and if so, bypass the livereload
var build = argv._.length ? argv._[0] === 'build' : false;
if (watch) {
bundler = watchify(bundler);
}
var rebundle = function() {
return bundler.bundle()
.on('error', handleError('Browserify'))
.pipe(source('build.js'))
.pipe(gulpif(production, buffer()))
.pipe(gulpif(production, uglify()))
.pipe(gulp.dest('build/js/'));
};
bundler.on('update', rebundle);
return rebundle();
},
};
const lintRules = require('./.markdownlintrc');
const linter = require('./linter');
const argv = require('yargs').argv;
const isMDRE = /.*\.md$/;
const lint = linter(lintRules);
const files = argv._.filter(arg => isMDRE.test(arg));
files.forEach(path => lint({ path: path }));
module.exports = lint;
#!/usr/bin/env node
var argv = require('yargs').argv;
console.log('(%d,%d)', argv.x, argv.y);
console.log(argv._);
"use strict";
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')
const path = require('path')
const fs = require('fs-extra')
const url = require('url')
const argv = require('yargs').argv;
const toml = require('toml');
const concat = require('concat-stream');
const opn = require('opn');
if (!argv._[0]) { process.exit(1); }
const configPath = argv._[0];
const configDir = path.dirname(configPath);
const publicDir = path.join(argv.d || configDir, ".typeSXS_public");
fs.createReadStream(configPath, 'utf8').pipe(concat(function (data) {
const config = toml.parse(data.replace(/\ufeff/g, ''));
if (!config.typefaces) { throw "[typefaces] not defined." }
if (!config.articles) { throw "[articles] not defined." }
if (!config.styles) { throw "[styles] not defined." }
if (!config.samples) { throw "[samples] not defined." }
if (!config.features) { throw "[features] not defined." }
fs.copySync(path.join(__dirname, "public"), publicDir);
let css = '';
let json = {
async function main() {
const files = argv._;
files.forEach(pettifyFile);
}
export function apiDebug() {
const [ requestType ] = argv._;
if (argv.help || !requestType) {
showHelp();
return;
}
requestFromApi(argv, requestType);
}
function getTargetFileInfo() {
var pathCandidates = argv._.concat(process.cwd());
var configFilePath = pathCandidates.map(function(possiblePath) {
var stat = fs.statSync(possiblePath);
if(stat.isFile())
return path.resolve(possiblePath);
else if (stat.isDirectory())
return path.resolve(possiblePath, config.defaultConfigFileName);
else
return null;
}).filter(function(configPath) {
return !!configPath && fs.existsSync(configPath);
})[0];
if(!configFilePath)