const createServiceFile = (filename) => { createServiceFolder(filename).then((folderPath, error) => { const filePath = folderPath + '/index.js'; shell.touch(filePath); return filePath; }).catch(error => { console.log(error); }); }
shell.touch(path.join(fixtureData.dir, 'totalNewFile')) if (!fixtureData.getStatus().changed) { throw String('Something is terribly worng!') let file = path.join(fixtureData.dir, 'directory/README.md') shell.rm(file) shell.touch(file) if (!fixtureData.getStatus().changed) { throw String('Something is terribly worng!') shell.touch(path.join(dfp(fixturesRoot)(fixturesRoot)('permanent')().get('./').dir, 'new')) fixtureData = dfp(fixturesRoot)(fixturesRoot)('permanent')().get('./') shell.touch(path.join(dfp(fixturesRoot)('permanent')().get('./').dir, 'new')) fixtureData = dfp(fixturesRoot)('permanent', 'cleanFirst')().get('./') if (fixtureData.getStatus().changed) {
const createControllerFile = (controllerFile) => { createControllerFolder(controllerFile).then((folderPath, error) => { const filePath = folderPath + '/index.js'; shell.touch(filePath); let content = ''; content += "'use strict'\n\n"; content += "const express = require('express');\n"; content += "const " + controllerFile + "Service = require('../../../services/" + controllerFile + "');\n\n"; content += "let router = express.Router();\n\n"; content += "router.post('/', " + controllerFile + "Service.AddYourMethod);\n\n"; content += "module.exports = router;\n"; fs.appendFile(filePath, content, (err) => { if (err) { console.error(err) return } }); return filePath; }).catch(error => { console.log(error); }); }