diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-01-14 01:28:11 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-01-14 01:28:11 +0900 |
| commit | d42990f0b37097d4291173de0265632b2f281df3 (patch) | |
| tree | a8a63affc7243fe63ba1870e7d57fd7cf37f787a | |
| parent | Remove needless logs (diff) | |
| download | misskey-d42990f0b37097d4291173de0265632b2f281df3.tar.gz misskey-d42990f0b37097d4291173de0265632b2f281df3.tar.bz2 misskey-d42990f0b37097d4291173de0265632b2f281df3.zip | |
Refactor
| -rw-r--r-- | gulpfile.ts | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/gulpfile.ts b/gulpfile.ts index 7e4c5eb16a..3be636fa90 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -70,24 +70,24 @@ gulp.task('build:ts', () => .pipe(gulp.dest('./built/')) ); -function getLicenseHtml(path: string): string { - return escapeHtml(fs.readFileSync(path, 'utf-8')) - .replace(/\r\n/g, '\n') - .replace(/(.)\n(.)/g, '$1 $2') - .replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>'); -} +gulp.task('build:about:docs', () => { + function getLicenseHtml(path: string): string { + return escapeHtml(fs.readFileSync(path, 'utf-8')) + .replace(/\r\n/g, '\n') + .replace(/(.)\n(.)/g, '$1 $2') + .replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>'); + } -function getLicenseSectionHtml(path: string): string { - try { - const pkg = JSON.parse(fs.readFileSync(Path.parse(path).dir + '/package.json', 'utf-8')); - const licenseHtml = getLicenseHtml(path); - return `<details><summary>${pkg.name} <small>v${pkg.version}</small></summary>${licenseHtml}</details>`; - } catch (e) { - return null; + function getLicenseSectionHtml(path: string): string { + try { + const pkg = JSON.parse(fs.readFileSync(Path.parse(path).dir + '/package.json', 'utf-8')); + const licenseHtml = getLicenseHtml(path); + return `<details><summary>${pkg.name} <small>v${pkg.version}</small></summary>${licenseHtml}</details>`; + } catch (e) { + return null; + } } -} -gulp.task('build:about:docs', () => { const licenses = glob.sync('./node_modules/**/LICENSE*'); const licenseHtml = getLicenseHtml('./LICENSE'); const thirdpartyLicensesHtml = licenses.map(license => getLicenseSectionHtml(license)).join(''); |