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 inquirer = require("inquirer");
const validateNpmName = require("validate-npm-package-name");
const languages = require("@freesewing/i18n").languages;
const strings = require("@freesewing/i18n").strings;
const config = require("./config");
let languageChoices = [];
for (let l of Object.keys(languages)) {
languageChoices.push({
name: languages[l],
value: l,
short: languages[l]
});
}
module.exports = async opts => {
if (opts.name && !validateNpmName(opts.name).validForNewPackages) {
throw new Error(`invalid package name "${opts.name}"`);
}
if (opts.skipPrompts) {
if (!opts.name) {
throw new Error(
"invalid input; you must pass a package name with --skip-prompts"