-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
105 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const AbstractTemplateHandler = require('yo-power-generator').AbstractTemplateHandler; | ||
const _ = require('lodash') | ||
const fileUtils = require('yo-power-generator').FileUtils; | ||
const cp = require('child_process'); | ||
const moment = require('moment'); | ||
|
||
class DefaultTemplateHandler extends AbstractTemplateHandler { | ||
_handle0 () { | ||
const tpl = _.template(this.generator.fs.read(this.generator.templatePath(this.tmpl))); | ||
const destTpl = _.template(fileUtils.tmplToFileName(this.tmpl)); | ||
this.generator.fs.write( | ||
this.generator.destinationPath(destTpl(this.props)), | ||
tpl(_.assignIn({ | ||
toolVersion: 'v' + this.props.version, | ||
yoVersion: 'v' + cp.execSync('yo --version', { encoding: 'utf-8' }).replace('\r', '').replace('\n', ''), | ||
nodeVersion: process.version, | ||
date: moment().format('YYYY-MM-DD hh:mm:ss'), | ||
propsJson: JSON.stringify(this.props) | ||
}, this.props)) | ||
) | ||
} | ||
} | ||
|
||
module.exports = { | ||
key: 'scaffold_info', | ||
cls: DefaultTemplateHandler | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Scaffold参考文档 | ||
|
||
此项目由[generator-deepexi-spring-cloud](https://github.com/deepexi/generator-deepexi-spring-cloud)生成。 | ||
|
||
## 项目信息 | ||
|
||
**工具版本**: ${toolVersion} | ||
**node版本**: ${nodeVersion} | ||
**yeoman版本**: ${yoVersion} | ||
**生成时间**: ${date} | ||
**生成方式**: ${mode==='command'?'命令模式':'交互模式'} | ||
**生成参数**: ${propsJson} | ||
**生成命令**: ${cli} | ||
|
||
## 项目参考 | ||
|
||
### .gitkeep | ||
|
||
项目生成后,为了维持一些空文件夹的存在,会为这些空文件夹添加一个`.gitkeep`文件,如果不需要了,可以在项目目录下执行以下命令全部清除 | ||
|
||
```bash | ||
$ find . -name '.gitkeep' | xargs rm | ||
``` | ||
|
||
### demo | ||
|
||
可以通过以下指令清除所有带有Demo字样的文件 | ||
|
||
```bash | ||
$ find . -name '*Demo*' | xargs rm | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters