Skip to content

Commit d2efff3

Browse files
committed
first commit
0 parents  commit d2efff3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9414
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
coverage
3+
.vscode
4+
.circleci

.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true
6+
},
7+
extends: [
8+
"eslint-config-2o3t"
9+
],
10+
}

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @zyao89

.github/workflows/coveralls.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Coveralls
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
jobs:
8+
install-and-coveralls:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
15+
- name: Cache node modules
16+
uses: actions/cache@v1
17+
with:
18+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
19+
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
20+
restore-keys: |
21+
${{ runner.os }}-build-${{ env.cache-name }}-
22+
${{ runner.os }}-build-
23+
${{ runner.os }}-
24+
25+
- name: install
26+
run: yarn --network-timeout 600000
27+
28+
- name: yarn add coveralls
29+
run: |
30+
yarn add -D coveralls
31+
yarn run test --coverage && cat ./coverage/lcov.info
32+
33+
- name: Coveralls
34+
uses: coverallsapp/github-action@master
35+
with:
36+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/deploy.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build and Deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
build-and-deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@master
12+
13+
- name: Install
14+
run: npm install
15+
16+
- name: Build
17+
run: npm run-script build
18+
env:
19+
GAID: ${{ secrets.GAID }}
20+
GITHUB_CLIENT_ID: ${{ secrets.GITHUB_CLIENT_ID }}
21+
GITHUB_CLIENT_SECRET: ${{ secrets.GITHUB_CLIENT_SECRET }}
22+
23+
- name: Deploy
24+
run: npm run-script deploy
25+
env:
26+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# nyc test coverage
23+
.nyc_output
24+
25+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26+
.grunt
27+
28+
# Bower dependency directory (https://bower.io/)
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (https://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# Nuxt generate
72+
dist
73+
74+
# vuepress build output
75+
.vuepress/dist
76+
77+
# Serverless directories
78+
.serverless
79+
80+
# IDE
81+
.idea
82+
83+
.vscode
84+
*.suo
85+
*.ntvs*
86+
*.njsproj
87+
*.sln
88+
*.sw*
89+
90+
91+
# custom
92+
microapp/.temp

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-present, Zyao89
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Micro APP Plugin Koa
2+
3+
[Plugin] koa adapter plugin for micro-app.
4+
5+
Micro APP 依赖 Koa 插件.
6+
7+
[![Coverage Status][Coverage-img]][Coverage-url]
8+
[![CircleCI][CircleCI-img]][CircleCI-url]
9+
[![NPM Version][npm-img]][npm-url]
10+
[![NPM Download][download-img]][download-url]
11+
12+
[Coverage-img]: https://coveralls.io/repos/github/MicroAppJS/MicroApp-plugin-koa/badge.svg?branch=master
13+
[Coverage-url]: https://coveralls.io/github/MicroAppJS/MicroApp-plugin-koa?branch=master
14+
[CircleCI-img]: https://circleci.com/gh/MicroAppJS/MicroApp-plugin-koa/tree/master.svg?style=svg
15+
[CircleCI-url]: https://circleci.com/gh/MicroAppJS/MicroApp-plugin-koa/tree/master
16+
[npm-img]: https://img.shields.io/npm/v/@micro-app/plugin-koa.svg?style=flat-square
17+
[npm-url]: https://npmjs.org/package/@micro-app/plugin-koa
18+
[download-img]: https://img.shields.io/npm/dm/@micro-app/plugin-koa.svg?style=flat-square
19+
[download-url]: https://npmjs.org/package/@micro-app/plugin-koa
20+
21+
## Install
22+
23+
```sh
24+
yarn add @micro-app/plugin-koa
25+
```
26+
27+
or
28+
29+
```sh
30+
npm install -D @micro-app/plugin-koa
31+
```
32+
33+
## Usage
34+
35+
```js
36+
'use strict';
37+
38+
39+
module.exports = function(app) {
40+
41+
// 增强 $config
42+
app.$dispatcher('config', require.resolve('@micro-app/test/config'));
43+
// 配置全局 helper
44+
app.$dispatcher('helper', require.resolve('@micro-app/test/helper'));
45+
// 配置全局 service
46+
app.$dispatcher('service', require.resolve('@micro-app/test/service'));
47+
// 配置全局 plugin
48+
app.$dispatcher('plugin', require.resolve('@micro-app/test/plugin'));
49+
// 配置全局 middleware
50+
app.$dispatcher('middleware', require.resolve('@micro-app/test/middleware'));
51+
// 配置路由 router
52+
app.$dispatcher('router', require.resolve('@micro-app/test/router'));
53+
54+
return app;
55+
56+
};
57+
58+
```

demo/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
4+
module.exports = function(app) {
5+
6+
// 增强 $config
7+
app.$dispatcher('config', require.resolve('@micro-app/test/config'));
8+
// 配置全局 helper
9+
app.$dispatcher('helper', require.resolve('@micro-app/test/helper'));
10+
// 配置全局 service
11+
app.$dispatcher('service', require.resolve('@micro-app/test/service'));
12+
// 配置全局 plugin
13+
app.$dispatcher('plugin', require.resolve('@micro-app/test/plugin'));
14+
// 配置全局 middleware
15+
app.$dispatcher('middleware', require.resolve('@micro-app/test/middleware'));
16+
// 配置路由 router
17+
app.$dispatcher('router', require.resolve('@micro-app/test/router'));
18+
19+
return app;
20+
21+
};

0 commit comments

Comments
 (0)