manages custom code for geenee templates
This package works with geenee templates. If you want to generate a template, you can call the geenee cli. Or, you can use the geenee-spell package to handle a complete regeneration within node.
Usage
Include the package:
npm i custom-jeans
Normally, you call storeCustomCode
before making programmatic changes, and then insertCustomCode
afterward.
const {storeCustomCode, insertCustomCode} = require('custom-jeans')
(async () => {
const customCode = await storeCustomCode(
codeDir, config
)
// more code...
const customCodeDoc = `${codeDir}/meta/customCode.json`
await insertCustomCode(
codeDir, customCodeDoc, config
)
})();
StoreCustomCode
An async function that takes a rootDir ROOT_DIR
and a config Configuration (a type exposed in magicalstrings) and returns a customCode json. Further, the function stores the custom code json in the file ROOT_DIR/meta/customCode.json
.
InsertCustomCode
An async function that takes a rootDir ROOT_DIR
, an addedCodeDoc ADDED_CODE_DOC
and a config Configuration (a type exposed in magicalstrings) and will insert the custom changes where they belong within ROOT_DIR
.
The value of customCodeDoc
is normally ROOT_DIR/meta/customCode.json
, but of course can be replaced if you want to manipulate a copy or generate it directly.