create-tanstack-app
Advanced tools
Comparing version 1.0.2 to 1.1.4
77
index.js
@@ -1,26 +0,65 @@ | ||
const degit = require('degit'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
#!/usr/bin/env node | ||
const { execSync } = require("child_process"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const readline = require("readline"); | ||
// Prompt the user for input | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
async function getFolderName(defaultName) { | ||
return new Promise((resolve) => { | ||
rl.question( | ||
`Enter the folder name (or use './' for the current directory) [${defaultName}]: `, | ||
(input) => { | ||
resolve(input || defaultName); | ||
} | ||
); | ||
}); | ||
} | ||
async function initApp() { | ||
const projectName = process.argv[2] || 'my-tanstack-app'; // default to 'my-tanstack-app' if no name is provided | ||
const dest = path.join(process.cwd(), projectName); | ||
try { | ||
// Get the folder name from the user or command-line argument | ||
const argFolderName = process.argv[2]; | ||
const folderName = argFolderName || (await getFolderName("my-tanstack-app")); | ||
rl.close(); | ||
// Check if the destination already exists | ||
if (fs.existsSync(dest)) { | ||
console.log('Directory already exists. Please choose another name or delete the existing directory.'); | ||
return; | ||
} | ||
const dest = | ||
folderName === "./" ? process.cwd() : path.join(process.cwd(), folderName); | ||
console.log(`Downloading Tanstack app template from GitHub...`); | ||
// Use degit to download the template | ||
const emitter = degit('SH20RAJ/tanstack-start', { cache: false, force: true }); | ||
emitter.on('info', info => console.log(info)); | ||
// Check if the destination already exists | ||
if (fs.existsSync(dest)) { | ||
console.log( | ||
"❌ Directory already exists. Please choose another name or delete the existing directory." | ||
); | ||
return; | ||
} | ||
try { | ||
await emitter.clone(dest); | ||
console.log(`Template successfully downloaded! Navigate to ${dest} and start working on your project.`); | ||
console.log("📥 Cloning TanStack app template from GitHub..."); | ||
// Clone the repository | ||
execSync( | ||
`git clone https://github.com/SH20RAJ/tanstack-start.git ${dest}`, | ||
{ | ||
stdio: "inherit", | ||
} | ||
); | ||
console.log("✅ Template successfully cloned!"); | ||
// Install dependencies | ||
console.log("📦 Installing dependencies..."); | ||
execSync("npm install", { cwd: dest, stdio: "inherit" }); | ||
console.log(`🎉 Setup complete! Navigate to your project folder:\n`); | ||
console.log(` cd ${folderName === "./" ? "." : folderName}`); | ||
console.log(` npm run dev`); | ||
console.log("\n🚀 Happy coding with TanStack!"); | ||
} catch (error) { | ||
console.error('Error during template download:', error); | ||
console.error("❌ Error during setup:", error.message); | ||
} | ||
@@ -27,0 +66,0 @@ } |
{ | ||
"name": "create-tanstack-app", | ||
"version": "1.0.2", | ||
"main": "index.js", | ||
"bin": { | ||
"create-gi": "./index.js" | ||
}, | ||
"author": "sh20raj", | ||
"license": "ISC", | ||
"description": "A CLI tool to create a Tanstack app", | ||
"dependencies": { | ||
"degit": "^2.8.4" | ||
} | ||
} | ||
"name": "create-tanstack-app", | ||
"version": "1.1.4", | ||
"main": "index.js", | ||
"bin": { | ||
"create-tanstack-app": "./index.js" | ||
}, | ||
"author": "Shaswat Raj", | ||
"license": "ISC", | ||
"description": "A CLI tool to create a Tanstack app", | ||
"keywords": ["TanStack", "create-app", "React", "TypeScript"], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/SH20RAJ/create-tanstack-app.git" | ||
}, | ||
"dependencies": {} | ||
} |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5250
0
56
1
1
- Removeddegit@^2.8.4
- Removeddegit@2.8.4(transitive)