create-vxrn
Advanced tools
Comparing version 1.1.301 to 1.1.302
@@ -30,3 +30,2 @@ var __create = Object.create; | ||
const { existsSync, readFileSync, writeFileSync } = import_fs_extra.default; | ||
let projectPath = ""; | ||
async function create(args) { | ||
@@ -40,7 +39,9 @@ Number.parseFloat( | ||
`), process.exit(1)); | ||
let projectName = "", resolvedProjectPath = ""; | ||
let projectName = args.name || "", resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName); | ||
async function promptForName() { | ||
projectPath = await (0, import_getProjectName.getProjectName)(), resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectPath), projectName = import_node_path.default.basename(resolvedProjectPath); | ||
projectName = await (0, import_getProjectName.getProjectName)(), resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName); | ||
} | ||
if (!projectPath) | ||
if (projectName) | ||
import_node_fs.default.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1)); | ||
else | ||
for (await promptForName(); import_node_fs.default.existsSync(resolvedProjectPath); ) | ||
@@ -47,0 +48,0 @@ console.info(), console.info( |
@@ -29,3 +29,3 @@ "use strict"; | ||
module.exports = __toCommonJS(create_exports); | ||
var import_ansis = __toESM(require("ansis")), import_fs_extra = __toESM(require("fs-extra")), import_node_child_process = require("node:child_process"), import_node_fs = __toESM(require("node:fs")), import_node_path = __toESM(require("node:path")), import_cloneStarter = require("./helpers/cloneStarter"), import_getProjectName = require("./helpers/getProjectName"), import_getTemplateInfo = require("./helpers/getTemplateInfo"), import_installDependencies = require("./helpers/installDependencies"), import_validateNpmPackage = require("./helpers/validateNpmPackage"), import_prompts = __toESM(require("prompts")), import_detectPackageManager = require("./helpers/detectPackageManager"), { existsSync, readFileSync, writeFileSync } = import_fs_extra.default, projectPath = ""; | ||
var import_ansis = __toESM(require("ansis")), import_fs_extra = __toESM(require("fs-extra")), import_node_child_process = require("node:child_process"), import_node_fs = __toESM(require("node:fs")), import_node_path = __toESM(require("node:path")), import_cloneStarter = require("./helpers/cloneStarter"), import_getProjectName = require("./helpers/getProjectName"), import_getTemplateInfo = require("./helpers/getTemplateInfo"), import_installDependencies = require("./helpers/installDependencies"), import_validateNpmPackage = require("./helpers/validateNpmPackage"), import_prompts = __toESM(require("prompts")), import_detectPackageManager = require("./helpers/detectPackageManager"), { existsSync, readFileSync, writeFileSync } = import_fs_extra.default; | ||
async function create(args) { | ||
@@ -38,7 +38,9 @@ var gitVersionString = Number.parseFloat((0, import_node_child_process.execSync)("git --version").toString().replace("git version ", "").trim()); | ||
`), process.exit(1)); | ||
var projectName = "", resolvedProjectPath = ""; | ||
var projectName = args.name || "", resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName); | ||
async function promptForName() { | ||
projectPath = await (0, import_getProjectName.getProjectName)(), resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectPath), projectName = import_node_path.default.basename(resolvedProjectPath); | ||
projectName = await (0, import_getProjectName.getProjectName)(), resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName); | ||
} | ||
if (!projectPath) | ||
if (projectName) | ||
import_node_fs.default.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1)); | ||
else | ||
for (await promptForName(); import_node_fs.default.existsSync(resolvedProjectPath); ) | ||
@@ -45,0 +47,0 @@ console.info(), console.info(import_ansis.default.yellow("\u26A0\uFE0F"), `The folder ${import_ansis.default.underline(import_ansis.default.blueBright(projectName))} already exists, lets try another name`), console.info(), console.info(), await promptForName(); |
@@ -14,3 +14,2 @@ import ansis from "ansis"; | ||
const { existsSync, readFileSync, writeFileSync } = FSExtra; | ||
let projectPath = ""; | ||
async function create(args) { | ||
@@ -24,7 +23,9 @@ Number.parseFloat( | ||
`), process.exit(1)); | ||
let projectName = "", resolvedProjectPath = ""; | ||
let projectName = args.name || "", resolvedProjectPath = path.resolve(process.cwd(), projectName); | ||
async function promptForName() { | ||
projectPath = await getProjectName(), resolvedProjectPath = path.resolve(process.cwd(), projectPath), projectName = path.basename(resolvedProjectPath); | ||
projectName = await getProjectName(), resolvedProjectPath = path.resolve(process.cwd(), projectName); | ||
} | ||
if (!projectPath) | ||
if (projectName) | ||
fs.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1)); | ||
else | ||
for (await promptForName(); fs.existsSync(resolvedProjectPath); ) | ||
@@ -31,0 +32,0 @@ console.info(), console.info( |
@@ -13,3 +13,3 @@ import ansis from "ansis"; | ||
import { detectPackageManager } from "./helpers/detectPackageManager"; | ||
var { existsSync, readFileSync, writeFileSync } = FSExtra, projectPath = ""; | ||
var { existsSync, readFileSync, writeFileSync } = FSExtra; | ||
async function create(args) { | ||
@@ -22,7 +22,9 @@ var gitVersionString = Number.parseFloat(execSync("git --version").toString().replace("git version ", "").trim()); | ||
`), process.exit(1)); | ||
var projectName = "", resolvedProjectPath = ""; | ||
var projectName = args.name || "", resolvedProjectPath = path.resolve(process.cwd(), projectName); | ||
async function promptForName() { | ||
projectPath = await getProjectName(), resolvedProjectPath = path.resolve(process.cwd(), projectPath), projectName = path.basename(resolvedProjectPath); | ||
projectName = await getProjectName(), resolvedProjectPath = path.resolve(process.cwd(), projectName); | ||
} | ||
if (!projectPath) | ||
if (projectName) | ||
fs.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1)); | ||
else | ||
for (await promptForName(); fs.existsSync(resolvedProjectPath); ) | ||
@@ -29,0 +31,0 @@ console.info(), console.info(ansis.yellow("\u26A0\uFE0F"), `The folder ${ansis.underline(ansis.blueBright(projectName))} already exists, lets try another name`), console.info(), console.info(), await promptForName(); |
{ | ||
"name": "create-vxrn", | ||
"version": "1.1.301", | ||
"version": "1.1.302", | ||
"bin": "run.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs", |
@@ -16,5 +16,3 @@ import ansis from 'ansis' | ||
let projectPath = '' | ||
export async function create(args: { template?: string }) { | ||
export async function create(args: { template?: string; name?: string }) { | ||
const gitVersionString = Number.parseFloat( | ||
@@ -28,12 +26,16 @@ execSync(`git --version`).toString().replace(`git version `, '').trim() | ||
let projectName = '' | ||
let resolvedProjectPath = '' | ||
let projectName = args.name || '' | ||
let resolvedProjectPath = path.resolve(process.cwd(), projectName) | ||
async function promptForName() { | ||
projectPath = await getProjectName() | ||
resolvedProjectPath = path.resolve(process.cwd(), projectPath) | ||
projectName = path.basename(resolvedProjectPath) | ||
projectName = await getProjectName() | ||
resolvedProjectPath = path.resolve(process.cwd(), projectName) | ||
} | ||
if (!projectPath) { | ||
if (projectName) { | ||
if (fs.existsSync(resolvedProjectPath)) { | ||
console.error(`Error: folder already exists: ${resolvedProjectPath}`) | ||
process.exit(1) | ||
} | ||
} else { | ||
await promptForName() | ||
@@ -40,0 +42,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280012
4301