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

kopy

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kopy - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

42

dist/kopy.common.js

@@ -12,2 +12,3 @@ 'use strict';

var isBinaryPath = _interopDefault(require('is-binary-path'));
var exists = _interopDefault(require('path-exists'));

@@ -69,6 +70,2 @@ // forked from https://github.com/vuejs/vue-cli/blob/master/lib/eval.js

function noop(files, metalsmith, done) {
done();
}
var useTemplate = function (ref) {

@@ -112,2 +109,19 @@ if ( ref === void 0 ) ref = {};

var skip = function (skipExisting, destPath) {
return function (files, metalsmith, done) {
Promise.all(Object.keys(files).map(function (name) {
var location = path.join(destPath, name);
return exists(location)
.then(function (yes) {
if (yes) {
delete files[name];
if (typeof skipExisting === 'function') {
skipExisting(location);
}
}
})
})).then(function () { return done(); }).catch(done);
}
};
function kopy(src, dest, ref) {

@@ -124,14 +138,26 @@ if ( ref === void 0 ) ref = {};

var filters = ref.filters;
var skipExisting = ref.skipExisting;
return new Promise(function (resolve, reject) {
var source = path.resolve(cwd, src);
var destPath = path.resolve(cwd, dest);
var pipe = Metalsmith(source); // eslint-disable-line new-cap
pipe.source('.')
pipe
.source('.')
.ignore(function (file) { return /node_modules/.test(file); })
.use(ask(data, prompts))
.use(filterFiles(filters))
.use(disableInterpolation ? noop : useTemplate({skipInterpolation: skipInterpolation, template: template, templateOptions: templateOptions}))
.use(filterFiles(filters));
if (!disableInterpolation) {
pipe.use(useTemplate({skipInterpolation: skipInterpolation, template: template, templateOptions: templateOptions}));
}
if (skipExisting) {
pipe.use(skip(skipExisting, destPath));
}
pipe
.clean(clean)
.destination(path.resolve(cwd, dest))
.destination(destPath)
.build(function (err, files) {

@@ -138,0 +164,0 @@ if (err) { return reject(err) }

7

package.json
{
"name": "kopy",
"version": "4.0.0",
"version": "4.1.0",
"description": "Gracefully copy a directory and render templates.",

@@ -18,3 +18,3 @@ "license": "MIT",

"build": "bili",
"example": "mkdir -p dist-example && cd dist-example && node ../example.js"
"example": "npm run build && mkdir -p dist-example && cd dist-example && node ../example.js"
},

@@ -52,3 +52,4 @@ "watch": {

"minimatch": "^3.0.3",
"multimatch": "^2.1.0"
"multimatch": "^2.1.0",
"path-exists": "^3.0.0"
},

@@ -55,0 +56,0 @@ "ava": {

@@ -147,2 +147,17 @@ # kopy

##### skipExisting
Type: `function` `boolean`<br>
Default: `undefined`
Whether to skip existing file, it could be function that takes the path to existing file as argument.
```js
copy(src, dest, {
skipExisting(file) {
console.log(`${file} exists, skipped!`)
}
})
```
---

@@ -149,0 +164,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc