Socket
Socket
Sign inDemoInstall

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.0.7 to 5.0.8

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 s 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(n=>{let o=n.match(e);return o?new RegExp(y(o.groups.pattern),o.groups.flags):n}):[]}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.0.7").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"})},t=>{let e=t,n={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,skipErrors:e.skipErrors},o=e.source,r=e.dest,i=!e.dest||e.show,d=s.parse(o,n);i&&console.log(d),r&&u(r,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,n={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},o=e.source,r=e.dest,i=!e.dest||e.show,f=e.pretty?4:e.tabs,l=JSON.stringify(s.scan(o,n),null,f);i&&console.log(l),r&&u(r,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 s 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(n=>{let o=n.match(e);return o?new RegExp(y(o.groups.pattern),o.groups.flags):n}):[]}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.0.8").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"})},t=>{let e=t,n={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,skipErrors:e.skipErrors},o=e.source,r=e.dest,i=!e.dest||e.show,d=s.parse(o,n);i&&console.log(d),r&&u(r,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,n={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},o=e.source,r=e.dest,i=!e.dest||e.show,f=e.pretty?4:e.tabs,l=JSON.stringify(s.scan(o,n),null,f);i&&console.log(l),r&&u(r,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.0.7",
"version": "5.0.8",
"description": "A nodejs module wich helps you handle a directory tree providing you its abstraction through tested functions and a custom configuration.",

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

"dependencies": {
"minimatch": "^9.0.5",
"minimatch": "^10.0.1",
"yargs": "^17.7.2"

@@ -92,3 +92,3 @@ },

"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.14.9",
"@types/node": "^20.14.10",
"@types/yargs": "^17.0.32",

@@ -100,10 +100,10 @@ "c8": "^10.1.2",

"dts-bundle-generator": "^9.5.1",
"esbuild": "^0.21.5",
"esbuild": "^0.23.0",
"esbuild-plugin-import-map": "^2.1.0",
"mocha": "^10.5.2",
"release-it": "^17.4.0",
"mocha": "^10.6.0",
"release-it": "^17.5.0",
"shx": "^0.3.4",
"typedoc": "^0.26.3",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
}
}
## [5.0.8](https://github.com/euberdeveloper/dree/compare/5.0.7...5.0.8) (2024-07-09)
## [5.0.7](https://github.com/euberdeveloper/dree/compare/5.0.6...5.0.7) (2024-06-30)

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

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

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

"dependencies": {
"minimatch": "^9.0.5",
"minimatch": "^10.0.1",
"yargs": "^17.7.2"

@@ -93,3 +93,3 @@ },

"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.14.9",
"@types/node": "^20.14.10",
"@types/yargs": "^17.0.32",

@@ -101,10 +101,10 @@ "c8": "^10.1.2",

"dts-bundle-generator": "^9.5.1",
"esbuild": "^0.21.5",
"esbuild": "^0.23.0",
"esbuild-plugin-import-map": "^2.1.0",
"mocha": "^10.5.2",
"release-it": "^17.4.0",
"mocha": "^10.6.0",
"release-it": "^17.5.0",
"shx": "^0.3.4",
"typedoc": "^0.26.3",
"typescript": "^5.5.2"
"typescript": "^5.5.3"
}
}
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