Skip to content

Commit

Permalink
clean up and leftovers from content as data PR (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Nov 2, 2024
1 parent 4de00db commit b135280
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
15 changes: 15 additions & 0 deletions packages/cli/src/lib/content-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
const activeFrontmatterKeys = ['route', 'label', 'title', 'id'];

function pruneGraph(pages) {
return pages.map(page => {
const p = {
...page,
title: page.title ?? page.label
};

delete p.resources;
delete p.imports;

return p;
});
}

function cleanContentCollection(collection = []) {
return collection.map((page) => {
let prunedPage = {};
Expand All @@ -18,6 +32,7 @@ function cleanContentCollection(collection = []) {
}

export {
pruneGraph,
activeFrontmatterKeys,
cleanContentCollection
};
7 changes: 0 additions & 7 deletions packages/cli/src/lifecycles/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const generateGraph = async (compilation) => {
id: getIdFromRelativePathPath(relativePagePath, `.${extension}`).replace('api-', ''),
pageHref: new URL(relativePagePath, pagesDir).href,
outputHref: new URL(relativePagePath, outputDir).href,
// outputPath: relativePagePath,
route: `${basePath}${route}`,
isolation
});
Expand Down Expand Up @@ -191,8 +190,6 @@ const generateGraph = async (compilation) => {
executeModuleUrl: routeWorkerUrl.href,
moduleUrl: filenameUrl.href,
compilation: JSON.stringify(compilation),
// TODO need to get as many of these params as possible
// or ignore completely?
page: JSON.stringify({
servePage: isCustom,
route,
Expand Down Expand Up @@ -274,9 +271,6 @@ const generateGraph = async (compilation) => {
outputHref: route === '/404/'
? new URL('./404.html', outputDir).href
: new URL(`.${route}index.html`, outputDir).href,
// outputPath: route === '/404/'
// ? '/404.html'
// : `${route}index.html`,
isSSR: !isStatic,
prerender,
isolation,
Expand Down Expand Up @@ -337,7 +331,6 @@ const generateGraph = async (compilation) => {
{
...oldGraph,
id: '404',
// outputPath: '/404.html',
outputHref: new URL('./404.html', outputDir).href,
pageHref: new URL('./404.html', pagesDir).href,
route: `${basePath}/404/`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
import { mergeImportMap } from '../../lib/walker-package-ranger.js';
import { ResourceInterface } from '../../lib/resource-interface.js';
import { checkResourceExists } from '../../lib/resource-utils.js';
import { activeFrontmatterKeys, cleanContentCollection } from '../../lib/content-utils.js';
import { activeFrontmatterKeys, cleanContentCollection, pruneGraph } from '../../lib/content-utils.js';
import fs from 'fs/promises';

function pruneGraph(pages) {
return pages.map(page => {
const p = {
...page,
title: page.title ?? page.label
};

delete p.resources;
delete p.imports;

return p;
});
}

const importMap = {
'@greenwood/cli/src/data/client.js': '/node_modules/@greenwood/cli/src/data/client.js'
};
Expand Down

0 comments on commit b135280

Please sign in to comment.