New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

copy-and-watch

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-and-watch - npm Package Compare versions

Comparing version

to
0.0.7

25

index.js

@@ -39,4 +39,10 @@ /* IMPORTS */

};
const createDirIfNotExist = dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
};
const copy = from => {
const to = findTarget(from);
createDirIfNotExist(path.dirname(to));
fs.writeFileSync(to, fs.readFileSync(from));

@@ -50,12 +56,23 @@ console.log('[COPY]'.yellow, from, 'to'.yellow, to);

};
const rimraf = dir => {
if (fs.existsSync(dir)) {
fs.readdirSync(dir).forEach(entry => {
const entryPath = path.join(dir, entry);
if (fs.lstatSync(entryPath).isDirectory()) {
rimraf(entryPath);
} else {
fs.unlinkSync(entryPath);
}
});
fs.rmdirSync(dir);
}
};
// clean
if (options.clean) {
fs.rmdirSync(target)
rimraf(target);
}
// initial copy
if (!fs.existsSync(target)) {
fs.mkdirSync(target);
}
createDirIfNotExist(target);
sources.forEach(s => glob.sync(s).forEach(copy));

@@ -62,0 +79,0 @@

2

package.json
{
"name": "copy-and-watch",
"version": "0.0.6",
"version": "0.0.7",
"description": "Synchronize files or folders locally, with a watch option",

@@ -5,0 +5,0 @@ "main": "index.js",