Commit 13e4acfb authored by maggie's avatar maggie

添加编译文件

parent 35b6b5fc
/** @format */
const fs = require('fs-extra')
const config = require('./config.json')
const serverTemplatePath = 'templates'
const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
//编译controller.common
for (let commonController in config.controllers.common) {
await gulp
.src(`${serverTemplatePath}/controllers/common/${commonController}.controller.njk`)
.pipe(
nunjucksRender({
...nunjucksRenderConfig,
data: {
model: config.controllers.common[commonController]
}
})
)
.pipe(rename(`${commonController}.controller.ts`))
.pipe(gulp.dest(nunjucksRenderConfig.ServerFullPath + '/controller/common'))
}
}
module.exports = {
run
}
/** @format */
const gulp = require('gulp')
const rename = require('gulp-rename')
const nunjucksRender = require('gulp-nunjucks-render')
const codeGenerate = require('./generate')
var jsScript = 'node'
if (process.env.npm_config_argv !== undefined && process.env.npm_config_argv.indexOf('debug') > 0) {
jsScript = 'node debug'
}
const ServerFullPath = '../src'
const nunjucksRenderConfig = {
path: 'templates',
ext: '.ts',
ServerFullPath
}
gulp.task('code', function () {
require('events').EventEmitter.defaultMaxListeners = 0
return codeGenerate.run(gulp, nunjucksRender, rename, nunjucksRenderConfig)
})
{
"name": "nunjucks-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-nunjucks-render": "^2.2.3",
"gulp-rename": "^2.0.0"
},
"dependencies": {
"fs-extra": "^9.0.1"
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment