@owservable/folders 1.7.9 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/functions/add.files.from.folder.d.ts +1 -1
- package/lib/functions/add.files.from.folder.js +15 -7
- package/lib/functions/add.files.from.folder.js.map +1 -1
- package/lib/functions/list.subfolders.by.name.d.ts +1 -1
- package/lib/functions/list.subfolders.by.name.js +17 -8
- package/lib/functions/list.subfolders.by.name.js.map +1 -1
- package/lib/functions/list.subfolders.files.by.folder.name.d.ts +1 -1
- package/lib/functions/list.subfolders.files.by.folder.name.js +1 -2
- package/lib/functions/list.subfolders.files.by.folder.name.js.map +1 -1
- package/lib/interfaces/item.stat.interface.d.ts +5 -0
- package/lib/interfaces/item.stat.interface.js +3 -0
- package/lib/interfaces/item.stat.interface.js.map +1 -0
- package/lib/owservable.folders.d.ts +2 -1
- package/lib/owservable.folders.js.map +1 -1
- package/package.json +5 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const addFilesFromFolder:
|
|
1
|
+
declare const addFilesFromFolder: Function;
|
|
2
2
|
export default addFilesFromFolder;
|
|
@@ -2,16 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
5
|
const addFilesFromFolder = (files, folder) => {
|
|
7
6
|
const subfolderNames = fs.readdirSync(folder);
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const itemStats = subfolderNames.map((name) => {
|
|
8
|
+
const fullPath = path.join(folder, name);
|
|
9
|
+
const stat = fs.lstatSync(fullPath);
|
|
10
|
+
return {
|
|
11
|
+
name,
|
|
12
|
+
fullPath,
|
|
13
|
+
isDirectory: stat.isDirectory()
|
|
14
|
+
};
|
|
11
15
|
});
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const subFiles = itemStats.filter((item) => !item.isDirectory);
|
|
17
|
+
const subFolders = itemStats.filter((item) => item.isDirectory);
|
|
18
|
+
subFiles.forEach((file) => {
|
|
19
|
+
files.push(file.fullPath);
|
|
20
|
+
});
|
|
21
|
+
subFolders.forEach((subFolder) => {
|
|
22
|
+
files = addFilesFromFolder(files, subFolder.fullPath);
|
|
15
23
|
});
|
|
16
24
|
return files;
|
|
17
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.files.from.folder.js","sourceRoot":"","sources":["../../src/functions/add.files.from.folder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;
|
|
1
|
+
{"version":3,"file":"add.files.from.folder.js","sourceRoot":"","sources":["../../src/functions/add.files.from.folder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAI7B,MAAM,kBAAkB,GAAa,CAAC,KAAe,EAAE,MAAc,EAAY,EAAE;IAClF,MAAM,cAAc,GAAa,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAGxD,MAAM,SAAS,GAAe,cAAc,CAAC,GAAG,CAAC,CAAC,IAAY,EAAY,EAAE;QAC3E,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,IAAI,GAAa,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO;YACN,IAAI;YACJ,QAAQ;YACR,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SAC/B,CAAC;IACH,CAAC,CAAC,CAAC;IAGH,MAAM,QAAQ,GAAe,SAAS,CAAC,MAAM,CAAC,CAAC,IAAc,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9F,MAAM,UAAU,GAAe,SAAS,CAAC,MAAM,CAAC,CAAC,IAAc,EAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAG/F,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAc,EAAQ,EAAE;QACzC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAGH,UAAU,CAAC,OAAO,CAAC,CAAC,SAAmB,EAAQ,EAAE;QAChD,KAAK,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const listSubfoldersByName:
|
|
1
|
+
declare const listSubfoldersByName: Function;
|
|
2
2
|
export default listSubfoldersByName;
|
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
5
|
const listSubfoldersByName = (root, folderName) => {
|
|
7
6
|
let folders = [];
|
|
8
7
|
const subfolderNames = fs.readdirSync(root);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const itemStats = subfolderNames.map((name) => {
|
|
9
|
+
const fullPath = path.join(root, name);
|
|
10
|
+
const stat = fs.lstatSync(fullPath);
|
|
11
|
+
return {
|
|
12
|
+
name,
|
|
13
|
+
fullPath,
|
|
14
|
+
isDirectory: stat.isDirectory()
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
const subfolders = itemStats.filter((item) => item.isDirectory);
|
|
18
|
+
subfolders.forEach((subfolder) => {
|
|
19
|
+
if (folderName === subfolder.name) {
|
|
20
|
+
folders.push(subfolder.fullPath);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
folders = folders.concat(listSubfoldersByName(subfolder.fullPath, folderName));
|
|
24
|
+
}
|
|
16
25
|
});
|
|
17
26
|
return folders;
|
|
18
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.subfolders.by.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.by.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;
|
|
1
|
+
{"version":3,"file":"list.subfolders.by.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.by.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAI7B,MAAM,oBAAoB,GAAa,CAAC,IAAY,EAAE,UAAkB,EAAY,EAAE;IACrF,IAAI,OAAO,GAAa,EAAE,CAAC;IAE3B,MAAM,cAAc,GAAa,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAGtD,MAAM,SAAS,GAAe,cAAc,CAAC,GAAG,CAAC,CAAC,IAAY,EAAY,EAAE;QAC3E,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAa,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO;YACN,IAAI;YACJ,QAAQ;YACR,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SAC/B,CAAC;IACH,CAAC,CAAC,CAAC;IAGH,MAAM,UAAU,GAAe,SAAS,CAAC,MAAM,CAAC,CAAC,IAAc,EAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAG/F,UAAU,CAAC,OAAO,CAAC,CAAC,SAAmB,EAAQ,EAAE;QAChD,IAAI,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YAEP,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;QAChF,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const listSubfoldersFilesByFolderName:
|
|
1
|
+
declare const listSubfoldersFilesByFolderName: Function;
|
|
2
2
|
export default listSubfoldersFilesByFolderName;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lodash_1 = require("lodash");
|
|
4
3
|
const add_files_from_folder_1 = require("./add.files.from.folder");
|
|
5
4
|
const list_subfolders_by_name_1 = require("./list.subfolders.by.name");
|
|
6
5
|
const listSubfoldersFilesByFolderName = (root, name) => {
|
|
7
6
|
let files = [];
|
|
8
7
|
const folders = (0, list_subfolders_by_name_1.default)(root, name);
|
|
9
|
-
|
|
8
|
+
folders.forEach((folder) => {
|
|
10
9
|
files = (0, add_files_from_folder_1.default)(files, folder);
|
|
11
10
|
});
|
|
12
11
|
return files;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.subfolders.files.by.folder.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.files.by.folder.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,
|
|
1
|
+
{"version":3,"file":"list.subfolders.files.by.folder.name.js","sourceRoot":"","sources":["../../src/functions/list.subfolders.files.by.folder.name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,mEAAyD;AACzD,uEAA6D;AAE7D,MAAM,+BAA+B,GAAa,CAAC,IAAY,EAAE,IAAY,EAAY,EAAE;IAC1F,IAAI,KAAK,GAAa,EAAE,CAAC;IACzB,MAAM,OAAO,GAAa,IAAA,iCAAoB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAG3D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAc,EAAQ,EAAE;QACxC,KAAK,GAAG,IAAA,+BAAkB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.stat.interface.js","sourceRoot":"","sources":["../../src/interfaces/item.stat.interface.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import addFilesFromFolder from './functions/add.files.from.folder';
|
|
2
2
|
import listSubfoldersByName from './functions/list.subfolders.by.name';
|
|
3
3
|
import listSubfoldersFilesByFolderName from './functions/list.subfolders.files.by.folder.name';
|
|
4
|
-
|
|
4
|
+
import { ItemStat } from './interfaces/item.stat.interface';
|
|
5
|
+
export { addFilesFromFolder, listSubfoldersByName, listSubfoldersFilesByFolderName, ItemStat };
|
|
5
6
|
declare const OwservableFolders: {};
|
|
6
7
|
export default OwservableFolders;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owservable.folders.js","sourceRoot":"","sources":["../src/owservable.folders.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAGb,6EAAmE;
|
|
1
|
+
{"version":3,"file":"owservable.folders.js","sourceRoot":"","sources":["../src/owservable.folders.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAGb,6EAAmE;AASlE,6BATM,+BAAkB,CASN;AARnB,iFAAuE;AAStE,+BATM,iCAAoB,CASN;AARrB,2GAA+F;AAS9F,0CATM,8CAA+B,CASN;AAMhC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,kBAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owservable/folders",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "get files and folders",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"sync": "git pull & git fetch origin & git merge origin/main & pnpm i & git branch",
|
|
27
27
|
"docs": "typedoc --readme none --out docs src/owservable.folders.ts",
|
|
28
28
|
"test": "jest --coverage --config jest.config.js",
|
|
29
|
+
"quick": "jest --config jest.config.js",
|
|
29
30
|
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
|
|
30
31
|
"sonar": "sonarjs -e .sonarlint/**,node_modules/**,coverage/**,.nyc_output/**",
|
|
31
32
|
"test_qube": "jest --testResultsProcessor=jest-sonar-reporter",
|
|
@@ -36,9 +37,7 @@
|
|
|
36
37
|
"preinstall": "npx only-allow pnpm"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/node": "^24.1.0",
|
|
41
|
-
"lodash": "^4.17.20"
|
|
40
|
+
"@types/node": "^24.1.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@types/jest": "^30.0.0",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"tslint-config-prettier": "^1.18.0",
|
|
56
55
|
"tslint-etc": "^1.13.7",
|
|
57
56
|
"typedoc": "^0.28.8",
|
|
58
|
-
"typescript": "^5.
|
|
57
|
+
"typescript": "^5.9.2"
|
|
59
58
|
},
|
|
60
59
|
"pnpm": {
|
|
61
60
|
"allowedDeprecatedVersions": {
|
|
@@ -82,5 +81,5 @@
|
|
|
82
81
|
},
|
|
83
82
|
"neverBuiltDependencies": []
|
|
84
83
|
},
|
|
85
|
-
"packageManager": "pnpm@10.
|
|
84
|
+
"packageManager": "pnpm@10.14.0"
|
|
86
85
|
}
|