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OAAkB,GAEjD,MAAM,EAAQ,oBAAoB,uBACvB,oBAA0B,sFAEb,gDACE,6EAI1B,GAAG,cAAc,EAAW,IAAI,YAAuB,EAAM,IAGjE,OAAO,UAAU,kBAAkB,KAC/B,MAAM,EAAc,EAAY,cAC1B,EAAK,mCAAmC,OAC9C,GAAG,cAAc,EAAc,YAAa,GAC5C,MAAM,EAAK,wBAAwB,MACnC,GAAG,cAAc,EAAc,cAAe,EAAG,GACnD,EAGN","file":"/npm/tsa-cli@0.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/tsa-cli@0.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#! /usr/bin/env node\r\n\r\nconst chalk = require('chalk');\r\nconst clear = require('clear');\r\nconst figlet = require('figlet');\r\nconst inquirer = require('./lib/inquirer');\r\nconst loader = require('./lib/loader');\r\nconst files = require('./lib/files');\r\nconst fs = require('fs');\r\nconst _ = require('lodash');\r\n\r\nclear();\r\nconsole.log(\r\n    chalk.blue(\r\n        figlet.textSync('TSA-cli', { horizontalLayout: 'full' })\r\n    )\r\n);\r\n\r\nconst run = async () => {\r\n    const details = await inquirer.askProjectDetails();\r\n    const { projectName, description } = details;\r\n    let basePath = '';\r\n    let projectPath = '';\r\n    let srcpath = '';\r\n    let testpath = '';\r\n\r\n    loader.runLoader('Get current path and create directory', () => {\r\n        basePath = process.cwd();\r\n        projectPath = basePath + '/' + projectName;\r\n        srcpath = projectPath + '/src';\r\n        testpath = projectPath + '/__tests__';\r\n        if (!fs.existsSync(projectPath)) {\r\n            fs.mkdirSync(projectPath);\r\n            fs.mkdirSync(srcpath);\r\n            fs.mkdirSync(testpath);\r\n        }\r\n    });\r\n\r\n    loader.runLoader('Create package.json', () => {\r\n        const baseFile = require('./base/base.package');\r\n        baseFile.name = projectName;\r\n        baseFile.description = description;\r\n        fs.writeFileSync(projectPath + '/package.json', JSON.stringify(baseFile, null, \"\\t\"));\r\n    });\r\n\r\n    loader.runLoader('Create jest.config.js', () => {\r\n        const baseFile = require('./base/base.jest');\r\n        const result = 'module.exports = ' + JSON.stringify(baseFile, null, \"\\t\");\r\n        fs.writeFileSync(projectPath + '/jest.config.js', result);\r\n    });\r\n\r\n    loader.runLoader('Create tsconfig.json', () => {\r\n        const baseFile = require('./base/base.tsconfig');\r\n        const result = JSON.stringify(baseFile, null, \"\\t\");\r\n        fs.writeFileSync(projectPath + '/tsconfig.json', result);\r\n    });\r\n\r\n    loader.runLoader('Create sources', () => {\r\n        const appFilePath = projectName.toLowerCase();\r\n        const appName = (_.startCase(_.toLower(projectName))).replace(/\\s/g, '');\r\n\r\n        const result = `// app class for ${projectName}\r\n        export class ${appName} {\r\n        }`;\r\n        fs.writeFileSync(srcpath + `/${appFilePath}.ts`, result);\r\n\r\n        const tests = `// app tests for ${projectName}\r\n        import { ${appName} } from '../src/${appFilePath}';\r\n        describe('Testing Async Proc', () => {\r\n            it('should create ${appName}', () => {\r\n                const obj = new ${appName};\r\n                expect(obj).toBeTruthy();\r\n            });\r\n        })`;\r\n        fs.writeFileSync(testpath + `/${appFilePath}.test.ts`, tests);\r\n    });\r\n\r\n    loader.runLoader('Create indexes', () => {\r\n        const appFilePath = projectName.toLowerCase();\r\n        const js = `module.exports = require('./bin/${appFilePath}');`;\r\n        fs.writeFileSync(projectPath + '/index.js', js);\r\n        const ts = `export * from './bin/${appFilePath}';`;\r\n        fs.writeFileSync(projectPath + '/index.d.ts', ts);\r\n    });\r\n}\r\n\r\nrun();"]}