Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
706f495e
Commit
706f495e
authored
8 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
✌️
parent
9a8af4a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gulpfile.ts
+16
-4
16 additions, 4 deletions
gulpfile.ts
src/web/about/pages/license.pug
+6
-0
6 additions, 0 deletions
src/web/about/pages/license.pug
with
22 additions
and
4 deletions
gulpfile.ts
+
16
−
4
View file @
706f495e
...
...
@@ -3,7 +3,7 @@
*/
import
*
as
fs
from
'
fs
'
;
import
*
as
p
ath
from
'
path
'
;
import
*
as
P
ath
from
'
path
'
;
import
*
as
gulp
from
'
gulp
'
;
import
*
as
gutil
from
'
gulp-util
'
;
import
*
as
babel
from
'
gulp-babel
'
;
...
...
@@ -71,9 +71,20 @@ function getLicenseHtml(path: string): string {
.
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
;
}
}
gulp
.
task
(
'
build:about:docs
'
,
()
=>
{
const
licenses
=
glob
.
sync
(
'
./node_modules/**/LICENSE*
'
);
const
licenseHtml
=
[
getLicenseHtml
(
'
./LICENSE
'
)].
concat
(
licenses
.
map
(
license
=>
getLicenseHtml
(
license
))).
join
(
'
<hr>
'
);
const
licenseHtml
=
getLicenseHtml
(
'
./LICENSE
'
);
const
thirdpartyLicensesHtml
=
licenses
.
map
(
license
=>
getLicenseSectionHtml
(
license
)).
join
(
''
);
const
pugs
=
glob
.
sync
(
'
./src/web/about/pages/**/*.pug
'
);
const
streams
=
pugs
.
map
(
file
=>
{
const
page
=
file
.
replace
(
'
./src/web/about/pages/
'
,
''
).
replace
(
'
.pug
'
,
''
);
...
...
@@ -81,10 +92,11 @@ gulp.task('build:about:docs', () => {
.
pipe
(
pug
({
locals
:
Object
.
assign
({
path
:
page
,
license
:
licenseHtml
license
:
licenseHtml
,
thirdpartyLicenses
:
thirdpartyLicensesHtml
},
config
)
}))
.
pipe
(
gulp
.
dest
(
'
./built/web/about/pages/
'
+
p
ath
.
parse
(
page
).
dir
));
.
pipe
(
gulp
.
dest
(
'
./built/web/about/pages/
'
+
P
ath
.
parse
(
page
).
dir
));
});
return
es
.
merge
.
apply
(
es
,
streams
);
...
...
This diff is collapsed.
Click to expand it.
src/web/about/pages/license.pug
+
6
−
0
View file @
706f495e
...
...
@@ -7,3 +7,9 @@ block content
h1 ライセンス
div!= license
hr
details
summary サードパーティ
div!= thirdpartyLicenses
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment