@mianfrigo/express-typescript-generator
Version:
npm package to generate boilerplate node express application with typescript and webpack
31 lines (26 loc) • 694 B
JavaScript
const chalk = require('chalk');
const pcg = require('../package.json');
const path = require('path');
const fs = require('fs-extra');
function handleArgs(args) {
if (args[0] === '-v' || args[0] === '--version') {
console.log(chalk.yellow(`express-typescript-generator v${pcg.version}`));
process.exit();
}
}
async function pathExists(destination) {
return fs.pathExists(destination);
}
/**
* Get destination path
* @param {string} destFolder
*/
function getProjectPath(destFolder) {
destFolder = destFolder || 'express-ts';
return path.join(process.cwd(), destFolder);
}
module.exports = {
handleArgs,
pathExists,
getProjectPath,
};