diff --git a/examples/amp/.eslintrc b/examples/amp/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/amp/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/amp/package.json b/examples/amp/package.json index 610c53c..87bca82 100644 --- a/examples/amp/package.json +++ b/examples/amp/package.json @@ -1,5 +1,5 @@ { - "name": "amp", + "name": "avet-example-amp", "version": "1.0.0", "description": "amp example for avet", "scripts": { @@ -8,14 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.5.0", + "avet": "^1.0.0-9", "avet-amp": "^0.1.0" }, "devDependencies": { - "avet-bin": "^0.7.0", + "avet-bin": "^1.0.0-9", "babel-eslint": "^8.0.2", - "eslint": "^4.10.0", - "eslint-config-avet": "^0.3.8" + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -23,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/antd/.eslintrc b/examples/antd/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/antd/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/antd/package.json b/examples/antd/package.json index 9751128..d153a58 100644 --- a/examples/antd/package.json +++ b/examples/antd/package.json @@ -1,5 +1,5 @@ { - "name": "antd", + "name": "avet-example-antd", "version": "1.0.0", "description": "antd example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.4.1", - "avet-antd": "^0.1.0" + "avet": "^1.0.0-9", + "avet-antd": "^0.1.1" }, "devDependencies": { - "avet-bin": "^0.4.1" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/dva/.eslintrc b/examples/dva/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/dva/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/dva/package.json b/examples/dva/package.json index 8c88966..42aa65e 100644 --- a/examples/dva/package.json +++ b/examples/dva/package.json @@ -1,5 +1,5 @@ { - "name": "dva", + "name": "avet-example-dva", "version": "1.0.0", "description": "dva example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.4.3", + "avet": "^1.0.0-9", "avet-dva": "^0.2.1" }, "devDependencies": { - "avet-bin": "^0.5.1" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/egg/.eslintrc b/examples/egg/.eslintrc new file mode 100644 index 0000000..dc7e28f --- /dev/null +++ b/examples/egg/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": "eslint-config-avet", + "globals": { + "API_HOST": true + } +} diff --git a/examples/egg/app/controller/hello.js b/examples/egg/app/controller/hello.js index 9bd5743..8cf6b13 100644 --- a/examples/egg/app/controller/hello.js +++ b/examples/egg/app/controller/hello.js @@ -1,9 +1,7 @@ -'use strict'; +const { Controller } = require('egg'); -const app = require('egg'); - -class HelloController extends app.Controller { - * index() { +class HelloController extends Controller { + index() { this.ctx.body = 'Hello, Welcome to use Avet and Egg!!'; } } diff --git a/examples/egg/app/router.js b/examples/egg/app/router.js index 0c619af..ec3e167 100644 --- a/examples/egg/app/router.js +++ b/examples/egg/app/router.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = app => { app.get('/api/getHello', 'hello.index'); }; diff --git a/examples/egg/avet/component/header.js b/examples/egg/avet/component/header.js deleted file mode 100644 index 06f91f9..0000000 --- a/examples/egg/avet/component/header.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' - -class Header extends React.Component { - render() { - return ( -
-

this is a component.

-
- ) - } -} - -export default Header; diff --git a/examples/egg/avet/config/config.local.js b/examples/egg/avet/config/config.local.js deleted file mode 100644 index 61390ef..0000000 --- a/examples/egg/avet/config/config.local.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -const path = require('path'); - -exports.build = { - webpackDevMiddleware: { - noInfo: true, - quiet: true - } -} - -exports.avet = { - dir: path.join(process.cwd(), 'avet') -} - -exports.define = { - 'API_HOST': 'http://127.0.0.1:7001' -} diff --git a/examples/egg/avet/config/plugin.js b/examples/egg/avet/config/plugin.js deleted file mode 100644 index d752382..0000000 --- a/examples/egg/avet/config/plugin.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -exports.preact = { - enable: true, - package: 'avet-preact' -} - -exports.fetch = { - enable: true, - package: 'avet-fetch' -} - -exports.define = { - enable: true, - package: 'avet-define' -} \ No newline at end of file diff --git a/examples/egg/config/config.default.js b/examples/egg/config/config.default.js index c7a1030..7d8bb42 100644 --- a/examples/egg/config/config.default.js +++ b/examples/egg/config/config.default.js @@ -1,10 +1,8 @@ -'use strict'; - module.exports = appInfo => { - const config = exports = {}; + const config = (exports = {}); // use for cookie sign key, should change to your own and keep security - config.keys = appInfo.name + '_1509640041953_6564'; + config.keys = `${appInfo.name}_1509640041953_6564`; // add your config here config.middleware = []; diff --git a/examples/egg/config/config.local.js b/examples/egg/config/config.local.js index 7ec866c..7aefcf0 100644 --- a/examples/egg/config/config.local.js +++ b/examples/egg/config/config.local.js @@ -1,5 +1,6 @@ -'use strict'; - exports.security = { - domainWhiteList: ['http://localhost:3000'] -}; \ No newline at end of file + domainWhiteList: [ 'http://localhost:3000' ], + csrf: { + enable: false, + }, +}; diff --git a/examples/egg/config/plugin.prod.js b/examples/egg/config/plugin.prod.js index ee5835d..3110df5 100644 --- a/examples/egg/config/plugin.prod.js +++ b/examples/egg/config/plugin.prod.js @@ -1,9 +1,7 @@ -'use strict'; - // had enabled by egg // exports.static = true; exports.avet = { enable: true, - package: 'egg-avet' -} \ No newline at end of file + package: 'egg-avet', +}; diff --git a/examples/egg/package.json b/examples/egg/package.json index acc1869..6104847 100644 --- a/examples/egg/package.json +++ b/examples/egg/package.json @@ -1,5 +1,5 @@ { - "name": "avet-egg", + "name": "avet-example-egg", "version": "1.0.0", "description": "this is a avet and egg example", "private": true, @@ -8,21 +8,22 @@ "stop": "egg-scripts stop", "dev": "npm run dev:egg & npm run dev:avet", "dev:egg": "egg-bin dev", - "dev:avet": "avet-bin dev --rootDir ./avet", - "build": "avet-bin build" + "dev:avet": "avet-bin dev --rootDir ./web", + "build": "avet-bin build --rootDir ./web" }, "dependencies": { - "avet": "^0.4.3", + "avet": "^1.0.0-9", "avet-define": "^0.1.2", - "avet-fetch": "^0.1.0", + "avet-fetch": "^0.2.2", "avet-preact": "^0.2.3", - "egg": "^1.10.0", - "egg-avet": "^1.1.0", - "egg-scripts": "^2.1.0" + "avet-proxy": "^1.0.0", + "egg": "^2.0.0", + "egg-avet": "^1.1.1", + "egg-scripts": "^2.4.0" }, "devDependencies": { - "egg-bin": "^4.3.5", - "avet-bin": "^0.5.1" + "egg-bin": "^4.3.6", + "avet-bin": "^1.0.0-9" }, "tnpm": { "mode": "npm" @@ -30,14 +31,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/egg/web/component/header.js b/examples/egg/web/component/header.js new file mode 100644 index 0000000..83b14bc --- /dev/null +++ b/examples/egg/web/component/header.js @@ -0,0 +1,9 @@ +import React from 'react'; + +const Header = () => ( +
+

this is a component.

+
+); + +export default Header; diff --git a/examples/egg/avet/config/config.default.js b/examples/egg/web/config/config.default.js similarity index 100% rename from examples/egg/avet/config/config.default.js rename to examples/egg/web/config/config.default.js diff --git a/examples/egg/web/config/config.local.js b/examples/egg/web/config/config.local.js new file mode 100644 index 0000000..76b5237 --- /dev/null +++ b/examples/egg/web/config/config.local.js @@ -0,0 +1,21 @@ +const path = require('path'); + +exports.build = { + webpackDevMiddleware: { + noInfo: true, + quiet: true, + }, +}; + +exports.avet = { + dir: path.join(process.cwd(), 'web'), +}; + +exports.define = { + API_HOST: 'http://127.0.0.1:7001', +}; + +exports.proxy = { + host: 'http://127.0.0.1:7001', + match: /^\/api\//, +}; diff --git a/examples/egg/web/config/plugin.js b/examples/egg/web/config/plugin.js new file mode 100644 index 0000000..f6055d3 --- /dev/null +++ b/examples/egg/web/config/plugin.js @@ -0,0 +1,19 @@ +exports.preact = { + enable: true, + package: 'avet-preact', +}; + +exports.fetch = { + enable: true, + package: 'avet-fetch', +}; + +exports.define = { + enable: true, + package: 'avet-define', +}; + +exports.proxy = { + enable: true, + package: 'avet-proxy', +}; diff --git a/examples/egg/avet/page/index.js b/examples/egg/web/page/index.js similarity index 70% rename from examples/egg/avet/page/index.js rename to examples/egg/web/page/index.js index 977b8e6..a88076b 100644 --- a/examples/egg/avet/page/index.js +++ b/examples/egg/web/page/index.js @@ -1,21 +1,22 @@ +import React from 'react'; import Header from '../component/header'; class IndexPage extends React.Component { static async getInitialProps() { const res = await fetch(`${API_HOST}/api/getHello`); - const hello = await res.text() - return { hello } + const hello = await res.text(); + return { hello }; } render() { return (
-
+

hello00

{this.props.hello}

- ) + ); } } -export default IndexPage; \ No newline at end of file +export default IndexPage; diff --git a/examples/ga/.eslintrc b/examples/ga/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/ga/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/ga/package.json b/examples/ga/package.json index 9476548..d200e83 100644 --- a/examples/ga/package.json +++ b/examples/ga/package.json @@ -1,5 +1,5 @@ { - "name": "ga", + "name": "avet-example-ga", "version": "1.0.0", "description": "ga example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.5.0", - "avet-ga": "^0.1.0" + "avet": "^1.0.0-9", + "avet-ga": "^0.1.4" }, "devDependencies": { - "avet-bin": "^0.7.0" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/i18n/.eslintrc b/examples/i18n/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/i18n/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/i18n/package.json b/examples/i18n/package.json index 1d17209..3ebd00e 100644 --- a/examples/i18n/package.json +++ b/examples/i18n/package.json @@ -1,5 +1,5 @@ { - "name": "i18n", + "name": "avet-example-i18n", "version": "1.0.0", "description": "i18n example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.4.3", + "avet": "^1.0.0-9", "avet-i18n": "^0.1.0" }, "devDependencies": { - "avet-bin": "^0.5.1" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/preact/.eslintrc b/examples/preact/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/preact/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/preact/package.json b/examples/preact/package.json index a1f9436..b54af38 100644 --- a/examples/preact/package.json +++ b/examples/preact/package.json @@ -1,5 +1,5 @@ { - "name": "preact", + "name": "avet-example-preact", "version": "1.0.0", "description": "preact example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.4.1", - "avet-preact": "^0.2.2" + "avet": "^1.0.0-9", + "avet-preact": "^0.2.3" }, "devDependencies": { - "avet-bin": "^0.4.1" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/pwa/.eslintrc b/examples/pwa/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/pwa/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/pwa/package.json b/examples/pwa/package.json index 5fb9a6f..7bc4cd2 100644 --- a/examples/pwa/package.json +++ b/examples/pwa/package.json @@ -1,5 +1,5 @@ { - "name": "basic", + "name": "avet-example-pwa", "version": "1.0.0", "description": "pwa example for avet", "scripts": { @@ -8,11 +8,14 @@ "start": "avet-bin start" }, "dependencies": { - "avet": "^0.4.1", + "avet": "^1.0.0-9", "avet-pwa": "^0.3.0" }, "devDependencies": { - "avet-bin": "^0.6.1" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -20,14 +23,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/simple/.eslintrc b/examples/simple/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/simple/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/simple/package.json b/examples/simple/package.json index d881bb7..1a21bac 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -1,16 +1,19 @@ { - "name": "simple", - "version": "1.0.0-3", + "name": "avet-example-simple", + "version": "1.0.0", "description": "simple example for avet", "scripts": { "dev": "avet-bin dev", "build": "avet-bin build" }, "dependencies": { - "avet": "^0.5.1" + "avet": "^1.0.0-9" }, "devDependencies": { - "avet-bin": "^0.7.4" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -18,14 +21,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" } diff --git a/examples/typescript/.eslintrc b/examples/typescript/.eslintrc new file mode 100644 index 0000000..cbacede --- /dev/null +++ b/examples/typescript/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-avet" +} diff --git a/examples/typescript/config/plugin.js b/examples/typescript/config/plugin.js index 337a978..5c0f1b8 100644 --- a/examples/typescript/config/plugin.js +++ b/examples/typescript/config/plugin.js @@ -1,6 +1,4 @@ -'use strict'; - exports.typescript = { enable: true, - package: 'avet-typescript' -} \ No newline at end of file + package: 'avet-typescript', +}; diff --git a/examples/typescript/package.json b/examples/typescript/package.json index 19af83b..5a5e8b0 100644 --- a/examples/typescript/package.json +++ b/examples/typescript/package.json @@ -1,5 +1,5 @@ { - "name": "typescript", + "name": "avet-example-typescript", "version": "1.0.0", "description": "typescript example for avet", "scripts": { @@ -7,13 +7,16 @@ "build": "avet-bin build" }, "dependencies": { - "avet": "^0.2.0", - "avet-typescript": "^0.2.0" + "avet": "^1.0.0-9", + "avet-typescript": "^0.3.0" }, "devDependencies": { "@types/react": "^16.0.18", "@types/react-dom": "^16.0.2", - "avet-bin": "^0.2.0" + "avet-bin": "^1.0.0-9", + "babel-eslint": "^8.0.2", + "eslint": "^4.9.0", + "eslint-config-avet": "^0.3.9" }, "tnpm": { "mode": "npm" @@ -21,14 +24,5 @@ "engines": { "node": ">= 8" }, - "repository": { - "type": "git", - "url": "https://github.com/avetjs/avet" - }, - "bugs": { - "url": "https://github.com/avetjs/avet/issues" - }, - "homepage": "http://avetjs.github.io/avet/", - "author": "okoala ", "license": "MIT" }