npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

base-fs-tree

v0.2.8

Published

Base plugin for creating file trees using archy. Requires the base-fs plugin, but can also be used as a gulp plugin.

Downloads

9

Readme

base-fs-tree NPM version NPM downloads Build Status

Base plugin for creating file trees using archy. Requires the base-fs plugin, but can also be used as a gulp plugin.

Install

Install with npm:

$ npm install --save base-fs-tree

Usage

var tree = require('base-fs-tree');

gulp plugin example

The following examples will work with base-fs, gulp, verb, assemble, generate, update or any other application that supports vinyl streams.

var tree = require('base-fs-tree');
var gulp = require('gulp');

gulp.task('default', function(cb) {
  return gulp.src('some-files/**/*.*')
    .pipe(tree.create())
    .pipe(gulp.dest('trees'))
});

Get files before they're modified

If you want to create a tree from the original unmodified source file paths, use .capture() first thing in the stream:

var tree = require('base-fs-tree');
var gulp = require('gulp');

gulp.task('default', function(cb) {
  return gulp.src('some-files/**/*.*')
    .pipe(tree.capture()) //<= capture files

    // gulp plugin pipeline
    .pipe(otherPlugins())
    .pipe(gulp.dest('dist')) 

    .pipe(tree.create()) //<= create tree
    .pipe(gulp.dest('trees'))
});

Command line tips

You can conditionally generate trees using a command line flag, like --tree.

var tree = require('base-fs-tree');
var gulp = require('gulp');
var argv = require('yargs-parser')(process.argv.slice(2), {
  default: {tree: false}
});

gulp.task('default', function(cb) {
  return gulp.src('some-files/**/*.*')
    .pipe(tree.create(argv))
    .pipe(gulp.dest('trees'))
});

base plugin example

This can also be used as a non-pipeline plugin with base applications. It works by adding .preWrite middleware and a taskEnd listener, so that anytime taskEnd is emitted, a tree will be automatically generates.

This can be useful when you want to automatically generate trees for all tasks in a generate generator, for example.

var tree = require('base-fs-tree');
var vfs = require('base-fs');
var Base = require('base');
var base = new Base();
base.use(vfs());
base.use(tree());

app.task('default', function(cb) {
  app.src('some-files/**/*.*')
    .pipe(app.dest('trees'))
    .on('end', function() {
      // emit `taskEnd` with the name of the task
      app.emit('taskEnd', 'default');
      cb();
    });
});

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on August 09, 2016.