From 3feeaccf5955ebf17c26ccc06f32bb39624b89f6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Sep 2017 04:13:01 +0900 Subject: Add type definition --- src/utils/type.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/utils/type.ts (limited to 'src/utils') diff --git a/src/utils/type.ts b/src/utils/type.ts new file mode 100644 index 0000000000..ba6ea0be77 --- /dev/null +++ b/src/utils/type.ts @@ -0,0 +1,3 @@ +// https://github.com/Microsoft/TypeScript/issues/12215 +export type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; +export type Omit = { [P in Diff]: T[P] }; -- cgit v1.2.3-freya From 7940c0901d4acff93169f62f4b80d58b287ca48e Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 6 Nov 2017 19:59:14 +0900 Subject: :v: --- gulpfile.ts | 4 ++-- package.json | 3 --- src/index.ts | 2 +- src/utils/cli/progressbar.ts | 2 +- src/utils/logger.ts | 4 ++-- 5 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/utils') diff --git a/gulpfile.ts b/gulpfile.ts index 4ee5fbce0e..448b6b7fef 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -13,7 +13,7 @@ import cssnano = require('gulp-cssnano'); import * as uglifyComposer from 'gulp-uglify/composer'; import pug = require('gulp-pug'); import * as rimraf from 'rimraf'; -import * as chalk from 'chalk'; +import chalk from 'chalk'; import imagemin = require('gulp-imagemin'); import * as rename from 'gulp-rename'; import * as mocha from 'gulp-mocha'; @@ -123,7 +123,7 @@ gulp.task('build:client:script', () => .pipe(replace('VERSION', JSON.stringify(version))) .pipe(isProduction ? uglify({ toplevel: true - }) : gutil.noop()) + } as any) : gutil.noop()) .pipe(gulp.dest('./built/web/assets/')) as any ); diff --git a/package.json b/package.json index da5badc94d..606ce9f0f0 100644 --- a/package.json +++ b/package.json @@ -60,8 +60,6 @@ "@types/riot": "3.6.1", "@types/serve-favicon": "2.2.29", "@types/uuid": "3.4.3", - "@types/webpack": "3.0.14", - "@types/uuid": "3.4.3", "@types/webpack": "3.0.13", "@types/webpack-stream": "3.2.8", "@types/websocket": "0.0.34", @@ -91,7 +89,6 @@ "swagger-jsdoc": "1.9.7", "tslint": "5.8.0", "uglify-es": "3.0.27", - "uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony", "uglifyjs-webpack-plugin": "1.0.1", "webpack": "3.8.1" }, diff --git a/src/index.ts b/src/index.ts index aa53c91239..218455d6f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as cluster from 'cluster'; import * as debug from 'debug'; -import * as chalk from 'chalk'; +import chalk from 'chalk'; // import portUsed = require('tcp-port-used'); import isRoot = require('is-root'); import { master } from 'accesses'; diff --git a/src/utils/cli/progressbar.ts b/src/utils/cli/progressbar.ts index 4afb4b0904..72496fdedc 100644 --- a/src/utils/cli/progressbar.ts +++ b/src/utils/cli/progressbar.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'events'; import * as readline from 'readline'; -import * as chalk from 'chalk'; +import chalk from 'chalk'; /** * Progress bar diff --git a/src/utils/logger.ts b/src/utils/logger.ts index ecfacbc952..fae1042c39 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,8 +1,8 @@ -import * as chalk from 'chalk'; +import chalk, { Chalk } from 'chalk'; export type LogLevel = 'Error' | 'Warn' | 'Info'; -function toLevelColor(level: LogLevel): chalk.ChalkStyle { +function toLevelColor(level: LogLevel): Chalk { switch (level) { case 'Error': return chalk.red; case 'Warn': return chalk.yellow; -- cgit v1.2.3-freya From 37edacce44cb7d63c35fee88e0b43028a1c7765c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 9 Dec 2017 22:35:26 +0900 Subject: Use ImageMagick instead of GraphicsMagick --- docs/setup.en.md | 2 +- docs/setup.ja.md | 2 +- src/api/common/add-file-to-drive.ts | 6 +++++- src/file/server.ts | 7 ++++++- src/utils/dependencyInfo.ts | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/utils') diff --git a/docs/setup.en.md b/docs/setup.en.md index 9c31e4f177..b81245d892 100644 --- a/docs/setup.en.md +++ b/docs/setup.en.md @@ -53,7 +53,7 @@ Please install and setup these softwares: * *Node.js* and *npm* * **[MongoDB](https://www.mongodb.com/)** * **[Redis](https://redis.io/)** -* **[GraphicsMagick](http://www.graphicsmagick.org/)** +* **[ImageMagick](http://www.imagemagick.org/script/index.php)** ##### Optional * [Elasticsearch](https://www.elastic.co/) - used to provide searching feature instead of MongoDB diff --git a/docs/setup.ja.md b/docs/setup.ja.md index 1e8bb553fa..1662d1ee5a 100644 --- a/docs/setup.ja.md +++ b/docs/setup.ja.md @@ -54,7 +54,7 @@ web-push generate-vapid-keys * *Node.js* と *npm* * **[MongoDB](https://www.mongodb.com/)** * **[Redis](https://redis.io/)** -* **[GraphicsMagick](http://www.graphicsmagick.org/)** +* **[ImageMagick](http://www.imagemagick.org/script/index.php)** ##### オプション * [Elasticsearch](https://www.elastic.co/) - 検索機能を向上させるために用います。 diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts index dea02eeca6..109e886106 100644 --- a/src/api/common/add-file-to-drive.ts +++ b/src/api/common/add-file-to-drive.ts @@ -5,7 +5,7 @@ import * as stream from 'stream'; import * as mongodb from 'mongodb'; import * as crypto from 'crypto'; -import * as gm from 'gm'; +import * as _gm from 'gm'; import * as debug from 'debug'; import fileType = require('file-type'); import prominence = require('prominence'); @@ -16,6 +16,10 @@ import serialize from '../serializers/drive-file'; import event, { publishDriveStream } from '../event'; import config from '../../conf'; +const gm = _gm.subClass({ + imageMagick: true +}); + const log = debug('misskey:register-drive-file'); const tmpFile = (): Promise => new Promise((resolve, reject) => { diff --git a/src/file/server.ts b/src/file/server.ts index 1f8d21b80d..187ce75c20 100644 --- a/src/file/server.ts +++ b/src/file/server.ts @@ -7,11 +7,15 @@ import * as express from 'express'; import * as bodyParser from 'body-parser'; import * as cors from 'cors'; import * as mongodb from 'mongodb'; -import * as gm from 'gm'; +import * as _gm from 'gm'; import * as stream from 'stream'; import DriveFile, { getGridFSBucket } from '../api/models/drive-file'; +const gm = _gm.subClass({ + imageMagick: true +}); + /** * Init app */ @@ -78,6 +82,7 @@ function thumbnail(data: stream.Readable, type: string, resize: number): ISend { const stream = g .compress('jpeg') .quality(80) + .noProfile() // Remove EXIF .stream(); return { diff --git a/src/utils/dependencyInfo.ts b/src/utils/dependencyInfo.ts index 818fa3136c..89af0d20fb 100644 --- a/src/utils/dependencyInfo.ts +++ b/src/utils/dependencyInfo.ts @@ -11,7 +11,7 @@ export default class { public showAll(): void { this.show('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version:? (.*)\r?\n/)); this.show('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/)); - this.show('GraphicsMagick', 'gm -version', x => x.match(/^GraphicsMagick ([0-9\.]*) .*/)); + this.show('ImageMagick', 'magick -version', x => x.match(/^Version: ImageMagick (.+?)\r?\n/)); } public show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void { -- cgit v1.2.3-freya