Skip to content

Commit

Permalink
feat: init project
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Jan 20, 2017
0 parents commit a7056f5
Show file tree
Hide file tree
Showing 15 changed files with 349 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .autod.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

module.exports = {
write: true,
prefix: '^',
test: [
'test',
'benchmark',
],
devdep: [
'egg',
'egg-ci',
'egg-bin',
'autod',
'eslint',
'eslint-config-egg',
'supertest',
'webstorm-disable-index',
],
exclude: [
'./test/fixtures',
'./docs',
'./coverage',
],
registry: 'https://r.cnpmjs.org',
};
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/fixtures
coverage
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-egg"
}
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] `npm test` passes
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->


##### Description of change
<!-- Provide a description of the change below this comment. -->
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
logs/
npm-debug.log
node_modules/
coverage/
.idea/
run/
.DS_Store
*.swp

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Alibaba Group Holding Limited and other contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# egg-view-react

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-view-react.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-view-react
[travis-image]: https://img.shields.io/travis/eggjs/egg-view-react.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-view-react
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-view-react.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-view-react?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-view-react.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-view-react
[snyk-image]: https://snyk.io/test/npm/egg-view-react/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-view-react
[download-image]: https://img.shields.io/npm/dm/egg-view-react.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-view-react

STILL WORK IN PROGRESS.

egg view plugin for [react].

## Install

```bash
$ npm i egg-view-react --save
```

## Usage

```js
// {app_root}/config/plugin.js
exports.view = {
enable: true,
package: 'egg-view-react',
};
```

## Configuration

```js
// {app_root}/config/config.default.js
exports.view = {
};
```

see [config/config.default.js](config/config.default.js) for more detail.

## Example

<!-- example here -->

## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)

[react]: https://facebook.github.io/react/
76 changes: 76 additions & 0 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# egg-view-react

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-view-react.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-view-react
[travis-image]: https://img.shields.io/travis/eggjs/egg-view-react.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-view-react
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-view-react.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-view-react?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-view-react.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-view-react
[snyk-image]: https://snyk.io/test/npm/egg-view-react/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-view-react
[download-image]: https://img.shields.io/npm/dm/egg-view-react.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-view-react

<!--
Description here.
-->

## 依赖说明

### 依赖的 egg 版本

egg-view-react 版本 | egg 1.x
--- | ---
1.x | 😁
0.x | ❌

### 依赖的插件
<!--
如果有依赖其它插件,请在这里特别说明。如
- security
- multipart
-->

## 开启插件

```js
// config/plugin.js
exports.view-react = {
enable: true,
package: 'egg-view-react',
};
```

## 使用场景

- Why and What: 描述为什么会有这个插件,它主要在完成一件什么事情。
尽可能描述详细。
- How: 描述这个插件是怎样使用的,具体的示例代码,甚至提供一个完整的示例,并给出链接。

## 详细配置

请到 [config/config.default.js](config/config.default.js) 查看详细配置项说明。

## 单元测试

<!-- 描述如何在单元测试中使用此插件,例如 schedule 如何触发。无则省略。-->

## 提问交流

请到 [egg issues](https://github.com/eggjs/egg/issues) 异步交流。

## License

[MIT](LICENSE)
5 changes: 5 additions & 0 deletions agent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = agent => {
console.log('agent.config.env =', agent.config.env);
};
5 changes: 5 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = app => {
console.log('app.config.env =', app.config.env);
};
10 changes: 10 additions & 0 deletions config/config.default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

/**
* view-react default config
* @member Config#view-react
* @property {String} SOME_KEY - some description
*/
exports.view-react = {

};
68 changes: 68 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "egg-view-react",
"version": "0.0.1",
"description": "egg view plugin for react",
"eggPlugin": {
"name": "view"
},
"keywords": [
"egg",
"eggPlugin",
"egg-plugin",
"egg-plugin-view"
],
"dependencies": {},
"devDependencies": {
"autod": "^2.7.1",
"egg": "^0.7.0",
"egg-bin": "^1.10.0",
"egg-ci": "^1.1.0",
"egg-mock": "^2.0.0",
"eslint": "^3.13.1",
"eslint-config-egg": "^3.2.0",
"supertest": "^2.0.1",
"webstorm-disable-index": "^1.1.2"
},
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"autod": "autod"
},
"files": [
"index.js",
"app.js",
"agent.js",
"config",
"app",
"lib"
],
"ci": {
"version": "6, 7"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eggjs/egg-view-react.git"
},
"bugs": {
"url": "https://github.com/eggjs/egg/issues"
},
"homepage": "https://github.com/eggjs/egg-view-react#readme",
"author": "TZ <atian25@qq.com>",
"license": "MIT",
"boilerplate": {
"name": "egg-boilerplate-plugin",
"version": "1.7.0",
"description": "boilerplate for egg plugin",
"repository": {
"type": "git",
"url": "git@github.com:eggjs/egg-boilerplate-plugin.git"
},
"homepage": "https://github.com/eggjs/egg-boilerplate-plugin"
}
}
7 changes: 7 additions & 0 deletions test/fixtures/apps/view-react-test/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = app => {
app.get('/', function* () {
this.body = 'hi, ' + app.plugins['view-react'].name;
});
};
4 changes: 4 additions & 0 deletions test/fixtures/apps/view-react-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "view-react-test",
"version": "0.0.1"
}
24 changes: 24 additions & 0 deletions test/view-react.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const request = require('supertest');
const mm = require('egg-mock');

describe('test/view-react.test.js', () => {
let app;
before(() => {
app = mm.app({
baseDir: 'apps/view-react-test',
});
return app.ready();
});

after(() => app.close());
afterEach(mm.restore);

it('should GET /', () => {
return request(app.callback())
.get('/')
.expect('hi, view-react')
.expect(200);
});
});

0 comments on commit a7056f5

Please sign in to comment.