Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const ora = require('ora');
const inquirer = require('inquirer');
const pathTree = require('tree-from-paths');
const initLib = require('@pingy/init');
const scaffoldLib = require('@pingy/scaffold-primitive');
const listWithHelpText = require('./promptListWithHelpText');
const { basename } = require('path');
inquirer.registerPrompt('listWithHelpText', listWithHelpText);
const toNodeTree = (baseDir, paths) =>
` ${basename(baseDir)}/\n${pathTree
.render(paths, baseDir, (parent, file) => file)
.substring(1)
.split('\n')
.join('\n ')}`;
const cwdNodeTree = info => toNodeTree(process.cwd(), info.preparedFiles);
const scaffoldConfirm = filesToWriteTxt =>
inquirer.prompt([
{
type: 'listWithHelpText',
name: 'doScaffold',
// TODO: If any existing files exist then put up a red warning.
const packageJsonPath = path.join(process.cwd(), 'package.json');
let packageJson;
try{
packageJson = require(packageJsonPath);
}
catch(error) {
// no package.json found
errorMsg('package.json could not be read, you in the right directory?')
}
console.log(chalk.gray(`path: ${packageJsonPath}\n`) );
/* add checkbox-plus to inquirer prompt type */
inquirer.registerPrompt('checkbox-plus', require('inquirer-checkbox-plus-prompt'));
userInterview();
/**
* @function userInterview
* start the user interview with checkbox multi-select
*/
function userInterview () {
const interviewMessage =
`Select scripts -- (Press ${chalk.cyan('')} to select,` +
` ${chalk.cyan('')} to complete)` +
`\n${chalk.yellow('filter')}: `;
inquirer
.prompt({
"use strict";
var Q = require("bluebird");
var util = require("util");
var inquirer = require("inquirer");
var inquirerAutocomplete = require("inquirer-autocomplete-prompt");
// injects into String.prototype.....
require("string_score");
inquirer.registerPrompt("autocomplete", inquirerAutocomplete);
var prompter = {};
prompter.confirm = function(text, defaultValue) {
if (Array.isArray(text)) {
text = util.format.apply(null, text);
}
return prompter.prompt({
type: "confirm",
message: text,
name: "answer",
default: defaultValue
}).then(function(answer) {
return answer.answer;
});
};
import pruneHandler from "./command/prune";
import findHandler from "./command/find";
import removeHandler from "./command/remove";
import {
IRuntimeOption,
IAddOption,
IRemoveOption,
ICleanOption,
IRelinkOption,
IFindOption,
IPruneOption,
IListOption
} from "./type";
import { Json$ } from "./registry";
inquirer.registerPrompt(
"autocomplete",
require("inquirer-autocomplete-prompt")
);
const pkg = require(path.join(__dirname, "../package.json"));
class Gpm {
public paths = paths;
public version: string = pkg.version;
public description: string = pkg.description;
private inited = false;
async runtime(options: IRuntimeOption = {}): Promise {
return runtimeHandler(options);
}
async init() {
try {
import ora from 'ora';
import inquirerLocal from 'inquirer';
inquirerLocal.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
export const inquirer = inquirerLocal;
export const spinner = ora();
require('../utils');
const command = require('inquirer');
const Table = require('cli-table2');
const clear = require('clear');
const questions = require('../questions');
command.registerPrompt('datetime', require('inquirer-datepicker-prompt'));
const Options = require('../options/index.js');
const Display = require('../display.js');
const Config = require('../config.js')
const display = new Display();
const config = new Config();
class SettingsMenu {
constructor(settings) {
this.settings = settings || new Options({})
}
async start() {
await this.showConfigurationMenu()
/**
* List prompt example
*/
'use strict';
var inquirer = require('inquirer');
var _ = require('lodash');
var fuzzy = require('fuzzy');
inquirer.registerPrompt('autocomplete', require('./index'));
var states = [
'Alabama',
'Alaska',
'American Samoa',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'District Of Columbia',
'Federated States Of Micronesia',
'Florida',
'Georgia',
'Guam',
import inquirer from 'inquirer';
import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt';
inquirer.registerPrompt('autocomplete', inquirerAutocompletePrompt);
class LocationSelector {
constructor(googleMapsService) {
this.googleMapsService = googleMapsService;
this.locations = {};
}
parseLocations(locations) {
const choices = [];
locations.results.forEach(({ geometry, formatted_address: formattedAddress }) => {
const location = {
latitude: geometry.location.lat,
longitude: geometry.location.lng,
};
this.locations[formattedAddress] = location;
choices.push({ name: formattedAddress, short: formattedAddress });
const { log, wrappedLog } = require('../utils/log')
const { asciiText } = require('../utils/text')
const { handleAsyncError: handle } = require('../utils/async')
const loginStep = require('../guide/step-login')
const seedStep = require('../guide/step-seed')
const createSpaceStep = require('../guide/step-create-space')
const setupStep = require('../guide/step-setup')
const devServerStep = require('../guide/step-dev-server')
const finishStep = require('../guide/step-finish')
const { AbortedError, GUIDE_MAX_WIDTH } = require('../guide/helpers')
const { errorStyle, pathStyle } = require('../utils/styles')
inquirer.registerPrompt('directory', selectDirectory)
const guides = {
'starter-nuxt-blog': {
name: 'Nuxt Starter Blog',
directoryName: 'contentful-nuxt-blog',
repository: 'contentful/blog-in-5-minutes',
seed: 'blog',
setupConfig: async ({
managementToken,
deliveryToken,
spaceId,
installationDirectory
}) => {
const config = await bfj.read(
join(installationDirectory, '.contentful.sample.json')
)
const inquirer = require('inquirer');
const chalk = require('chalk');
const {
cliFileMethods, folderDir, fileList, htmlList,
} = require('./cliFileMethods');
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
const cliQuestions = [
{
type: 'autocomplete',
name: 'static',
suggestOnly: true,
message: chalk.rgb(46, 255, 0)('Type the directory containing your bundle:'),
source: cliFileMethods.searchFolders,
validate(answer) {
if (!folderDir.includes(answer)) {
return chalk.rgb(255, 0, 0).bold('Invalid entry point');
}
return true;
},
},
{