diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-15 19:35:20 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-15 19:35:20 +0900 |
| commit | 7bfa56d199ce5c294595f2e03706bc40090c2480 (patch) | |
| tree | 12b3c21690f265cbfce254b459da76c0d0f355d1 /src/server/web/docs.ts | |
| parent | Fix bug (diff) | |
| download | sharkey-7bfa56d199ce5c294595f2e03706bc40090c2480.tar.gz sharkey-7bfa56d199ce5c294595f2e03706bc40090c2480.tar.bz2 sharkey-7bfa56d199ce5c294595f2e03706bc40090c2480.zip | |
Fix bug
Diffstat (limited to 'src/server/web/docs.ts')
| -rw-r--r-- | src/server/web/docs.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index c9000447dd..1439ae688c 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -21,14 +21,14 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { vars['lang'] = lang; - const cwd = path.resolve(__dirname + '/../../../'); + const cwd = path.resolve(__dirname + '/../../../') + '/'; const endpoints = glob.sync('built/server/api/endpoints/**/*.js', { cwd }); - vars['endpoints'] = endpoints.map(ep => require('../../../' + ep)).filter(x => x.meta).map(x => x.meta.name); + vars['endpoints'] = endpoints.map(ep => require(cwd + ep)).filter(x => x.meta).map(x => x.meta.name); const entities = glob.sync('src/docs/api/entities/**/*.yaml', { cwd }); vars['entities'] = entities.map(x => { - const _x = yaml.safeLoad(fs.readFileSync(x, 'utf-8')) as any; + const _x = yaml.safeLoad(fs.readFileSync(cwd + x, 'utf-8')) as any; return _x.name; }); @@ -42,7 +42,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { title: {} }; } - vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/^# (.+?)\r?\n/)[1]; + vars['docs'][name]['title'][lang] = fs.readFileSync(cwd + x, 'utf-8').match(/^# (.+?)\r?\n/)[1]; }); vars['kebab'] = (string: string) => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); |