-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update to new egg-bin #63
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5be0add
feat: update to new egg-bin
atian25 d32144e
feat: update to new egg-bin
atian25 335c7e1
Merge branch 'ts' of github.com:eggjs/examples into ts
atian25 855aec9
feat: new egg-bin with pkg conf
atian25 aa318fd
feat: change to returnType
whxaxes a468bab
feat: remove source map support
whxaxes 1caffa1
feat: add more config demo
whxaxes 2ca8ba8
refactor: remove eslint
whxaxes fc5c182
f
atian25 f223092
chore: add comment
whxaxes c2d8047
refactor: remove useless code
whxaxes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,19 @@ | ||
logs/ | ||
npm-debug.log | ||
node_modules/ | ||
coverage/ | ||
.idea/ | ||
run/ | ||
logs/ | ||
.DS_Store | ||
.vscode | ||
*.swp | ||
*.lock | ||
*.js | ||
|
||
app/**/*.js | ||
test/**/*.js | ||
config/**/*.js | ||
*.map | ||
run | ||
logs | ||
|
||
# Created by https://www.gitignore.io/api/node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
|
||
# End of https://www.gitignore.io/api/node | ||
app/**/*.map | ||
test/**/*.map | ||
config/**/*.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
{ | ||
"files.exclude": { | ||
"USE_GITIGNORE": true, | ||
"**/*.js": { | ||
"when": "$(basename).ts" | ||
}, | ||
"**/*.map": true, | ||
"run": true, | ||
"logs": true, | ||
"out": true, | ||
"node_modules": true | ||
} | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { Application } from 'egg'; | ||
|
||
export default (app: Application) => { | ||
const controller = app.controller; | ||
app.redirect('/', '/news'); | ||
app.router.get('/news', controller.news.list); | ||
app.router.get('/news/item/:id', controller.news.detail); | ||
app.router.get('/news/user/:id', controller.news.user); | ||
const { controller, router } = app; | ||
|
||
// router.redirect('/', '/news'); | ||
router.get('/news', controller.news.list); | ||
router.get('/news/item/:id', controller.news.detail); | ||
router.get('/news/user/:id', controller.news.user); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
import { EggAppConfig } from 'egg'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
export default (appInfo: EggAppConfig) => { | ||
return { | ||
keys: appInfo.name + '123456', | ||
siteFile: { | ||
'/favicon.ico': fs.readFileSync( | ||
path.join(appInfo.baseDir, 'app/public/favicon.png'), | ||
), | ||
}, | ||
view: { | ||
defaultViewEngine: 'nunjucks', | ||
mapping: { | ||
'.tpl': 'nunjucks', | ||
}, | ||
}, | ||
news: { | ||
/** | ||
* page size | ||
*/ | ||
pageSize: 30, | ||
|
||
/** | ||
* hacker news server url | ||
*/ | ||
serverUrl: 'https://hacker-news.firebaseio.com/v0', | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const info = { | ||
msg: 'hello', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
info: { | ||
msg: 'hello', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { EggAppConfig } from 'egg'; | ||
import defaultConfig from './config.default'; | ||
import * as localConfig from './config.local'; | ||
import prodConfig from './config.prod'; | ||
|
||
type DefaultConfig = ReturnType<typeof defaultConfig>; | ||
type LocalConfig = typeof localConfig; | ||
type ProdConfig = typeof prodConfig; | ||
type NewAppConfig = EggAppConfig & DefaultConfig & LocalConfig & ProdConfig; | ||
|
||
declare module 'egg' { | ||
interface Application { | ||
config: NewAppConfig; | ||
} | ||
|
||
interface Controller { | ||
config: NewAppConfig; | ||
} | ||
|
||
interface Service { | ||
config: NewAppConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EggAppInfo 的那个改改,这里不对