my-gadgetry 1.0.11 → 1.0.12
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/dist/_core/fs.d.ts +1 -0
- package/dist/{_internal/dev-ops/package-generator/generate-alias/get-files.js → _core/fs.js} +2 -2
- package/dist/_internal/dev-ops/package-generator/generate-alias/get-aliases.js +2 -2
- package/dist/_internal/fs.d.ts +1 -0
- package/dist/_internal/fs.js +1 -0
- package/dist/modules/fs.d.ts +1 -0
- package/dist/modules/fs.js +1 -0
- package/fs/package.json +6 -0
- package/package.json +3 -1
- package/src/{_internal/dev-ops/package-generator/generate-alias/get-files.ts → _core/fs.ts} +2 -2
- package/src/_internal/dev-ops/package-generator/generate-alias/get-aliases.ts +2 -2
- package/src/_internal/fs.ts +1 -0
- package/src/modules/fs.ts +1 -0
- package/dist/_internal/dev-ops/package-generator/generate-alias/get-files.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAllFiles: (dir: string, _files?: string[]) => string[];
|
package/dist/{_internal/dev-ops/package-generator/generate-alias/get-files.js → _core/fs.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { statSync, readdirSync } from 'fs';
|
|
2
|
-
export const
|
|
2
|
+
export const getAllFiles = (dir, _files = []) => {
|
|
3
3
|
const files = readdirSync(dir);
|
|
4
4
|
for (const file of files) {
|
|
5
5
|
const name = dir + '/' + file;
|
|
6
6
|
if (statSync(name).isDirectory()) {
|
|
7
|
-
|
|
7
|
+
getAllFiles(name, _files);
|
|
8
8
|
}
|
|
9
9
|
else {
|
|
10
10
|
_files.push(name);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllFiles } from '../../../../_core/fs.js';
|
|
2
2
|
export const getAliases = (path, excludes) => {
|
|
3
3
|
const regExp = new RegExp(`^${path}/`);
|
|
4
4
|
const excludesExp = new RegExp(excludes.join('|'));
|
|
5
|
-
const aliases =
|
|
5
|
+
const aliases = getAllFiles(path).map(path => path.replace(regExp, '').replace(/\.ts$/, ''));
|
|
6
6
|
if (excludes.length) {
|
|
7
7
|
return aliases.filter(path => !excludesExp.test(path));
|
|
8
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../_core/fs.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../_core/fs.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../_internal/fs.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../_internal/fs.js';
|
package/fs/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-gadgetry",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.12",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"repository": {
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"./converters/number": "./dist/modules/converters/number.js",
|
|
89
89
|
"./converters/string": "./dist/modules/converters/string.js",
|
|
90
90
|
"./dev-ops/package-generator/generate-alias": "./dist/modules/dev-ops/package-generator/generate-alias.js",
|
|
91
|
+
"./fs": "./dist/modules/fs.js",
|
|
91
92
|
"./type-check": "./dist/modules/type-check.js",
|
|
92
93
|
"./package.json": "./package.json"
|
|
93
94
|
},
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
"color",
|
|
98
99
|
"converters",
|
|
99
100
|
"dev-ops",
|
|
101
|
+
"fs",
|
|
100
102
|
"type-check",
|
|
101
103
|
"src",
|
|
102
104
|
"package.json",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { statSync, readdirSync } from 'fs'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const getAllFiles = (dir: string, _files: string[] = []) => {
|
|
4
4
|
const files = readdirSync(dir)
|
|
5
5
|
for (const file of files) {
|
|
6
6
|
const name = dir + '/' + file
|
|
7
7
|
if (statSync(name).isDirectory()) {
|
|
8
|
-
|
|
8
|
+
getAllFiles(name, _files)
|
|
9
9
|
} else {
|
|
10
10
|
_files.push(name)
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllFiles } from '~core/fs.js'
|
|
2
2
|
|
|
3
3
|
export const getAliases = (path: string, excludes: string[]) => {
|
|
4
4
|
const regExp = new RegExp(`^${path}/`)
|
|
5
5
|
const excludesExp = new RegExp(excludes.join('|'))
|
|
6
|
-
const aliases =
|
|
6
|
+
const aliases = getAllFiles(path).map(path => path.replace(regExp, '').replace(/\.ts$/, ''))
|
|
7
7
|
if (excludes.length) {
|
|
8
8
|
return aliases.filter(path => !excludesExp.test(path))
|
|
9
9
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '~core/fs.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '~internal/fs.js'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getFiles: (dir: string, _files?: string[]) => string[];
|