diff --git a/assets-with-webpack/.autod.conf.js b/assets-with-webpack/.autod.conf.js new file mode 100644 index 0000000..cd4bc15 --- /dev/null +++ b/assets-with-webpack/.autod.conf.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = { + write: true, + plugin: 'autod-egg', + prefix: '^', + devprefix: '^', + exclude: [ + 'test/fixtures', + 'coverage', + ], + dep: [ + 'egg', + 'egg-scripts', + ], + devdep: [ + 'autod', + 'autod-egg', + 'egg-bin', + 'tslib', + 'typescript', + ], + keep: [ + ], + semver: [ + ], + test: 'scripts', +}; diff --git a/assets-with-webpack/.babelrc b/assets-with-webpack/.babelrc new file mode 100644 index 0000000..9647cc5 --- /dev/null +++ b/assets-with-webpack/.babelrc @@ -0,0 +1,32 @@ +{ + "presets": [ + "@babel/preset-react", + ["@babel/preset-env", { + "targets": { + "chrome": "58", + "ie": "11" + }, + "useBuiltIns": "entry" + }] + ], + "plugins": [ + [ + "@babel/plugin-proposal-decorators", + { + "legacy": true + } + ], + "@babel/plugin-proposal-class-properties", + "react-hot-loader/babel", + "@babel/plugin-transform-runtime", + "@babel/plugin-syntax-dynamic-import", + [ + "import", + { + "libraryName": "antd", + "libraryDirectory": "es", + "style": "css" + } + ] + ] +} diff --git a/assets-with-webpack/.eslintrc.js b/assets-with-webpack/.eslintrc.js new file mode 100644 index 0000000..6d9c20c --- /dev/null +++ b/assets-with-webpack/.eslintrc.js @@ -0,0 +1,49 @@ +module.exports = { + extends: ['airbnb', 'prettier', 'prettier/react'], + parser: 'babel-eslint', + root: true, + env: { + browser: true, + es6: true + }, + plugins: ['react', 'import', 'prettier'], + rules: { + 'jsx-a11y/anchor-is-valid': [ + 'error', + { + components: ['Link'], + specialLink: ['to'] + } + ], // 允许正常使用 Link + 'jsx-a11y/interactive-supports-focus': 0, + 'jsx-a11y/click-events-have-key-events': 0, + 'no-static-element-interactions': 0, + 'react/jsx-filename-extension': [1, { + extensions: ['.js', '.jsx'] + }], //允许在 .js 后缀文件中写 jsx + 'react/destructuring-assignment': 0, // 不强制对 state props 使用解构赋值 + 'react/forbid-prop-types': 0, // 不禁止使用一些指定的 propTypes + 'react/no-multi-comp': 0, // 可以在一个文件里写多个 react component + 'prefer-destructuring': ['error', { + object: true, + array: false + }], // 不强制要求使用数组解构赋值 + 'no-console': 0, //可以 console + semi: 0, //禁止在语句末尾使用分号 + 'no-unused-expressions': 0, // 支持 func && func() 的写法 + 'no-param-reassign': 0, // 允许修改函数参数 + 'no-plusplus': ['error', { + allowForLoopAfterthoughts: true + }], //允许在循环中使用 i++ / i-- + 'comma-dangle': ['error', 'only-multiline'], // 对象的最后一个元素后不需要逗号 + 'import/extensions': ['off', 'never'], // import 的时候可以不带文件后缀 + 'import/no-unresolved': 0, //import 路径 + 'import/no-extraneous-dependencies': ['error', { + packageDir: './' + }], + 'prettier/prettier': ['error', { + singleQuote: true, + semi: false + }] + } +} diff --git a/assets-with-webpack/.gitignore b/assets-with-webpack/.gitignore new file mode 100644 index 0000000..ad575f4 --- /dev/null +++ b/assets-with-webpack/.gitignore @@ -0,0 +1,25 @@ +logs/ +npm-debug.log +node_modules/ +coverage/ +.idea/ +run/ +logs/ +.DS_Store +.vscode +*.swp +*.lock +*.js + +app/**/*.js +test/**/*.js +config/**/*.js +app/**/*.map +test/**/*.map +config/**/*.map +app/public/ + +!.autod.conf.js +!.eslintrc.js +!.prettierrc.js +!app/assets/**/*.js diff --git a/assets-with-webpack/.nyc_output/0477ab9a-7497-4188-adb1-34be4340450b.json b/assets-with-webpack/.nyc_output/0477ab9a-7497-4188-adb1-34be4340450b.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/assets-with-webpack/.nyc_output/0477ab9a-7497-4188-adb1-34be4340450b.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/assets-with-webpack/.prettierrc.js b/assets-with-webpack/.prettierrc.js new file mode 100644 index 0000000..eba0554 --- /dev/null +++ b/assets-with-webpack/.prettierrc.js @@ -0,0 +1,4 @@ +module.exports = { + singleQuote: true, + semi: false +} diff --git a/assets-with-webpack/.travis.yml b/assets-with-webpack/.travis.yml new file mode 100644 index 0000000..b735efc --- /dev/null +++ b/assets-with-webpack/.travis.yml @@ -0,0 +1,10 @@ +sudo: false +language: node_js +node_js: + - '8' +install: + - npm i npminstall && npminstall +script: + - npm run ci +after_script: + - npminstall codecov && codecov diff --git a/assets-with-webpack/README.md b/assets-with-webpack/README.md new file mode 100644 index 0000000..2846554 --- /dev/null +++ b/assets-with-webpack/README.md @@ -0,0 +1,31 @@ +# 基于egg + react 的全栈模板 +使用 egg-view-assets 插件,整合的 egg + react + webpack前端构建的全栈模板 + +## QuickStart + +### 开发 + +```bash +$ npm i +$ npm run dev +$ open http://localhost:7001/ +``` + +### 部署 + +```bash +$ npm run build - 静态资源构建打包 +$ npm run tsc - ts编译 +$ npm start - 服务器启动 +``` + +### 相关命令 + +- Use `npm run lint` to check code style +- Use `npm test` to run unit test +- se `npm run clean` to clean compiled js at development mode once + +### 要求 + +- Node.js 8.x +- Typescript 2.8+ diff --git a/assets-with-webpack/app/assets/App.jsx b/assets-with-webpack/app/assets/App.jsx new file mode 100644 index 0000000..7d6a4a2 --- /dev/null +++ b/assets-with-webpack/app/assets/App.jsx @@ -0,0 +1,10 @@ +import React from 'react' + +const App = () => ( +
+

Hello world

+

这是一个 egg + react 的全栈应用,前端基于webpack构建

+
+) + +export default App diff --git a/assets-with-webpack/app/assets/index.html b/assets-with-webpack/app/assets/index.html new file mode 100644 index 0000000..d7ae36b --- /dev/null +++ b/assets-with-webpack/app/assets/index.html @@ -0,0 +1,88 @@ + + + + + + + + Hello world + + + + +
+
+
+
+
+ {% if Env == 'local' %} + {{ helper.assets.getScript('app.js') | safe }} + {% else %} + {{ helper.assets.getScript('app.js') | safe }} + {{ helper.assets.getScript('vendors.js') | safe }} + {{ helper.assets.getScript('manifest.js') | safe }} + {% endif %} + + + diff --git a/assets-with-webpack/app/assets/index.js b/assets-with-webpack/app/assets/index.js new file mode 100644 index 0000000..2082fe7 --- /dev/null +++ b/assets-with-webpack/app/assets/index.js @@ -0,0 +1,6 @@ +import React from 'react' +import ReactDom from 'react-dom' + +import App from './App.jsx' + +ReactDom.render(, document.getElementById('app')) diff --git a/assets-with-webpack/app/controller/home.ts b/assets-with-webpack/app/controller/home.ts new file mode 100644 index 0000000..3231a2d --- /dev/null +++ b/assets-with-webpack/app/controller/home.ts @@ -0,0 +1,16 @@ +import { Controller } from 'egg'; +import manifestMap from '../../config/manifest.json'; + +export default class HomeController extends Controller { + async index() { + const { ctx } = this; + await ctx.render('index.html', { + Env: ctx.app.env, + ManifestMap: manifestMap, + }); + } + + async hello() { + this.ctx.response.body = 'hi'; + } +} diff --git a/assets-with-webpack/app/router.ts b/assets-with-webpack/app/router.ts new file mode 100644 index 0000000..3b4719b --- /dev/null +++ b/assets-with-webpack/app/router.ts @@ -0,0 +1,8 @@ +import { Application } from 'egg'; + +export default (app: Application) => { + const { controller, router } = app; + + router.get('/', controller.home.index); + router.get('/hi', controller.home.hello); +}; diff --git a/assets-with-webpack/app/service/Test.ts b/assets-with-webpack/app/service/Test.ts new file mode 100644 index 0000000..3290925 --- /dev/null +++ b/assets-with-webpack/app/service/Test.ts @@ -0,0 +1,15 @@ +import { Service } from 'egg'; + +/** + * Test Service + */ +export default class Test extends Service { + + /** + * sayHi to you + * @param name - your name + */ + public async sayHi(name: string) { + return `hi, ${name}`; + } +} diff --git a/assets-with-webpack/appveyor.yml b/assets-with-webpack/appveyor.yml new file mode 100644 index 0000000..c274b7d --- /dev/null +++ b/assets-with-webpack/appveyor.yml @@ -0,0 +1,14 @@ +environment: + matrix: + - nodejs_version: '8' + +install: + - ps: Install-Product node $env:nodejs_version + - npm i npminstall && node_modules\.bin\npminstall + +test_script: + - node --version + - npm --version + - npm run test + +build: off diff --git a/assets-with-webpack/config/config.default.ts b/assets-with-webpack/config/config.default.ts new file mode 100644 index 0000000..195f73e --- /dev/null +++ b/assets-with-webpack/config/config.default.ts @@ -0,0 +1,56 @@ +import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'; +import * as path from 'path'; + +export default (appInfo: EggAppInfo) => { + const config = {} as PowerPartial; + + // override config from framework / plugin + // use for cookie sign key, should change to your own and keep security + config.keys = appInfo.name + '_1544867050896_3341'; + + // add your egg config in here + config.middleware = []; + + config.view = { + root: path.join(appInfo.baseDir, 'app/assets'), + mapping: { + '.html': 'assets', + }, + }; + + config.assets = { + publicPath: '/public/', + templatePath: path.join(appInfo.baseDir, 'app/assets/index.html'), + templateViewEngine: 'nunjucks', + devServer: { + debug: false, + command: 'webpack-dev-server --config config/webpack.dev.ts --mode development --color --progress --hot', + port: 8888, + env: { + PUBLIC_PATH: 'http://127.0.0.1:8888', + }, + }, + }; + + config.cluster = { + listen: { + port: 7001, + hostname: '127.0.0.1', + }, + }; + + config.security = { + csrf: false, + }; + + // add your special config in here + const bizConfig = { + sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`, + }; + + // the return config will combines to EggAppConfig + return { + ...config, + ...bizConfig, + }; +}; diff --git a/assets-with-webpack/config/config.local.ts b/assets-with-webpack/config/config.local.ts new file mode 100644 index 0000000..56415ce --- /dev/null +++ b/assets-with-webpack/config/config.local.ts @@ -0,0 +1,6 @@ +import { EggAppConfig, PowerPartial } from 'egg'; + +export default () => { + const config: PowerPartial = {}; + return config; +}; diff --git a/assets-with-webpack/config/config.prod.ts b/assets-with-webpack/config/config.prod.ts new file mode 100644 index 0000000..2bfb2e7 --- /dev/null +++ b/assets-with-webpack/config/config.prod.ts @@ -0,0 +1,7 @@ +import { EggAppConfig, PowerPartial } from 'egg'; + +export default () => { + const config: PowerPartial = {}; + + return config; +}; diff --git a/assets-with-webpack/config/manifest.json b/assets-with-webpack/config/manifest.json new file mode 100644 index 0000000..bfd6316 --- /dev/null +++ b/assets-with-webpack/config/manifest.json @@ -0,0 +1,9 @@ +{ + "app.js": "app.ca963a2d2c3f55d5c0f2.js", + "app.js.map": "app.ca963a2d2c3f55d5c0f2.js.map", + "manifest.js": "manifest.c8c1373b58e6a27ad464.js", + "manifest.js.map": "manifest.c8c1373b58e6a27ad464.js.map", + "vendors.js": "vendors.d400aeeb318460e944a6.js", + "vendors.js.map": "vendors.d400aeeb318460e944a6.js.map", + "index.html": "index.html" +} \ No newline at end of file diff --git a/assets-with-webpack/config/plugin.ts b/assets-with-webpack/config/plugin.ts new file mode 100644 index 0000000..653b5bd --- /dev/null +++ b/assets-with-webpack/config/plugin.ts @@ -0,0 +1,14 @@ +import { EggPlugin } from 'egg'; + +const plugin: EggPlugin = { + assets: { + enable: true, + package: 'egg-view-assets', + }, + nunjucks: { + enable: true, + package: 'egg-view-nunjucks', + }, +}; + +export default plugin; diff --git a/assets-with-webpack/config/webpack.base.ts b/assets-with-webpack/config/webpack.base.ts new file mode 100644 index 0000000..e503cac --- /dev/null +++ b/assets-with-webpack/config/webpack.base.ts @@ -0,0 +1,67 @@ +import HtmlWebpackPlugin from 'html-webpack-plugin'; +import path from 'path'; +import webpack from 'webpack'; +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; + +const commonConfig = { + entry: { + app: [path.join(__dirname, '../app/assets/index.js')], + }, + module: { + rules: [ + { + test: /\.jsx?$/, + use: ['babel-loader?cacheDirectory=true', 'eslint-loader'], + include: path.join(__dirname, '../app/assets'), + }, + { + test: /\.less/, + use: [ + 'style-loader', + 'css-loader', + { + loader: 'less-loader', + }, + ], + }, + { + test: /\.(png|jpg|gif|svg)$/, + use: [ + { + loader: 'url-loader', + options: { + limit: 8192, + }, + }, + ], + }, + ], + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NO_INTL: JSON.stringify(process.env.npm_config_nointl ? '1' : '0'), + }, + }), + + new HtmlWebpackPlugin({ + filename: 'index.html', + template: path.join(__dirname, '../app/assets/index.html'), + minify: { + collapseWhitespace: true, + removeComments: true, + removeRedundantAttributes: true, + removeScriptTypeAttributes: true, + removeStyleLinkTypeAttributes: true, + useShortDoctype: true, + }, + }), + new webpack.HashedModuleIdsPlugin(), + ], +}; + +if (process.env.npm_config_report) { + commonConfig.plugins.push(new BundleAnalyzerPlugin()); +} + +export default commonConfig; diff --git a/assets-with-webpack/config/webpack.dev.ts b/assets-with-webpack/config/webpack.dev.ts new file mode 100644 index 0000000..5bdc137 --- /dev/null +++ b/assets-with-webpack/config/webpack.dev.ts @@ -0,0 +1,50 @@ +import path from 'path'; +import webpack from 'webpack'; +import merge from 'webpack-merge'; +import commonConfig from './webpack.base'; + +const devConfig = { + devtool: 'inline-source-map', + entry: { + app: [ + 'react-hot-loader/patch', + path.join(__dirname, '../app/assets/index.js'), + ], + }, + + output: { + filename: '[name].js', + }, + + module: { + rules: [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'], + }, + ], + }, + + devServer: { + port: 8888, + contentBase: path.join(__dirname, '../public'), + historyApiFallback: true, + host: 'localhost', + disableHostCheck: true, + }, + + plugins: [ + new webpack.DefinePlugin({ + MOCK: false, + }), + ], +}; + +module.exports = merge({ + customizeArray(_, b, key) { + if (key === 'entry.app') { + return b; + } + return undefined; + }, +})(commonConfig, devConfig); diff --git a/assets-with-webpack/config/webpack.prod.ts b/assets-with-webpack/config/webpack.prod.ts new file mode 100644 index 0000000..4959959 --- /dev/null +++ b/assets-with-webpack/config/webpack.prod.ts @@ -0,0 +1,75 @@ +import CleanWebpackPlugin from 'clean-webpack-plugin'; +import MiniCssExtractPlugin from 'mini-css-extract-plugin'; +import path from 'path'; +import UglifyJsPlugin from 'uglifyjs-webpack-plugin'; +import webpack from 'webpack'; +import ManifestPlugin from 'webpack-manifest-plugin'; +import merge from 'webpack-merge'; + +import commonConfig from './webpack.base'; + +const publicConfig = { + devtool: 'cheap-module-source-map', + mode: 'production', + output: { + path: path.join(__dirname, '../app/public/'), + filename: '[name].[chunkhash].js', + chunkFilename: '[name].[contenthash].js', + publicPath: '/', + }, + module: { + rules: [ + { + test: /\.css$/, + use: [MiniCssExtractPlugin.loader, 'css-loader'], + }, + ], + }, + optimization: { + minimizer: [ + new UglifyJsPlugin({ + cache: true, + parallel: true, + sourceMap: true, // set to true if you want JS source maps + }), + ], + namedModules: true, + namedChunks: true, + runtimeChunk: { + name: 'manifest', + }, + splitChunks: { + cacheGroups: { + vendors: { + name: 'vendors', + test: /node_modules/, + chunks: 'all', + }, + }, + }, + }, + + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify('production'), + }, + }), + + new CleanWebpackPlugin(['public/*.*'], { + root: path.join(__dirname, '../'), + }), + + new MiniCssExtractPlugin({ + filename: '[name].[hash].css', + chunkFilename: '[id].[hash].css', + }), + + new ManifestPlugin({ + fileName: path.resolve(__dirname, '../config/manifest.json'), + publicPath: '', + }), + ], +}; + +module.exports = merge(commonConfig, publicConfig); diff --git a/assets-with-webpack/package.json b/assets-with-webpack/package.json new file mode 100644 index 0000000..c0dc463 --- /dev/null +++ b/assets-with-webpack/package.json @@ -0,0 +1,101 @@ +{ + "name": "egg-react-demo", + "version": "1.0.0", + "description": "egg+react全栈模板", + "private": true, + "egg": { + "typescript": true + }, + "scripts": { + "start": "egg-scripts start --daemon --title=egg-server-egg-react-demo", + "stop": "egg-scripts stop --title=egg-server-egg-react-demo", + "dev": "egg-bin dev -r egg-ts-helper/register", + "debug": "egg-bin debug -r egg-ts-helper/register", + "test-local": "egg-bin test -r egg-ts-helper/register", + "test": "npm run lint -- --fix && npm run test-local", + "cov": "egg-bin cov -r egg-ts-helper/register", + "tsc": "ets && tsc -p tsconfig.json", + "ci": "npm run lint && npm run cov && npm run tsc", + "autod": "autod", + "lint": "tslint --project . -c tslint.json", + "clean": "ets clean", + "build": "webpack --config config/webpack.prod.ts" + }, + "dependencies": { + "egg": "^2.6.1", + "egg-scripts": "^2.6.0", + "egg-view-assets": "^1.4.0", + "egg-view-nunjucks": "^2.2.0", + "react-dom": "^16.4.2", + "react": "^16.4.2", + "react-intl-universal": "^1.12.2", + "react-loadable": "^5.5.0", + "react-router-dom": "^4.3.1", + "react-hot-loader": "^4.3.5" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-decorators": "^7.1.2", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@babel/preset-react": "^7.0.0", + "@babel/runtime": "^7.1.2", + "@types/mocha": "^2.2.40", + "@types/node": "^7.0.12", + "@types/supertest": "^2.0.0", + "style-loader": "^0.23.0", + "url-loader": "^1.1.2", + "css-loader": "^1.0.0", + "file-loader": "^3.0.1", + "autod": "^3.0.1", + "autod-egg": "^1.1.0", + "babel-eslint": "^9.0.0", + "babel-loader": "^8.0.4", + "babel-plugin-import": "^1.8.0", + "babel-preset-react": "^6.24.1", + "bundle-loader": "^0.5.6", + "clean-webpack-plugin": "^0.1.19", + "egg-bin": "^4.6.2", + "egg-ci": "^1.8.0", + "egg-mock": "^3.16.0", + "egg-ts-helper": "^1.11.0", + "eslint": "^5.5.0", + "eslint-config-airbnb": "^17.1.0", + "eslint-config-prettier": "^3.0.1", + "eslint-loader": "^2.1.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-jsx-a11y": "^6.1.1", + "eslint-plugin-prettier": "^2.6.2", + "eslint-plugin-react": "^7.11.1", + "html-webpack-plugin": "^3.2.0", + "mini-css-extract-plugin": "^0.4.0", + "prettier": "^1.14.2", + "tslib": "^1.9.0", + "tslint": "^4.0.0", + "typescript": "^3.0.0", + "uglifyjs-webpack-plugin": "^1.2.7", + "webpack": "^4.28.3", + "webpack-bundle-analyzer": "^2.13.1", + "webpack-cli": "^3.1.0", + "webpack-dev-server": "^3.1.7", + "webpack-manifest-plugin": "^2.0.4", + "webpack-merge": "^4.1.4" + }, + "engines": { + "node": ">=8.9.0" + }, + "ci": { + "version": "8" + }, + "repository": { + "type": "git", + "url": "" + }, + "eslintIgnore": [ + "coverage" + ], + "author": "jiarui.liang@hobot.cc", + "license": "MIT" +} diff --git a/assets-with-webpack/tsconfig.json b/assets-with-webpack/tsconfig.json new file mode 100644 index 0000000..4011328 --- /dev/null +++ b/assets-with-webpack/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compileOnSave": true, + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "strict": true, + "noImplicitAny": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "charset": "utf8", + "allowJs": false, + "pretty": true, + "noEmitOnError": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "strictPropertyInitialization": false, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "inlineSourceMap": true, + "importHelpers": true, + "esModuleInterop": true, + "resolveJsonModule": true + }, + "exclude": [ + "app/public", + "app/views", + "node_modules*" + ] +} diff --git a/assets-with-webpack/tslint.json b/assets-with-webpack/tslint.json new file mode 100644 index 0000000..73221c9 --- /dev/null +++ b/assets-with-webpack/tslint.json @@ -0,0 +1,43 @@ +{ + "extends": "tslint:latest", + "rules": { + "quotemark": [ + true, + "single", + "jsx-double" + ], + "no-console": [ + true, + "dir", + "log", + "error", + "warn" + ], + "space-before-function-paren": false, + "interface-name": [ + true, + "never-prefix" + ], + "adjacent-overload-signatures": true, + "member-access": [ + false + ], + "member-ordering": [ + true, + { + "order": "fields-first" + } + ], + "object-literal-sort-keys": false, + "max-classes-per-file": [ + true, + 10 + ], + "variable-name": [ + true, + "allow-leading-underscore" + ], + "align": [true, "statements"] + } +} + diff --git a/assets-with-webpack/typings/app/controller/index.d.ts b/assets-with-webpack/typings/app/controller/index.d.ts new file mode 100644 index 0000000..400b113 --- /dev/null +++ b/assets-with-webpack/typings/app/controller/index.d.ts @@ -0,0 +1,11 @@ +// This file is created by egg-ts-helper +// Do not modify this file!!!!!!!!! + +import 'egg'; +import ExportHome from '../../../app/controller/home'; + +declare module 'egg' { + interface IController { + home: ExportHome; + } +} diff --git a/assets-with-webpack/typings/app/service/index.d.ts b/assets-with-webpack/typings/app/service/index.d.ts new file mode 100644 index 0000000..78e223d --- /dev/null +++ b/assets-with-webpack/typings/app/service/index.d.ts @@ -0,0 +1,11 @@ +// This file is created by egg-ts-helper +// Do not modify this file!!!!!!!!! + +import 'egg'; +import ExportTest from '../../../app/service/Test'; + +declare module 'egg' { + interface IService { + test: ExportTest; + } +} diff --git a/assets-with-webpack/typings/config/index.d.ts b/assets-with-webpack/typings/config/index.d.ts new file mode 100644 index 0000000..80230ff --- /dev/null +++ b/assets-with-webpack/typings/config/index.d.ts @@ -0,0 +1,11 @@ +// This file is created by egg-ts-helper +// Do not modify this file!!!!!!!!! + +import 'egg'; +import { EggAppConfig } from 'egg'; +import ExportConfigDefault from '../../config/config.default'; +type ConfigDefault = ReturnType; +declare module 'egg' { + type NewEggAppConfig = ConfigDefault; + interface EggAppConfig extends NewEggAppConfig { } +} \ No newline at end of file diff --git a/assets-with-webpack/typings/config/plugin.d.ts b/assets-with-webpack/typings/config/plugin.d.ts new file mode 100644 index 0000000..015463a --- /dev/null +++ b/assets-with-webpack/typings/config/plugin.d.ts @@ -0,0 +1,6 @@ +// This file is created by egg-ts-helper +// Do not modify this file!!!!!!!!! + +import 'egg'; +import 'egg-view-assets'; +import 'egg-view-nunjucks'; \ No newline at end of file diff --git a/assets-with-webpack/typings/index.d.ts b/assets-with-webpack/typings/index.d.ts new file mode 100644 index 0000000..c81035a --- /dev/null +++ b/assets-with-webpack/typings/index.d.ts @@ -0,0 +1,5 @@ +import 'egg'; + +declare module 'egg' { + +} \ No newline at end of file