Skip to content

Commit

Permalink
docsでbuilt外のsrcを参照しているのを修正
Browse files Browse the repository at this point in the history
* docsでbuilt外を参照しないように

* koa-viewsで外に出ないように

* koa-views@7.0.0
  • Loading branch information
mei23 committed Dec 24, 2020
1 parent ee13683 commit afd6dbf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
6 changes: 5 additions & 1 deletion gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ gulp.task('build:copy:fonts', () =>
gulp.src('./node_modules/three/examples/fonts/**/*').pipe(gulp.dest('./built/client/assets/fonts/'))
);

gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', () =>
gulp.task('build:copy:docs', () =>
gulp.src('./src/docs/*.md').pipe(gulp.dest('./built/docs/'))
);

gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', 'build:copy:docs', () =>
gulp.src([
'./src/const.json',
'./src/emojilist.json',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"koa-mount": "4.0.0",
"koa-send": "5.0.1",
"koa-slow": "2.1.0",
"koa-views": "6.3.1",
"koa-views": "7.0.0",
"langmap": "0.0.16",
"loader-utils": "2.0.0",
"lookup-dns-cache": "2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/server/web/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> {

vars['lang'] = lang;

const cwd = path.resolve(__dirname + '/../../../') + '/';
const cwd = path.resolve(__dirname + '/../../') + '/'; // built/

const docs = glob.sync(`src/docs/**/*.${lang}.md`, { cwd });
const docs = glob.sync(`docs/**/*.${lang}.md`, { cwd });
vars['docs'] = {};
for (const x of docs) {
const [, name] = x.match(/docs\/(.+?)\.(.+?)\.md$/)!;
Expand Down Expand Up @@ -92,9 +92,9 @@ router.get('/*/*', async ctx => {
tables: true,
extensions: ['urlExtension', 'apiUrlExtension', 'highlightjs']
});
const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8');
const md = fs.readFileSync(`${__dirname}/../../docs/${doc}.${lang}.md`, 'utf8');

await ctx.render('../../../../src/docs/article', Object.assign({
await ctx.render('docs-article', Object.assign({
id: doc,
html: conv.makeHtml(md),
title: md.match(/^# (.+?)\r?\n/)![1],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends ./base
extends ./docs-base

block main
!= html
Expand Down
File renamed without changes.
22 changes: 15 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ bl@^4.0.1:
inherits "^2.0.4"
readable-stream "^3.4.0"

bluebird@^3.1.1:
bluebird@^3.1.1, bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -2668,13 +2668,20 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=

consolidate@0.15.1, consolidate@^0.15.1:
consolidate@^0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7"
integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==
dependencies:
bluebird "^3.1.1"

consolidate@^0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.16.0.tgz#a11864768930f2f19431660a65906668f5fbdc16"
integrity sha512-Nhl1wzCslqXYTJVDyJCu3ODohy9OfBMB5uD2BiBTzd7w+QY0lBzafkR8y8755yMYHAaMD4NuzbAw03/xzfw+eQ==
dependencies:
bluebird "^3.7.2"

constantinople@^3.0.1, constantinople@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-3.1.2.tgz#d45ed724f57d3d10500017a7d3a889c1381ae647"
Expand Down Expand Up @@ -5855,17 +5862,18 @@ koa-slow@2.1.0:
lodash.isregexp "3.0.5"
q "1.4.1"

koa-views@6.3.1:
version "6.3.1"
resolved "https://registry.yarnpkg.com/koa-views/-/koa-views-6.3.1.tgz#8d23fa2118c71e9119fb47a75a58053345e37356"
integrity sha512-weIaPs2cCHWT2qK8qHRmwlZ29xRCvUVy1v/z12AGavVV5j4QIU0W/Y7OVBBu1sTkcO9dDJ25ajGYHGZ/aY43IQ==
koa-views@7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/koa-views/-/koa-views-7.0.0.tgz#039a90620991f6668566010b3c1df31481f78c98"
integrity sha512-I9H2Dood5MhwzmWk7hkWuxEBObd3uv/4eEPJP2r43Ro+rK8ICKjrIKEzKrfT89JNX69vWOEU8JreJwRjb5HOFw==
dependencies:
consolidate "0.15.1"
consolidate "^0.16.0"
debug "^4.1.0"
get-paths "0.0.7"
koa-send "^5.0.0"
mz "^2.4.0"
pretty "^2.0.0"
resolve-path "^1.4.0"

koa@2.13.0:
version "2.13.0"
Expand Down

0 comments on commit afd6dbf

Please sign in to comment.