Skip to content

Commit

Permalink
feat: add test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Nov 19, 2016
1 parent 7ad2a93 commit 22def1a
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 29 deletions.
36 changes: 9 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
coverage.html
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

dist
node_modules
coverage
*.log
npm-debug.log
coverage/
*-test/
boilerplate-*/app/proxy*
boilerplate-*/assembly
boilerplate-*/node_modules
boilerplate-*/spm_modules
boilerplate-*/uiweb
boilerplate-*/run
boilerplate-*/logs
boilerplate-*/dist
.logs
logs
*.swp
run
*-run
.idea
.DS_Store
tmp

.idea/
.tmp
4 changes: 2 additions & 2 deletions lib/init_command.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ module.exports = class Command {
if (this.argv.template) {
templateDir = path.resolve(this.cwd, this.argv.template);
if (!fs.existsSync(templateDir)) {
this.log(`${templateDir.red} is not exists`);
this.log(`${templateDir} is not exists`.red);
} else if (!fs.existsSync(path.join(templateDir, 'boilerplate'))) {
this.log(`${templateDir.red} should contain boilerplate folder`);
this.log(`${templateDir} should contain boilerplate folder`.red);
} else {
this.log(`local template dir is ${templateDir.green}`);
return templateDir;
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/simple-test/boilerplate/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "eslint-config-egg",
"rules": {
"no-unused-vars": "off"
}
}
20 changes: 20 additions & 0 deletions test/fixtures/simple-test/boilerplate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# {{name}}

{{description}}

## QuickStart

### Development
```shell
$ npm install
$ npm run dev
$ open http://localhost:7001/news
```

### Deploy

Use `EGG_SERVER_ENV=prod` to enable prod mode

```shell
$ EGG_SERVER_ENV=prod npm start
```
8 changes: 8 additions & 0 deletions test/fixtures/simple-test/boilerplate/_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "{{name}}",
"version": "1.0.0",
"description": "{{description}}",
"private": true,
"author": "{{author}}",
"license": "MIT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

exports.project = '{{name}}';
3 changes: 3 additions & 0 deletions test/fixtures/simple-test/boilerplate/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
logs/
npm-debug.log
node_modules/
14 changes: 14 additions & 0 deletions test/fixtures/simple-test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = {
name: {
desc: 'project name',
},
description: {
desc: 'project description',
},
author: {
desc: 'project author',
default: 'TZ',
},
};
10 changes: 10 additions & 0 deletions test/fixtures/simple-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "egg-boilerplate-simple-test",
"version": "1.0.0",
"description": "boilerplate for egg-init test fixtures",
"homepage": "https://github.com/eggjs/egg-init.git",
"repository": {
"type": "git",
"url": "git@github.com:eggjs/egg-init.git"
}
}

0 comments on commit 22def1a

Please sign in to comment.