@design-edito/tools 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- package/components/Comp/index.d.ts +1 -0
- package/components/Comp/index.js +1 -0
- package/index.js +14 -0
- package/package.json +33 -0
- package/utils/agnostic/find-duplicates-in-array/index.d.ts +1 -0
- package/utils/agnostic/find-duplicates-in-array/index.js +1 -0
- package/utils/agnostic/is-record/index.d.ts +1 -0
- package/utils/agnostic/is-record/index.js +1 -0
- package/utils/node/is-in-directory/index.d.ts +1 -0
- package/utils/node/is-in-directory/index.js +1 -0
- package/utils/node/list-subdirectories-indexes/index.d.ts +1 -0
- package/utils/node/list-subdirectories-indexes/index.js +1 -0
- package/utils/node/list-subpaths/index.d.ts +27 -0
- package/utils/node/list-subpaths/index.js +1 -0
- package/utils/node/read-write-file/index.d.ts +12 -0
- package/utils/node/read-write-file/index.js +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
export default function Comp(): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{Fragment as u,jsx as f}from"react/jsx-runtime";function o(){return f(u,{children:"Coucou !"})}export{o as default};
|
package/index.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as Comp from './components/Comp/index.js'
|
2
|
+
import * as findDuplicatesInArray from './utils/agnostic/find-duplicates-in-array/index.js'
|
3
|
+
import * as isRecord from './utils/agnostic/is-record/index.js'
|
4
|
+
import * as isInDirectory from './utils/node/is-in-directory/index.js'
|
5
|
+
import * as listSubdirectoriesIndexes from './utils/node/list-subdirectories-indexes/index.js'
|
6
|
+
import * as listSubpaths from './utils/node/list-subpaths/index.js'
|
7
|
+
import * as readWriteFile from './utils/node/read-write-file/index.js'
|
8
|
+
export { Comp }
|
9
|
+
export { findDuplicatesInArray }
|
10
|
+
export { isRecord }
|
11
|
+
export { isInDirectory }
|
12
|
+
export { listSubdirectoriesIndexes }
|
13
|
+
export { listSubpaths }
|
14
|
+
export { readWriteFile }
|
package/package.json
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"name": "@design-edito/tools",
|
3
|
+
"version": "0.0.19",
|
4
|
+
"description": "",
|
5
|
+
"author": "Maxime Fabas",
|
6
|
+
"license": "ISC",
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/lm-design-edito/lm-tools"
|
10
|
+
},
|
11
|
+
"type": "module",
|
12
|
+
"main": "index.js",
|
13
|
+
"module": "index.js",
|
14
|
+
"dependencies": {},
|
15
|
+
"peerDependencies": {
|
16
|
+
"react": "^18.2.0",
|
17
|
+
"react-dom": "^18.2.0"
|
18
|
+
},
|
19
|
+
"devDependencies": {
|
20
|
+
"@types/d3": "^7.4.3",
|
21
|
+
"@types/node": "^20.11.30",
|
22
|
+
"@types/prompts": "^2.4.9",
|
23
|
+
"@types/react": "^18.2.72",
|
24
|
+
"@types/react-dom": "^18.2.22",
|
25
|
+
"@types/semver": "^7.5.8",
|
26
|
+
"camelcase": "^8.0.0",
|
27
|
+
"esbuild": "^0.20.2",
|
28
|
+
"prompts": "^2.4.2",
|
29
|
+
"semver": "^7.6.0",
|
30
|
+
"simple-git": "^3.23.0",
|
31
|
+
"typescript": "^5.4.3"
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function findDuplicatesInArray<T>(arr: T[], stopAtFirst?: boolean): T[];
|
@@ -0,0 +1 @@
|
|
1
|
+
function o(a,r=!1){let n=new Set,t=new Set;for(let e of a){if(n.has(e)&&r)return[e];n.has(e)&&t.add(e),n.add(e)}return Array.from(t)}export{o as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function isRecord(input: unknown): input is Record<string, unknown>;
|
@@ -0,0 +1 @@
|
|
1
|
+
function r(e){return typeof e!="object"||e===null?!1:Object.keys(e).every(n=>typeof n=="string")}export{r as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function isInDirectory(childPath: string, parentPath: string): boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
import e from"node:path";function n(r,i){let t=e.relative(i,r);return t!==""&&!t.startsWith("..")}export{n as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function listSubdirectoriesIndexes(root: string, extensions?: string[]): Promise<string[]>;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{promises as t,existsSync as d}from"node:fs";import n from"node:path";async function l(r,i){if(!d(r))return[];if(!(await t.stat(r)).isDirectory())return[];let c=(await t.readdir(r)).map(e=>n.join(r,e));return(await Promise.all(c.map(async e=>{try{if(!d(e))return!1;if(!(await t.stat(e)).isDirectory())return;let s=(await t.readdir(e)).find(o=>{let a=n.extname(o).toLowerCase(),f=n.basename(o,a),m=i!==void 0?i.includes(a):!0;return!!(f==="index"&&m)});return s===void 0?!1:n.join(e,s)}catch{return}}))).filter(e=>e!==void 0)}export{l as default};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { Stats } from 'node:fs';
|
3
|
+
export type ChildType = 'file' | 'directory' | 'symlink';
|
4
|
+
export type ChildDetails = {
|
5
|
+
type: ChildType;
|
6
|
+
hidden: boolean;
|
7
|
+
realPath: string;
|
8
|
+
};
|
9
|
+
export type Options = {
|
10
|
+
directories?: boolean;
|
11
|
+
files?: boolean;
|
12
|
+
symlinks?: boolean;
|
13
|
+
hidden?: boolean;
|
14
|
+
followSimlinks?: boolean;
|
15
|
+
dedupeSimlinksContents?: boolean;
|
16
|
+
maxDepth?: number;
|
17
|
+
filter?: (path: string, details: ChildDetails) => boolean | Promise<boolean>;
|
18
|
+
};
|
19
|
+
export declare const defaultOptions: Required<Options>;
|
20
|
+
export declare const fillOptions: (input: Options) => Required<Options>;
|
21
|
+
export type Context = {
|
22
|
+
depth?: number;
|
23
|
+
lstats?: Stats | null;
|
24
|
+
};
|
25
|
+
export declare const defaultContext: Required<Context>;
|
26
|
+
export declare const fillContext: (input: Context) => Required<Context>;
|
27
|
+
export default function listSubpaths(inputPath: string, _options?: Options, _context?: Context): Promise<string[]>;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{promises as a}from"node:fs";import u from"node:path";var S={directories:!0,files:!0,symlinks:!0,hidden:!0,followSimlinks:!1,dedupeSimlinksContents:!1,maxDepth:1/0,filter:()=>!0},k=i=>({...S,...i}),C={depth:0,lstats:null},D=i=>({...C,...i});async function p(i,m={},y={}){let t=k(m),l=D(y),s=[];if(l.depth>t.maxDepth||!(l.lstats??await a.lstat(i)).isDirectory())return s;let b=await a.readdir(i);return await Promise.all(b.map(async w=>{let e=u.join(i,w),r=await a.lstat(e);try{let o=r.isDirectory(),n=r.isSymbolicLink(),h=!o&&!n,f=u.basename(e).startsWith("."),x=o?"directory":n?"symlink":"file";if(o&&t.directories===!1)throw!0;if(n&&t.symlinks===!1||h&&t.files===!1||f&&t.hidden===!1)throw!1;let d=n?await a.realpath(e):e;if(!await t.filter(e,{type:x,hidden:f,realPath:d}))throw!0;if(n)if(t.followSimlinks===!1)s.push(e);else{let c=await p(d,t,{depth:l.depth+1});s.push(d,...c)}else if(o){let c=await p(e,t,{depth:l.depth+1,lstats:r});s.push(e,...c)}else s.push(e)}catch(o){if(typeof o!="boolean")throw new Error("This try/catch block should only throw booleans");if(!o)return[];let h=await p(e,t,{depth:l.depth+1,lstats:r});s.push(...h)}})),t.dedupeSimlinksContents?Array.from(new Set(s)):s}export{p as default,C as defaultContext,S as defaultOptions,D as fillContext,k as fillOptions};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
/// <reference types="node" />
|
4
|
+
import { promises as fs } from 'node:fs';
|
5
|
+
type Path = Parameters<typeof fs.writeFile>[0];
|
6
|
+
type ReadFileData = Awaited<ReturnType<typeof fs.readFile>>;
|
7
|
+
type WriteFileData = Parameters<typeof fs.writeFile>[1];
|
8
|
+
type ReadOptions = Parameters<typeof fs.readFile>[1];
|
9
|
+
type WriteOptions = Parameters<typeof fs.writeFile>[2];
|
10
|
+
export type EditorFunc = (curr: ReadFileData) => WriteFileData;
|
11
|
+
export default function readWriteFile(path: Path, editor: EditorFunc, ...options: [ReadOptions?, WriteOptions?]): Promise<string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | import("stream").Stream>;
|
12
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{promises as r}from"node:fs";async function d(e,s,...t){let[i,o]=t,p=await r.readFile(e,i),a=s(p),n=t.length===2?o:i;return await r.writeFile(e,a,n),a}export{d as default};
|