Registry / devops / watch-build-copy

watch-build-copy

JSON →
library1.0.0jsnpmunverified

A CLI tool (v1.0.0) that watches a directory for changes, runs a build command, and copies the resulting dist folder to a target directory. It is a simple development utility for projects that need to rebuild and sync output on file changes. No active release cadence; last release is initial. Differentiators: minimal configuration, single-purpose, no framework dependency.

npm install watch-build-copy
INSTALL
IMPORT
SIG · WATCH-BUILD-COPY
W
watch-build-copy
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

watchBuildCopy
import watchBuildCopy from 'watch-build-copy'
const watchBuildCopy = require('watch-build-copy')
ESM-only; ships only ESM, no CommonJS support.
run
import { run } from 'watch-build-copy'
Named export for programmatic use; no default export for run.
watchBuildCopy
import watchBuildCopy from 'watch-build-copy'
import { watchBuildCopy } from 'watch-build-copy'
Default export is the main function; named export not available for this symbol.

Shows programmatic usage: watch a directory, run build, copy dist to target with a 2-second throttle.

import watchBuildCopy from 'watch-build-copy'; watchBuildCopy({ watch: './src', build: 'npm run build', dist: './dist', target: './../somewhere', timeout: 2000 });
Debug
Known issues
gotchaThe build command is executed via shell, which can be a security risk if the watch directory is writable by untrusted users.
fix
Use a fixed build command or sanitize input.
affects: *
gotchaCopy operation uses fs-extra.copySync, which overwrites target without warning.
fix
Backup target directory before running.
affects: *
gotchaNode.js version 12 or higher is required; lower versions may throw due to fs-extra/chokidar compatibility.
fix
Upgrade Node.js to >=12.
affects: *
Errors
Common errors & fixes
Cannot find module 'watch-build-copy'
Importing with require() when package is ESM-only.
fix
Use import syntax or set type: 'module' in package.json.
TypeError: watchBuildCopy is not a function
Named import instead of default import.
fix
Use import watchBuildCopy from 'watch-build-copy'.
Error: ENOENT: no such file or directory, copyfile '...'
The dist directory does not exist after build.
fix
Ensure build command produces the dist folder.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
chokidarrequiredfile watching
yargsrequiredCLI argument parsing
fs-extrarequiredfile copy operations
Agent activity
4 hits · last 30 days
node
4
Resources
watch-build-copy — npm install watch-build-copy · libregistry