Duplicate code in readMetadata.js & versionFallback.js #725 (#726)

* Duplicate code in readMetadata.js & versionFallback.js #725

* Putting back package-lock.json

* Rename lib/server/utilsMetadata.js -> lib/server/metadataUtils.js

* Update splitHeader + extractMetadata

* Update prettier
This commit is contained in:
Rémi Doreau 2018-06-12 06:25:23 +02:00 committed by Endilie Yacop Sucipto
parent de8da1ca54
commit a77ae958db
7 changed files with 100 additions and 101 deletions

View file

@ -8,6 +8,8 @@
function execute(port) {
const extractTranslations = require('../write-translations');
const metadataUtils = require('./metadataUtils');
const env = require('./env.js');
const translation = require('./translation');
const express = require('express');
@ -186,8 +188,9 @@ function execute(port) {
return;
}
let rawContent = readMetadata.extractMetadata(fs.readFileSync(file, 'utf8'))
.rawContent;
let rawContent = metadataUtils.extractMetadata(
fs.readFileSync(file, 'utf8')
).rawContent;
// generate table of contents if appropriate
if (rawContent && rawContent.indexOf(TABLE_OF_CONTENTS_TOKEN) !== -1) {
@ -326,7 +329,7 @@ function execute(port) {
file = file.replace(new RegExp('/', 'g'), '-');
file = join(CWD, 'blog', file);
const result = readMetadata.extractMetadata(
const result = metadataUtils.extractMetadata(
fs.readFileSync(file, {encoding: 'utf8'})
);
let rawContent = result.rawContent;