Remove obsolete field.

This commit is contained in:
Dillon Kearns 2022-02-28 19:49:43 -08:00
parent 8990555331
commit 5652b9b3d1
2 changed files with 9 additions and 13 deletions

View File

@ -229,17 +229,6 @@ async function outputString(
/** @typedef { { head: any[]; errors: any[]; contentJson: any[]; html: string; route: string; title: string; } } Arg */
/**
* @param {string} string
*/
function jsonOrNull(string) {
try {
return JSON.parse(string);
} catch (e) {
return { invalidJson: e.toString() };
}
}
async function runHttpJob(app, mode, requestToPerform, fs, hasFsAccess) {
pendingDataSourceCount += 1;
try {
@ -342,7 +331,6 @@ async function readFileJobNew(req, patternsToWatch) {
parsedFrontmatter: parsedFile.data,
withoutFrontmatter: parsedFile.content,
rawFile: fileContents,
jsonFile: jsonOrNull(fileContents),
});
} catch (error) {
throw {

View File

@ -43,6 +43,7 @@ plain old JSON in Elm.
-}
import DataSource exposing (DataSource)
import DataSource.File
import DataSource.Http
import DataSource.Internal.Request
import Json.Decode as Decode exposing (Decoder)
@ -273,7 +274,14 @@ The Decode will strip off any unused JSON data.
-}
jsonFile : Decoder a -> String -> DataSource a
jsonFile jsonFileDecoder filePath =
read filePath (Decode.field "jsonFile" jsonFileDecoder)
rawFile filePath
|> DataSource.andThen
(\jsonString ->
jsonString
|> Decode.decodeString jsonFileDecoder
|> Result.mapError Decode.errorToString
|> DataSource.fromResult
)
{-| Gives us the file's content without stripping off frontmatter.