@seangenabe/shadow

Glob files and copy/symlink/hardlink in another directory.

Usage no npm install needed!

<script type="module">
  import seangenabeShadow from 'https://cdn.skypack.dev/@seangenabe/shadow';
</script>

README

shadow

npm Build Status Coveralls Dependency Status devDependency Status node

Glob files and copy/symlink/hardlink in another directory.

Usage

import { shadow } from "@seangenabe/shadow"

shadow(pattern, dest, opts)

Globs the current directory (opts.cwd || process.cwd()) and copies, symlinks, or hardlinks the globbed files with the globbed folder structure into dest.

Parameters:

  • pattern - array | string - One or more glob patterns to select the files to link
  • dest - the destination directory
  • opts - options to pass to globby
    • copyMode - 'symlink' | 'link' - Symlink or hardlink the files. If unspecified, will simply copy the files.
    • fallback - Fall back to copying if there aren't enough permissions to symlink or hardlink (EPERM).

Returns a promise that resolves when all files have been hardlinked.

CLI

shadow <cwd> <dest> [pattern = **]

Options:

  • cwd, dest, pattern - same as above
  • -m --mode - symlink or hardlink the file
  • -f --fallback - fall back to copying the file on EPERM

What happened to hardlink?

This package is modified from hardlink's code and is a superset of its functionality.

Related

License

MIT