Socket
Socket
Sign inDemoInstall

create-nexus-app

Package Overview
Dependencies
56
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

79

index.js

@@ -1,6 +0,5 @@

#! /usr/bin/env node
#!/usr/bin/env node
const { program } = require("commander");
const path = require("path");
const fs = require("fs");
const { execSync } = require("child_process");

@@ -11,3 +10,3 @@

program
// .command("create nexus app")
.command("create nexus app")
.description("Create a new project")

@@ -32,3 +31,3 @@ .action(async () => {

} else if (appTypeAnswers.appType === "Web Application") {
frameworkChoices = ["Vite", "Node.js", "Next.js"];
frameworkChoices = ["Vite", "Node.js"];
}

@@ -50,40 +49,46 @@

const templatePath = path.join(
__dirname,
"templates",
`${answers.framework.toLowerCase()}_template`
);
const targetPath = path.join(process.cwd(), answers.projectName);
try {
fs.mkdirSync(targetPath);
// Copy the template files to the target directory
const filesToCopy = fs.readdirSync(templatePath);
filesToCopy.forEach((file) => {
const sourceFile = path.join(templatePath, file);
const targetFile = path.join(targetPath, file);
fs.copyFileSync(sourceFile, targetFile);
});
// Install dependencies based on the chosen framework
let dependenciesToInstall = [];
if (answers.framework === "React Native") {
dependenciesToInstall = ["react-native"];
} else if (answers.framework === "Vite") {
dependenciesToInstall = ["vite"];
} else if (answers.framework === "Next.js") {
dependenciesToInstall = ["next"];
if (answers.framework === "React Native") {
try {
execSync(`npx react-native init ${answers.projectName}`, {
stdio: "inherit",
});
console.log("Project created successfully using React Native!");
} catch (error) {
console.error("Error creating project:", error);
}
if (dependenciesToInstall.length > 0) {
execSync(`npm install ${dependenciesToInstall.join(" ")}`, {
cwd: targetPath,
} else if (answers.framework === "Vite") {
try {
execSync(`npm init vite@latest ${answers.projectName}`, {
stdio: "inherit",
});
console.log("Project created successfully using Vite!");
} catch (error) {
console.error("Error creating project:", error);
}
}else if (answers.framework === "Next.js") {
try {
execSync(`yarn create next-app ${answers.projectName}`, {
stdio: "inherit",
});
console.log("Project created successfully using Next!");
} catch (error) {
console.error("Error creating project:", error);
}
} else if (answers.framework === "Node.js") {
// Handle Node.js framework setup here
console.log("Creating Node.js project is not implemented yet.");
} else {
const templatePath = path.join(
__dirname,
"templates",
`${answers.framework.toLowerCase()}_template`
);
const targetPath = path.join(__dirname, "output", answers.projectName);
console.log("Project created successfully!");
} catch (error) {
console.error("Error creating project:", error);
try {
// ...
console.log("Project created successfully!");
} catch (error) {
console.error("Error creating project:", error);
}
}

@@ -90,0 +95,0 @@ });

@@ -9,3 +9,3 @@ {

"name": "create-nexus-app",
"version": "1.0.5",
"version": "1.0.6",
"bin": {

@@ -12,0 +12,0 @@ "create-nexus-app": "./index.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc