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

dree

Package Overview
Dependencies
Maintainers
0
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dree - npm Package Compare versions

Comparing version 5.1.3 to 5.1.4

2

bundled/bin/index.js
#!/usr/bin/env node
import b from"yargs";import{hideBin as m}from"yargs/helpers";import{writeFileSync as u}from"node:fs";import*as o from"../lib/esm/index.esm.js";import{PostSortMethodPredefined as h,SortMethodPredefined as c}from"../lib/esm/index.esm.js";function y(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function a(t){let e=/^\/(?<pattern>.*)\/(?<flags>[igm]*)?$/;return t?t.map(r=>{let n=r.match(e);return n?new RegExp(y(n.groups.pattern),n.groups.flags):r}):[]}function p(t){if(t)switch(t){case"ascending":return c.ALPHABETICAL;case"descending":return c.ALPHABETICAL_REVERSE;default:return t}}function g(t){if(t)switch(t){case"ascending":return h.ALPHABETICAL;case"descending":return h.ALPHABETICAL_REVERSE;default:return t}}async function w(){await b(m(process.argv)).scriptName("dree").version("5.1.3").command("parse <source>","Save the directory tree as a text file",t=>{t.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({ascii:{default:!1,describe:"Whether you want the result to be in ascii format",type:"boolean",hidden:!0}})},t=>{let e=t,r={symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),extensions:e.extensions,sorted:p(e.sorted),homeShortcut:e.homeShortcut,symbols:e.ascii?o.ASCII_SYMBOLS:o.DEFAULT_SYMBOLS,skipErrors:e.skipErrors},n=e.source,s=e.dest,i=!e.dest||e.show,d=o.parse(n,r);i&&console.log(d),s&&u(s,d)}).command("scan <source>","Save the directory tree as a json file",t=>{t.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({tabs:{describe:"How many tabs will be used to indent the resulted json",type:"number",default:0},pretty:{describe:"If the resulted json will be pretty printed with 4 tabs. Overwrites the tabs option",type:"boolean",default:!1}})},t=>{let e=t,r={stat:e.stat,normalize:e.normalize,symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,sizeInBytes:e.sizeInBytes,size:e.size,hash:e.hash,hashAlgorithm:e.hashAlgorithm,hashEncoding:e.hashEncoding,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),matches:a(e.matches),emptyDirectory:e.emptyDirectory,excludeEmptyDirectories:e.excludeEmptyDirectories,descendants:e.descendants,descendantsIgnoreDirectories:e.descendantsIgnoreDirectories,extensions:e.extensions,sorted:p(e.sorted),postSorted:g(e.postSorted),homeShortcut:e.homeShortcut,skipErrors:e.skipErrors},n=e.source,s=e.dest,i=!e.dest||e.show,f=e.pretty?4:e.tabs,l=JSON.stringify(o.scan(n,r),null,f);i&&console.log(l),s&&u(s,l)}).options({dest:{alias:"d",describe:"The path of the output file destination. If not specified, in any case the result will be printed on the command line.",type:"string"},show:{alias:"s",default:!1,describe:"Whether you want to print the result on the command line. This will be ignored and set to true if no destination is specified.",type:"boolean"},stat:{default:!1,describe:"Whether you want the fs.stat included in the json result",type:"boolean",hidden:!0},normalize:{default:!1,describe:"Whether you want to normalize the path in the json result",type:"boolean",hidden:!0},"symbolic-links":{default:!0,describe:"Whether you want to consider symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"follow-links":{default:!1,describe:"Whether you want to follow symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"size-in-bytes":{default:!0,describe:"Whether you want to include the size in bytes in the json result",type:"boolean",hidden:!0},size:{default:!0,describe:"Whether you want to include the size in a proper unit in the json result",type:"boolean",hidden:!0},hash:{default:!0,describe:"Whether you want to include the hash in the json result",type:"boolean",hidden:!0},"hash-algorithm":{default:"md5",describe:"The hash algorithm that you want to use for the hash in the json result",type:"string",choices:["md5","sha1"],hidden:!0},"hash-encoding":{default:"hex",describe:"The hash encoding that you want to use for the hash in the json result",type:"string",choiches:["hex","base64","latin1"],hidden:!0},"show-hidden":{default:!0,describe:"Whether you want to consider hidden files during the elaboration",type:"boolean",hidden:!0},depth:{default:void 0,describe:"The max depth wich could be reached during the elaboration from the given folder",type:"number",hidden:!0},exclude:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) whose all matched path will not be considered during the elaboration",type:"array",hidden:!0},matches:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) and all the non-matching paths will not be considered by the algorithm. Note: All the ancestors of a matching node will be added",type:"array",hidden:!0},extensions:{describe:"An array of strings containing all the extensions wich will be considered",type:"array",hidden:!0},"empty-directory":{default:!1,describe:"Whether you want to include the property isEmpty in the result",type:"boolean",hidden:!0},"exclude-empty-directories":{default:!1,describe:"Whether you want to exclude all the empty directories from the result, even if they contains nodes excluded by other options",type:"boolean",hidden:!0},sorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done before the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:[...Object.values(c),"ascending","descending"],hidden:!0},postSorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done after the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:[...Object.values(h),"ascending","descending"],hidden:!0},descendants:{default:!1,describe:"Whether you want the result to contain the number of descendants for each node",type:"boolean",hidden:!0},"descendants-ignore-directories":{default:!1,describe:"Whether you want the result directories to be ignored when calculating the number of descendants",type:"boolean",hidden:!0},"home-shortcut":{default:!1,describe:"Whether you want the unix homedir shortcut ~ to be expanded to the user home directory",type:"boolean",hidden:!0},"skip-errors":{default:!0,describe:"Whether you want to skip folders and files wich give errors during the execution",type:"boolean",hidden:!0},options:{alias:"o",describe:"A path to a json config file. If an option is both on the file and in the command, the command one will be considered",config:!0}}).showHidden("all-options").completion("completion","Creates the completion bash script to add o your .bashrc in order to have the tab autocompletion for this cli service").demandCommand(1,"You must specify a command").strict().epilogue("For more information, find our manual at https://github.com/euberdeveloper/dree#readme").argv}w();
import b from"yargs";import{hideBin as m}from"yargs/helpers";import{writeFileSync as u}from"node:fs";import*as o from"../lib/esm/index.esm.js";import{PostSortMethodPredefined as h,SortMethodPredefined as c}from"../lib/esm/index.esm.js";function y(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function a(t){let e=/^\/(?<pattern>.*)\/(?<flags>[igm]*)?$/;return t?t.map(r=>{let n=r.match(e);return n?new RegExp(y(n.groups.pattern),n.groups.flags):r}):[]}function p(t){if(t)switch(t){case"ascending":return c.ALPHABETICAL;case"descending":return c.ALPHABETICAL_REVERSE;default:return t}}function g(t){if(t)switch(t){case"ascending":return h.ALPHABETICAL;case"descending":return h.ALPHABETICAL_REVERSE;default:return t}}async function w(){await b(m(process.argv)).scriptName("dree").version("5.1.4").command("parse <source>","Save the directory tree as a text file",t=>{t.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({ascii:{default:!1,describe:"Whether you want the result to be in ascii format",type:"boolean",hidden:!0}})},t=>{let e=t,r={symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),extensions:e.extensions,sorted:p(e.sorted),homeShortcut:e.homeShortcut,symbols:e.ascii?o.ASCII_SYMBOLS:o.DEFAULT_SYMBOLS,skipErrors:e.skipErrors},n=e.source,s=e.dest,i=!e.dest||e.show,d=o.parse(n,r);i&&console.log(d),s&&u(s,d)}).command("scan <source>","Save the directory tree as a json file",t=>{t.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({tabs:{describe:"How many tabs will be used to indent the resulted json",type:"number",default:0},pretty:{describe:"If the resulted json will be pretty printed with 4 tabs. Overwrites the tabs option",type:"boolean",default:!1}})},t=>{let e=t,r={stat:e.stat,normalize:e.normalize,symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,sizeInBytes:e.sizeInBytes,size:e.size,hash:e.hash,hashAlgorithm:e.hashAlgorithm,hashEncoding:e.hashEncoding,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),matches:a(e.matches),emptyDirectory:e.emptyDirectory,excludeEmptyDirectories:e.excludeEmptyDirectories,descendants:e.descendants,descendantsIgnoreDirectories:e.descendantsIgnoreDirectories,extensions:e.extensions,sorted:p(e.sorted),postSorted:g(e.postSorted),homeShortcut:e.homeShortcut,skipErrors:e.skipErrors},n=e.source,s=e.dest,i=!e.dest||e.show,f=e.pretty?4:e.tabs,l=JSON.stringify(o.scan(n,r),null,f);i&&console.log(l),s&&u(s,l)}).options({dest:{alias:"d",describe:"The path of the output file destination. If not specified, in any case the result will be printed on the command line.",type:"string"},show:{alias:"s",default:!1,describe:"Whether you want to print the result on the command line. This will be ignored and set to true if no destination is specified.",type:"boolean"},stat:{default:!1,describe:"Whether you want the fs.stat included in the json result",type:"boolean",hidden:!0},normalize:{default:!1,describe:"Whether you want to normalize the path in the json result",type:"boolean",hidden:!0},"symbolic-links":{default:!0,describe:"Whether you want to consider symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"follow-links":{default:!1,describe:"Whether you want to follow symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"size-in-bytes":{default:!0,describe:"Whether you want to include the size in bytes in the json result",type:"boolean",hidden:!0},size:{default:!0,describe:"Whether you want to include the size in a proper unit in the json result",type:"boolean",hidden:!0},hash:{default:!0,describe:"Whether you want to include the hash in the json result",type:"boolean",hidden:!0},"hash-algorithm":{default:"md5",describe:"The hash algorithm that you want to use for the hash in the json result",type:"string",choices:["md5","sha1"],hidden:!0},"hash-encoding":{default:"hex",describe:"The hash encoding that you want to use for the hash in the json result",type:"string",choiches:["hex","base64","latin1"],hidden:!0},"show-hidden":{default:!0,describe:"Whether you want to consider hidden files during the elaboration",type:"boolean",hidden:!0},depth:{default:void 0,describe:"The max depth wich could be reached during the elaboration from the given folder",type:"number",hidden:!0},exclude:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) whose all matched path will not be considered during the elaboration",type:"array",hidden:!0},matches:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) and all the non-matching paths will not be considered by the algorithm. Note: All the ancestors of a matching node will be added",type:"array",hidden:!0},extensions:{describe:"An array of strings containing all the extensions wich will be considered",type:"array",hidden:!0},"empty-directory":{default:!1,describe:"Whether you want to include the property isEmpty in the result",type:"boolean",hidden:!0},"exclude-empty-directories":{default:!1,describe:"Whether you want to exclude all the empty directories from the result, even if they contains nodes excluded by other options",type:"boolean",hidden:!0},sorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done before the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:[...Object.values(c),"ascending","descending"],hidden:!0},postSorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done after the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:[...Object.values(h),"ascending","descending"],hidden:!0},descendants:{default:!1,describe:"Whether you want the result to contain the number of descendants for each node",type:"boolean",hidden:!0},"descendants-ignore-directories":{default:!1,describe:"Whether you want the result directories to be ignored when calculating the number of descendants",type:"boolean",hidden:!0},"home-shortcut":{default:!1,describe:"Whether you want the unix homedir shortcut ~ to be expanded to the user home directory",type:"boolean",hidden:!0},"skip-errors":{default:!0,describe:"Whether you want to skip folders and files wich give errors during the execution",type:"boolean",hidden:!0},options:{alias:"o",describe:"A path to a json config file. If an option is both on the file and in the command, the command one will be considered",config:!0}}).showHidden("all-options").completion("completion","Creates the completion bash script to add o your .bashrc in order to have the tab autocompletion for this cli service").demandCommand(1,"You must specify a command").strict().epilogue("For more information, find our manual at https://github.com/euberdeveloper/dree#readme").argv}w();
{
"name": "dree",
"version": "5.1.3",
"version": "5.1.4",
"description": "A nodejs module wich helps you handle a directory tree providing you its abstraction through tested functions and a custom configuration.",

@@ -91,3 +91,3 @@ "main": "bundled/lib/commonjs/index.js",

"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^22.4.0",
"@types/node": "^22.4.1",
"@types/yargs": "^17.0.33",

@@ -105,6 +105,6 @@ "c8": "^10.1.2",

"tsx": "^4.17.0",
"typedoc": "^0.26.5",
"typedoc-plugin-ga": "^1.0.2",
"typedoc": "^0.26.6",
"typedoc-plugin-ga": "^1.0.3",
"typescript": "^5.5.4"
}
}
## [5.1.4](https://github.com/euberdeveloper/dree/compare/5.1.3...5.1.4) (2024-08-19)
## [5.1.3](https://github.com/euberdeveloper/dree/compare/5.1.2...5.1.3) (2024-08-18)

@@ -4,0 +6,0 @@

{
"name": "dree",
"version": "5.1.3",
"version": "5.1.4",
"description": "A nodejs module wich helps you handle a directory tree providing you its abstraction through tested functions and a custom configuration.",

@@ -92,3 +92,3 @@ "main": "bundled/lib/commonjs/index.js",

"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^22.4.0",
"@types/node": "^22.4.1",
"@types/yargs": "^17.0.33",

@@ -106,6 +106,6 @@ "c8": "^10.1.2",

"tsx": "^4.17.0",
"typedoc": "^0.26.5",
"typedoc-plugin-ga": "^1.0.2",
"typedoc": "^0.26.6",
"typedoc-plugin-ga": "^1.0.3",
"typescript": "^5.5.4"
}
}
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