Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
13e4acfb
Commit
13e4acfb
authored
Nov 04, 2020
by
maggie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加编译文件
parent
35b6b5fc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
generate.js
v2.0/compileServer/generate.js
+27
-0
gulpfile.js
v2.0/compileServer/gulpfile.js
+24
-0
package.json
v2.0/compileServer/package.json
+20
-0
custom.controller.njk
...compileServer/templates/controllers/custom.controller.njk
+0
-0
No files found.
v2.0/compileServer/generate.js
0 → 100644
View file @
13e4acfb
/** @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
}
v2.0/compileServer/gulpfile.js
0 → 100644
View file @
13e4acfb
/** @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
)
})
v2.0/compileServer/package.json
0 → 100644
View file @
13e4acfb
{
"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
v2.0/compileServer/templates/controllers/custom.controller.njk
0 → 100644
View file @
13e4acfb
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment