node-app-create
Version:
node-ex its basic framework for node express server with mongo db support
38 lines (32 loc) • 1.39 kB
JavaScript
const fs = require('node:fs');
const processHandler = require('../libs/processHandler');
const colors = require('colors');
const envInfo = require('envinfo');
module.exports = async (appName) => {
fs.mkdirSync(appName);
let git = await processHandler.stdHandler(`cd ${appName} && git init`);
if (git.error) {
console.log(colors.red('unnable to initialize git'));
}
let curentFolder = process.cwd() + '/' + appName;
await processHandler.stdHandler(
`cd ${curentFolder} && git remote add origin https://github.com/sri0711/express_model.git/`
);
await processHandler.stdHandler(`cd ${curentFolder} && git fetch`);
await processHandler.stdHandler(`cd ${curentFolder} && git checkout main`);
await processHandler.stdHandler(`cd ${curentFolder} && git pull`);
await processHandler.stdHandler(
`cd ${curentFolder} && rm -fr .git package.json package-lock.json`
);
await processHandler.stdHandler(`cd ${curentFolder} && git init`);
await processHandler.stdHandler(`cd ${curentFolder} && npm init -y`);
await processHandler.stdHandler(
`cd ${curentFolder} && npm i express mongoose morgan cors cmn-util`,
true
);
await processHandler.stdHandler(
`cd ${curentFolder} && npm i -D chai mocha nyc mochawesomeprettier eslint husky lint-staged eslint-plugin-prettier eslint-plugin-node`,
true
);
// let installedDependencies = await processHandler.stdHandler('');
};