alphagov / google-docs-to-11ty

Convert a docs export to an 11ty website
0 stars 0 forks source link

Move import scripts into their own packages #4

Open romaricpascal opened 6 months ago

romaricpascal commented 6 months ago

Aim is to have two packages (as npm workspaces):

And make the 11ty project use google-docs-to-markdow-pages-cli. As an MVP only add options to make the 11ty project run its own conversion.

romaricpascal commented 6 months ago

Late thought, could a better organisation be one package per step of the conversion, each with a bin (containing the CLI) and src (containing the JS API) folder:

That could help us set a good separation, but wait before dealing in CLI things as we could have a node file in the 11ty project requiring each part.

It would also allow to document each part of the transformation more specifically in the README of each package. And also focus the tests.

romaricpascal commented 6 months ago

In terms of files, slight preference for "named" exports rather than default ones as it brings some naming consistency and doesn't trap us if at some point the package needs to export more than one thing.

function googleDocsToMarkdown(str, {dest: /* Some path */ }) {
}

module.exports = { googleDocsToMarkdown }

// rather than

module.exports = googleDocsToMarkdown