published-working-tree

0.0.3 • Public • Published

Published Working Tree

Read file-trees from disk and compare against a published tree. Used in Patchwork to drive publishing interfaces.

Usage

var pwt = require('published-working-tree')
 
// symbols used in tree to refer to non-file attributes
pwt.TYPE // 'directory' or 'file'
pwt.STAT // fs.Stat
pwt.NAME // String
pwt.PATH // Path
pwt.PUBLISHED // Boolean
pwt.MODIFIED // Boolean
pwt.DELETED // Boolean
pwt.ACTIVE // Boolean
pwt.DIRREAD // Boolean
 
// load working tree from disk, compared against a published tree
pwt.loadworking(rootpath, publishedTree, function (err, workingTree) {
  // ...
})
 
// read all of the directory tree, without a published tree to compare against
var working = {}
pwt.readall (filepath, working, function () {
  // ...
})
 
// read just one directory
var working = {}
pwt.read (filepath, working, true, function () {
  // ...
})
 
// enumerate modifications to be published
pwt.changes (working)
// => { adds: [..], dels: [..], mods: [..] }
 
// get change-state of item
pwt.change (item)
// => 'mod', 'add', or 'del'

Readme

Keywords

none

Package Sidebar

Install

npm i published-working-tree

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • pfraze