MCPcopy Create free account
hub / github.com/Create-Node-App/create-node-app / templateLoader

Function templateLoader

src/loaders.js:69–76  ·  view source on GitHub ↗
({ root, templateDir, appName, alias, verbose, mode })

Source from the content-addressed store, hash-verified

67};
68
69const templateLoader = ({ root, templateDir, appName, alias, verbose, mode }) => ({ path }) => {
70 const flag = mode.includes('append') ? 'a+' : 'w';
71 const file = fs.readFileSync(`${templateDir}/${path}`, 'utf8');
72 const newFile = _.template(file);
73 const newPath = path.replace(/.template$/, '').replace(/.append$/, '');
74
75 writeFile(`${root}/${newPath}`, newFile({ project: alias, projectName: appName }), flag, verbose);
76};
77
78const fileLoader = ({ root, templateDir, appName, originalDirectory, alias, verbose }) => ({
79 path,

Callers

nothing calls this directly

Calls 1

writeFileFunction · 0.85

Tested by

no test coverage detected