This commit is contained in:
syuilo 2017-10-07 06:58:50 +09:00
parent 63f93af922
commit 12e5e9fe44
15 changed files with 28 additions and 15 deletions

View File

@ -64,14 +64,15 @@
"@types/webpack": "3.0.13", "@types/webpack": "3.0.13",
"@types/webpack-stream": "3.2.7", "@types/webpack-stream": "3.2.7",
"@types/websocket": "0.0.34", "@types/websocket": "0.0.34",
"awesome-typescript-loader": "^3.2.3",
"chai": "4.1.2", "chai": "4.1.2",
"chai-http": "3.0.0", "chai-http": "3.0.0",
"css-loader": "0.28.7", "css-loader": "0.28.7",
"event-stream": "3.3.4", "event-stream": "3.3.4",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-cssnano": "2.1.2", "gulp-cssnano": "2.1.2",
"gulp-imagemin": "3.4.0",
"gulp-htmlmin": "3.0.0", "gulp-htmlmin": "3.0.0",
"gulp-imagemin": "3.4.0",
"gulp-mocha": "4.3.1", "gulp-mocha": "4.3.1",
"gulp-pug": "3.3.0", "gulp-pug": "3.3.0",
"gulp-rename": "1.2.2", "gulp-rename": "1.2.2",

View File

@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs';
import User, { IUser } from '../models/user'; 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 { export default class BotCore extends EventEmitter {
public user: IUser = null; public user: IUser = null;
@ -109,7 +109,9 @@ export default class BotCore extends EventEmitter {
public async getTl() { public async getTl() {
if (this.user == null) return 'まずサインインしてください。'; 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 const text = tl
.map(post => getPostSummary(post)) .map(post => getPostSummary(post))

View File

@ -2,7 +2,7 @@
* 稿 * 稿
* @param {*} post 稿 * @param {*} post 稿
*/ */
const summarize = post => { const summarize = (post: any): string => {
let summary = post.text ? post.text : ''; let summary = post.text ? post.text : '';
// メディアが添付されているとき // メディアが添付されているとき

View File

@ -11,7 +11,7 @@ import * as riot from 'riot';
import init from '../init'; import init from '../init';
import route from './router'; import route from './router';
import fuckAdBlock from './scripts/fuck-ad-block'; import fuckAdBlock from './scripts/fuck-ad-block';
import getPostSummary from '../../../common/get-post-summary'; import getPostSummary from '../../../common/get-post-summary.ts';
/** /**
* init * init

View File

@ -207,7 +207,7 @@
</style> </style>
<script> <script>
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
this.getPostSummary = getPostSummary; this.getPostSummary = getPostSummary;
this.mixin('i'); this.mixin('i');

View File

@ -8,7 +8,7 @@
</style> </style>
<script> <script>
import Progress from '../../../common/scripts/loading'; import Progress from '../../../common/scripts/loading';
import getPostSummary from '../../../../../common/get-post-summary'; import getPostSummary from '../../../../../common/get-post-summary.ts';
this.mixin('i'); this.mixin('i');
this.mixin('api'); this.mixin('api');

View File

@ -110,7 +110,7 @@
</style> </style>
<script> <script>
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
this.getPostSummary = getPostSummary; this.getPostSummary = getPostSummary;
this.notification = this.opts.notification; this.notification = this.opts.notification;
</script> </script>

View File

@ -163,7 +163,7 @@
</style> </style>
<script> <script>
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
this.getPostSummary = getPostSummary; this.getPostSummary = getPostSummary;
this.notification = this.opts.notification; this.notification = this.opts.notification;
</script> </script>

View File

@ -78,7 +78,7 @@
</style> </style>
<script> <script>
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
this.getPostSummary = getPostSummary; this.getPostSummary = getPostSummary;
this.mixin('api'); this.mixin('api');

View File

@ -9,7 +9,7 @@
<script> <script>
import ui from '../../scripts/ui-event'; import ui from '../../scripts/ui-event';
import Progress from '../../../common/scripts/loading'; import Progress from '../../../common/scripts/loading';
import getPostSummary from '../../../../../common/get-post-summary'; import getPostSummary from '../../../../../common/get-post-summary.ts';
import openPostForm from '../../scripts/open-post-form'; import openPostForm from '../../scripts/open-post-form';
this.mixin('i'); this.mixin('i');

View File

@ -264,7 +264,7 @@
</style> </style>
<script> <script>
import compile from '../../common/scripts/text-compiler'; import compile from '../../common/scripts/text-compiler';
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
import openPostForm from '../scripts/open-post-form'; import openPostForm from '../scripts/open-post-form';
this.mixin('api'); this.mixin('api');

View File

@ -464,7 +464,7 @@
</style> </style>
<script> <script>
import compile from '../../common/scripts/text-compiler'; import compile from '../../common/scripts/text-compiler';
import getPostSummary from '../../../../common/get-post-summary'; import getPostSummary from '../../../../common/get-post-summary.ts';
import openPostForm from '../scripts/open-post-form'; import openPostForm from '../scripts/open-post-form';
this.mixin('api'); this.mixin('api');

View File

@ -428,7 +428,7 @@
</style> </style>
<script> <script>
import summary from '../../../../common/get-post-summary'; import summary from '../../../../common/get-post-summary.ts';
this.post = this.opts.post; this.post = this.opts.post;
this.text = summary(this.post); this.text = summary(this.post);

View File

@ -2,10 +2,12 @@ import i18n from './i18n';
import themeColor from './theme-color'; import themeColor from './theme-color';
import tag from './tag'; import tag from './tag';
import stylus from './stylus'; import stylus from './stylus';
import typescript from './typescript';
export default (lang, locale) => [ export default (lang, locale) => [
i18n(lang, locale), i18n(lang, locale),
themeColor(), themeColor(),
tag(), tag(),
stylus() stylus(),
typescript()
]; ];

View File

@ -0,0 +1,8 @@
/**
* TypeScript
*/
export default () => ({
test: /\.ts$/,
use: 'awesome-typescript-loader'
});