From fe98dd927de6906671dfd3aa9671080ab6a065c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 7 Oct 2017 06:58:50 +0900 Subject: [PATCH] :v: --- package.json | 3 ++- src/api/bot/core.ts | 6 ++++-- src/common/{get-post-summary.js => get-post-summary.ts} | 2 +- src/web/app/desktop/script.js | 2 +- src/web/app/desktop/tags/notifications.tag | 2 +- src/web/app/desktop/tags/pages/home.tag | 2 +- src/web/app/mobile/tags/notification-preview.tag | 2 +- src/web/app/mobile/tags/notification.tag | 2 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/page/home.tag | 2 +- src/web/app/mobile/tags/post-detail.tag | 2 +- src/web/app/mobile/tags/timeline.tag | 2 +- src/web/app/mobile/tags/user.tag | 2 +- webpack/module/rules/index.ts | 4 +++- webpack/module/rules/typescript.ts | 8 ++++++++ 15 files changed, 28 insertions(+), 15 deletions(-) rename src/common/{get-post-summary.js => get-post-summary.ts} (94%) create mode 100644 webpack/module/rules/typescript.ts diff --git a/package.json b/package.json index 0336725bd..6a9e7e26f 100644 --- a/package.json +++ b/package.json @@ -64,14 +64,15 @@ "@types/webpack": "3.0.13", "@types/webpack-stream": "3.2.7", "@types/websocket": "0.0.34", + "awesome-typescript-loader": "^3.2.3", "chai": "4.1.2", "chai-http": "3.0.0", "css-loader": "0.28.7", "event-stream": "3.3.4", "gulp": "3.9.1", "gulp-cssnano": "2.1.2", - "gulp-imagemin": "3.4.0", "gulp-htmlmin": "3.0.0", + "gulp-imagemin": "3.4.0", "gulp-mocha": "4.3.1", "gulp-pug": "3.3.0", "gulp-rename": "1.2.2", diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts index cf2bdef1d..57330e67e 100644 --- a/src/api/bot/core.ts +++ b/src/api/bot/core.ts @@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs'; import User, { IUser } from '../models/user'; -import getPostSummary from '../../common/get-post-summary.js'; +import getPostSummary from '../../common/get-post-summary'; export default class BotCore extends EventEmitter { public user: IUser = null; @@ -109,7 +109,9 @@ export default class BotCore extends EventEmitter { public async getTl() { if (this.user == null) return 'まずサインインしてください。'; - const tl = await require('../endpoints/posts/timeline')({}, this.user); + const tl = await require('../endpoints/posts/timeline')({ + limit: 5 + }, this.user); const text = tl .map(post => getPostSummary(post)) diff --git a/src/common/get-post-summary.js b/src/common/get-post-summary.ts similarity index 94% rename from src/common/get-post-summary.js rename to src/common/get-post-summary.ts index f7a481a16..f628a32b4 100644 --- a/src/common/get-post-summary.js +++ b/src/common/get-post-summary.ts @@ -2,7 +2,7 @@ * 投稿を表す文字列を取得します。 * @param {*} post 投稿 */ -const summarize = post => { +const summarize = (post: any): string => { let summary = post.text ? post.text : ''; // メディアが添付されているとき diff --git a/src/web/app/desktop/script.js b/src/web/app/desktop/script.js index e3dc8b7d9..46a7fce70 100644 --- a/src/web/app/desktop/script.js +++ b/src/web/app/desktop/script.js @@ -11,7 +11,7 @@ import * as riot from 'riot'; import init from '../init'; import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; -import getPostSummary from '../../../common/get-post-summary'; +import getPostSummary from '../../../common/get-post-summary.ts'; /** * init diff --git a/src/web/app/desktop/tags/notifications.tag b/src/web/app/desktop/tags/notifications.tag index 4747d1c0f..1046358ce 100644 --- a/src/web/app/desktop/tags/notifications.tag +++ b/src/web/app/desktop/tags/notifications.tag @@ -207,7 +207,7 @@ diff --git a/src/web/app/mobile/tags/notification.tag b/src/web/app/mobile/tags/notification.tag index 416493ee2..53222b9db 100644 --- a/src/web/app/mobile/tags/notification.tag +++ b/src/web/app/mobile/tags/notification.tag @@ -163,7 +163,7 @@ diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag index 9985b3351..7370aa84d 100644 --- a/src/web/app/mobile/tags/notifications.tag +++ b/src/web/app/mobile/tags/notifications.tag @@ -78,7 +78,7 @@