configure-express-app
Advanced tools
Comparing version 2.1.3 to 2.1.4
35
index.js
@@ -36,9 +36,9 @@ #!/usr/bin/env node | ||
const projectNaame = (String.raw`${__dirname}`).split('\\'); | ||
// console.log(projectNaame[projectNaame.length-1], "projectNaame[projectNaame.length-1]"); | ||
const checkPackageDotJsonExistOrNot = "./package.json"; | ||
if (!fs.existsSync(checkPackageDotJsonExistOrNot)) { | ||
const ProjectName = prompt("Please Enter Project Name : ") | ||
const alterProjectName = "Express App"; | ||
const packageJsonFileContent = `{ | ||
"name": \"${projectNaame[projectNaame.length-1]}\", | ||
"name": ${ProjectName ? ProjectName : alterProjectName}, | ||
"version": "1.0.0", | ||
@@ -59,6 +59,8 @@ "description": "", | ||
fs.writeFileSync("package.json", packageJsonFileContent); | ||
console.log("\nYour Project Name is -> " + ProjectName ? ProjectName : alterProjectName); | ||
console.log("\nIf you want change your projectname means go and change in package.json"); | ||
} | ||
const config = require("./package.json"); | ||
// console.log(config, config?.main); | ||
@@ -72,25 +74,7 @@ if (config?.main !== "") { | ||
} else { | ||
// console.log("file exist"); | ||
// const jsContent = `const express = require('express')\nconst app = express()\nconst port = 3000 | ||
// \napp.get('/', (req, res) => res.send('Hello World!'))\napp.listen(port, () => console.log(\`Example app listening on port \${port\}!\`))`; | ||
// fs.writeFileSync(`./${config?.main}`, jsContent); | ||
// break; | ||
console.log(`Already ${config?.main} Exist !`); | ||
console.log(`Already ${config?.main} Exist !`); | ||
} | ||
} | ||
// console.log(__dirname); | ||
// const exec = require('child_process').exec; | ||
// exec(`shell ${__dirname} npm i`, (error, stdout, stderr) => { | ||
// if (error) { | ||
// console.error(`exec error: ${error}`); | ||
// return; | ||
// } | ||
// console.log(`stdout: ${stdout}`); | ||
// console.log(`stderr: ${stderr}`); | ||
// }); | ||
console.log( | ||
@@ -103,3 +87,2 @@ "Wait for few seconds to install npm packages -> express !", | ||
const result = execSync(cmd).toString(); | ||
// console.log({ result }) | ||
@@ -106,0 +89,0 @@ console.log(` |
{ | ||
"name": "configure-express-app", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "use npx configure-express-app", | ||
@@ -5,0 +5,0 @@ "bin": { |
3399
77