MCPcopy
hub / github.com/lukeed/pwa / copyDir

Function copyDir

packages/cli/lib/init.js:79–87  ·  view source on GitHub ↗

* Copy `templates/{dir}/**` ~> `${dest}/**` * @param {String} dir The "templates" dirname * @param {String} dest The target destination * @param {Object} data The data to inject

(dir, dest, data)

Source from the content-addressed store, hash-verified

77 * @param {Object} data The data to inject
78 */
79function copyDir(dir, dest, data) {
80 let cwd = join(templates, dir);
81 let isRaw = /svelte|vue|assets/i.test(cwd);
82 glob(cwd).forEach(({ rel, abs }) => {
83 let file = (isRaw || /index/i.test(rel)) ? join(dest, rel) : toAppFile(rel, dest);
84 let src = fs.readFileSync(abs, 'utf8');
85 writer(file).end(templite(src, data));
86 });
87}
88
89function copyFile(src, tar, name) {
90 let rr = fs.createReadStream(join(src, name));

Callers 1

init.jsFile · 0.85

Calls 1

toAppFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…