mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-28 21:08:52 -07:00
Refactor
This commit is contained in:
parent
03d2dd5703
commit
fd66f5f7e1
1 changed files with 17 additions and 17 deletions
10
gulpfile.ts
10
gulpfile.ts
|
@ -70,14 +70,15 @@ gulp.task('build:ts', () =>
|
||||||
.pipe(gulp.dest('./built/'))
|
.pipe(gulp.dest('./built/'))
|
||||||
);
|
);
|
||||||
|
|
||||||
function getLicenseHtml(path: string): string {
|
gulp.task('build:about:docs', () => {
|
||||||
|
function getLicenseHtml(path: string): string {
|
||||||
return escapeHtml(fs.readFileSync(path, 'utf-8'))
|
return escapeHtml(fs.readFileSync(path, 'utf-8'))
|
||||||
.replace(/\r\n/g, '\n')
|
.replace(/\r\n/g, '\n')
|
||||||
.replace(/(.)\n(.)/g, '$1 $2')
|
.replace(/(.)\n(.)/g, '$1 $2')
|
||||||
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLicenseSectionHtml(path: string): string {
|
function getLicenseSectionHtml(path: string): string {
|
||||||
try {
|
try {
|
||||||
const pkg = JSON.parse(fs.readFileSync(Path.parse(path).dir + '/package.json', 'utf-8'));
|
const pkg = JSON.parse(fs.readFileSync(Path.parse(path).dir + '/package.json', 'utf-8'));
|
||||||
const licenseHtml = getLicenseHtml(path);
|
const licenseHtml = getLicenseHtml(path);
|
||||||
|
@ -85,9 +86,8 @@ function getLicenseSectionHtml(path: string): string {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('build:about:docs', () => {
|
|
||||||
const licenses = glob.sync('./node_modules/**/LICENSE*');
|
const licenses = glob.sync('./node_modules/**/LICENSE*');
|
||||||
const licenseHtml = getLicenseHtml('./LICENSE');
|
const licenseHtml = getLicenseHtml('./LICENSE');
|
||||||
const thirdpartyLicensesHtml = licenses.map(license => getLicenseSectionHtml(license)).join('');
|
const thirdpartyLicensesHtml = licenses.map(license => getLicenseSectionHtml(license)).join('');
|
||||||
|
|
Loading…
Reference in a new issue