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

Function getModeFromPath

src/loaders.js:45–58  ·  view source on GitHub ↗
(path = '')

Source from the content-addressed store, hash-verified

43}
44
45function getModeFromPath(path = '') {
46 const matchExts = (...exts) => exts.find((ext) => path.endsWith(ext));
47
48 if (matchExts('.append')) {
49 return 'append';
50 }
51 if (matchExts('.append.template', '.template.append')) {
52 return 'appendTemplate';
53 }
54 if (matchExts('.template')) {
55 return 'copyTemplate';
56 }
57 return 'copy';
58}
59
60const copyLoader = ({ root, templateDir, verbose }) => ({ path }) => {
61 copyFile(`${templateDir}/${path}`, `${root}/${path}`, verbose);

Callers 1

fileLoaderFunction · 0.85

Calls 1

matchExtsFunction · 0.85

Tested by

no test coverage detected