Skip to content

Commit

Permalink
last refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
endiliey committed Jun 5, 2018
1 parent a9fd645 commit 7751620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const path = require('path');
const mkdirp = require('mkdirp');
const chalk = require('chalk');
const readMetadata = require('./server/readMetadata.js');
const utils = require('./server/utils.js');
const versionFallback = require('./server/versionFallback.js');
const env = require('./server/env.js');

Expand Down Expand Up @@ -108,7 +109,8 @@ files.forEach(file => {
metadata.original_id = metadata.id;
metadata.id = 'version-' + version + '-' + metadata.id;

const subDir = readMetadata.getSubDir(file);
const docsDir = path.join(CWD, '../', readMetadata.getDocsPath());
const subDir = utils.getSubDir(file, docsDir);
const targetFile = subDir
? `${versionFolder}/${subDir}/${path.basename(file)}`
: `${versionFolder}/${path.basename(file)}`;
Expand Down
2 changes: 1 addition & 1 deletion lib/write-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ function execute() {
};

// look through markdown headers of docs for titles and categories to translate
const docsDir = path.join(CWD, '../', readMetadata.getDocsPath());
let files = glob.sync(CWD + '/../' + readMetadata.getDocsPath() + '/**');
files.forEach(file => {
const extension = path.extname(file);
if (extension === '.md' || extension === '.markdown') {
let res;
try {
const docsDir = path.join(CWD, '../', readMetadata.getDocsPath());
res = readMetadata.processMetadata(file, docsDir);
} catch (e) {
console.error(e);
Expand Down

0 comments on commit 7751620

Please sign in to comment.