copy-and-watch
Advanced tools
Comparing version
12
index.js
/* IMPORTS */ | ||
const fs = require('fs-extra'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
@@ -41,3 +41,3 @@ const chokidar = require('chokidar'); | ||
const to = findTarget(from); | ||
fs.copySync(from, to); | ||
fs.writeFileSync(to, fs.readFileSync(from)); | ||
console.log('[COPY]'.yellow, from, 'to'.yellow, to); | ||
@@ -47,3 +47,3 @@ }; | ||
const to = findTarget(from); | ||
fs.removeSync(to); | ||
fs.unlinkSync(to); | ||
console.log('[DELETE]'.yellow, to); | ||
@@ -54,7 +54,9 @@ }; | ||
if (options.clean) { | ||
fs.removeSync(target); | ||
fs.rmdirSync(target) | ||
} | ||
// initial copy | ||
fs.ensureDirSync(target); | ||
if (!fs.existsSync(target)) { | ||
fs.mkdirSync(target); | ||
} | ||
sources.forEach(s => glob.sync(s).forEach(copy)); | ||
@@ -61,0 +63,0 @@ |
{ | ||
"name": "copy-and-watch", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Synchronize files or folders locally, with a watch option", | ||
@@ -30,3 +30,2 @@ "main": "index.js", | ||
"colors": "^1.1.2", | ||
"fs-extra": "^2.0.0", | ||
"glob": "^7.1.1", | ||
@@ -33,0 +32,0 @@ "glob-parent": "^3.1.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8690
0.23%4
-20%63
3.28%- Removed
- Removed
- Removed