Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assemble-fs

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assemble-fs - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

72

index.js

@@ -12,3 +12,23 @@ /*!

module.exports = function (app) {
/**
* Support using the plugin on `app` or a
* `collection` instance
*/
module.exports = function(app) {
plugin(app);
return function(collection) {
plugin(collection);
return;
};
};
/**
* The actual `fs` plugin
*/
function plugin(app) {
var vfs = utils.vfs;

@@ -51,3 +71,6 @@

app.mixin('src', vfs.src.bind(vfs));
app.mixin('src', function() {
return vfs.src.apply(vfs, arguments)
.pipe(toCollection(this));
});

@@ -65,3 +88,5 @@ /**

app.mixin('symlink', vfs.symlink.bind(vfs));
app.mixin('symlink', function () {
return vfs.symlink.apply(vfs, arguments);
});

@@ -86,2 +111,41 @@ /**

});
};
}
/**
* Push vinyl files into a collection or list.
*/
function toCollection(app, name) {
var through = utils.through.obj;
name = name || 'files';
app[name] = [];
var collection, item, view;
if (app.isApp) {
collection = app.collection();
}
var stream = through(function (file, enc, next) {
app[name].push(file);
if (app.isApp) {
item = collection.setView(file.path, file);
return next(null, item);
}
if (app.isCollection) {
view = app.setView(file.path, file);
return next(null, view);
}
if (app.isList) {
item = app.setItem(file.path, file);
return next(null, item);
}
next(null, file);
});
app.stream = utils.src(stream);
return stream;
}

7

package.json
{
"name": "assemble-fs",
"description": "Assemble plugin to add methods to assemble for working with the file system, like src, dest, copy and symlink.",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/jonschlinkert/assemble-fs",

@@ -25,2 +25,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"lazy-cache": "^0.2.3",
"src-stream": "^0.1.1",
"through2": "^2.0.0",
"vinyl-fs": "^2.1.1"

@@ -35,4 +37,3 @@ },

"sinon": "^1.17.1",
"templates": "^0.3.0",
"through2": "^2.0.0",
"templates": "^0.3.6",
"vinyl": "^1.0.0"

@@ -39,0 +40,0 @@ },

@@ -18,3 +18,2 @@ # assemble-fs [![NPM version](https://badge.fury.io/js/assemble-fs.svg)](http://badge.fury.io/js/assemble-fs)

```js
var afs = require('assemble-fs');
var assemble = require('assemble');

@@ -24,3 +23,3 @@

var app = assemble()
.use(afs)
.use(require('assemble-fs'))

@@ -34,3 +33,3 @@ // now you can use `src` and `dest`

### [.copy](index.js#L32)
### [.copy](index.js#L52)

@@ -55,3 +54,3 @@ Copy files with the given glob `patterns` to the specified `dest`.

### [.src](index.js#L50)
### [.src](index.js#L70)

@@ -71,3 +70,3 @@ Glob patterns or filepaths to source files.

### [.symlink](index.js#L63)
### [.symlink](index.js#L86)

@@ -86,3 +85,3 @@ Glob patterns or paths for symlinks.

### [.dest](index.js#L77)
### [.dest](index.js#L102)

@@ -135,2 +134,2 @@ Specify a destination for processed files.

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 10, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 16, 2015._

@@ -7,6 +7,8 @@ 'use strict';

var lazy = require('lazy-cache')(require);
var utils = require('lazy-cache')(require);
var fn = require;
require = lazy;
require = utils;
require('src-stream', 'src');
require('through2', 'through');
require('vinyl-fs', 'vfs');

@@ -16,5 +18,5 @@ require = fn;

/**
* Expose `lazy`
* Expose `utils`
*/
module.exports = lazy;
module.exports = utils;
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