Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Spec */
const cli = meow(
mls`
| Usage
| $ create-emma <dir>
`,
)
/**
* Make sure that user is on the latest version
* avaiable in case they have connection to NPM.
*/
const notifier = updateNotifier(cli)
notifier.notify()
if (notifier.update) {
process.exit(0)
}
/* Main */
// function breakStep() {
// console.log(`-------------------------------------------------------`)
// }
export async function main(cwd: string) {
console.log(
drawBox({</dir>
#!/usr/bin/env node
/* eslint no-console:0 import/no-unresolved:0 */
import dotenv from 'dotenv';
import program from 'commander';
import chalk from 'chalk';
import updateNotifier from 'update-notifier';
import pkg from '../package.json';
import config from './default.json';
import { resolve } from 'path';
import * as cmd from './cmd/index';
updateNotifier({ pkg }).notify();
// Banner.
const banner = `
▼ ${pkg.name} - v${pkg.version}
${pkg.homepage}
`;
console.log(chalk.cyan(banner));
// Load dotenv.
dotenv.config({ silent: true });
// Parse CLI args.
program
.version(pkg.version)
.usage('entrypoint.js [options]')
.option('-p, --port [n]', 'Port to listen on', process.env.PORT)
.then(pack => {
if (!pack) {
throw new Error('package.json not found')
}
const pkg = pack.package
// 1 week
const updateCheckInterval = 1000 * 60 * 60 * 24 * 7
const notifier = new UpdateNotifier({
pkg,
updateCheckInterval,
})
notifier.notify()
return null
})
.catch(console.error)
#!/usr/bin/env node
import meow from 'meow'
import { h, render } from 'ink'
import updateNotifier from 'update-notifier'
import emma from './emma'
// Notify updater
const pkg = require(`../package.json`)
updateNotifier({ pkg }).notify()
// CLI
const cli = meow(`
Usage
$ emma
Example
$ emma -D
Options
--dev -D Add to dev dependencies.
Run without package-name to enter live search.
Use keyboard to search through package library.
Use up/down to select packages.
const checkForUpdates = () =>{
const notifier = updateNotifier({
pkg: packageJSON
//,updateCheckInterval: 1 // useful for debugging
});
let message = [];
let retVal;
if(notifier.update){
message.push("Update available: " + chalk.green.bold(notifier.update.latest) + chalk.gray(" (current: " + notifier.update.current + ")"));
message.push("Run " + chalk.magenta("npm install -g " + packageJSON.name) + " to update.");
retVal = yosay(message.join(" "), {maxLength: stringLength(message[ 0 ])});
}
return retVal;
};
/* eslint-disable unicorn/no-process-exit */
import cac from 'cac'
import update from 'update-notifier'
import bili from './bili'
import { handleRollupError } from './utils'
const cli = cac()
update({ pkg: cli.pkg }).notify()
cli
.option('config', {
desc: 'Path to config file',
alias: 'c'
})
.option('watch', {
desc: 'Run in watch mode',
alias: 'w'
})
.option('filename', {
desc: 'The filename of output file, no extension',
alias: 'n'
})
.option('out-dir', {
desc: 'The output directory',
} = require('fs');
const chokidar = require('chokidar');
const run = require('../dist/index.cjs');
const cfg = require('../package.json');
const options = {
root: process.cwd(),
};
const thisDir = process.cwd();
const {
defaultConfigName,
} = run;
// 更新检查方法
const notifier = new UpdateNotifier({
pkg: cfg,
callback(err, result) {
if (err) return;
if (semCmp(result.latest, result.current) > 0) {
const message =
'Update available ' +
color.dim(result.current) +
color.reset(' → ') +
color.green(result.latest) +
' \nRun ' +
color.cyan('npm i -g ' + json.name) +
' to update';
const msg =
'\n' +
boxen(message, {
padding: 1,
input = path.normalize(path.join(process.cwd(), input))
}
try {
if ((await fs.stat(path.join(input, 'src'))).isDirectory()) {
input = path.join(input, 'src')
}
} catch (error) {}
if (clean) {
console.log(`Cleaning up ${input}...`)
await cleanup(input, verbose)
process.exit()
}
updateNotifier({ pkg }).notify()
if (verbose) {
console.log(chalk.underline(`Views Tools morpher v${pkg.version}`))
console.log(
`\nWill morph files at "${chalk.green(input)}" as "${chalk.green(as)}" ${
tools ? 'with Views Tools' : 'without Views Tools'
}`
)
if (shouldWatch && !tools) {
console.log(
chalk.bgRed(' ')
)
console.log()
console.log(`🚨 You're missing out!!!`)
import cc from 'cli-color';
import execa from 'execa';
import minimist from 'minimist';
import path from 'path';
import pathExists from 'path-exists';
import pkg from '../../package.json';
import updateNotifier from 'update-notifier';
import { clearScreen } from 'ansi-escapes';
import { debounce } from 'lodash';
import { tick, cross } from 'figures';
const isMac = /^darwin/.test(process.platform);
process.title = 'esbox';
updateNotifier({ pkg }).notify();
const red = cc.red;
const black = cc.black;
const bgWhite = cc.xtermSupported ? cc.bgXterm(250) : cc.bgWhite;
const brown = cc.xtermSupported ? cc.xterm(137) : cc.yellow;
const grey = cc.xtermSupported ? cc.xterm(241) : cc.blackBright;
const help = `
${bgWhite(' ')}
${bgWhite(` ${isMac ? '📦' : ''} ${black('ES2016 in a box')} `)}
${bgWhite(` ${grey('git.io/esbox')} `)}
${bgWhite(' ')}
${brown('Usage')}
${grey('>')} esbox ${grey('FILENAME')}
#!/usr/bin/env node
var doccy = require("../doccy.js");
var program = require("commander");
var pjson = require('../package.json');
var glob = require("glob");
var mkdirp = require("mkdirp");
var notifier = require('update-notifier');
if (notifier.update) {
notifier.notify('Update available: ' + notifier.update.latest);
}
program.version(pjson.version)
.option('-g, --glob [fileGlob]', 'Run Doccy on all files matching [fileGlob]')
.option('-o, --output [outputDir]', 'Specify the directory to output documentation to', 'docs')
.parse(process.argv);
if(program.glob) {
glob(program.glob, {}, function(err, files) {
if(files.length) mkdirp(program.output);
files.forEach(function(file) {
if(file.indexOf("node_modules") == -1) {
doccy.init(file, program.output);
}
});
});