Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement/issue 1167 content as data leftovers cleanup #1287

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading