@k4a_l/dirtreeist 0.1.7 → 0.2.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/README.md +75 -45
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/convert.js +1 -1
- package/dist/modules/options.js +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
# DirTreeist
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Create a directory Structure Diagram from a markdown lists.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
#### tarn
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
yarn add @k4a_l/dirtreeist
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### npm
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
npm install @k4a_l/dirtreeist
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
### Input
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
- /components
|
|
25
|
+
- App.tsx
|
|
26
|
+
- App.css
|
|
27
|
+
- config.json
|
|
28
|
+
- /utils
|
|
29
|
+
- converter.ts
|
|
30
|
+
- parser.ts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Output
|
|
8
34
|
|
|
9
35
|
```text
|
|
10
36
|
├─/components
|
|
@@ -16,24 +42,11 @@
|
|
|
16
42
|
└─parser.ts
|
|
17
43
|
```
|
|
18
44
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
type DirNode = {
|
|
23
|
-
name: string
|
|
24
|
-
children: DirNode[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type DirTree = DirNode[]
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 使い方
|
|
45
|
+
## How to use
|
|
31
46
|
|
|
32
|
-
### TypeScript
|
|
47
|
+
### TypeScript
|
|
33
48
|
|
|
34
49
|
```ts
|
|
35
|
-
import { parse, convert, OptionType } from 'dirTreeist'
|
|
36
|
-
|
|
37
50
|
const markdown = `
|
|
38
51
|
- /components
|
|
39
52
|
- App.tsx
|
|
@@ -43,16 +56,44 @@ const markdown = `
|
|
|
43
56
|
- converter.ts
|
|
44
57
|
- parser.ts
|
|
45
58
|
`
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import dirtreest, { Options } from '@k4a_l/dirtreeist'
|
|
63
|
+
|
|
64
|
+
const options: Options = {}
|
|
65
|
+
const outputs = dirtreest(markdown, options) // DirTree[] => output[]
|
|
66
|
+
|
|
67
|
+
console.log(outputs)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
or
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { parse, convert, Options } from '@k4a_l/dirtreeist'
|
|
46
74
|
|
|
47
75
|
const dirTrees = parse(markdown) // markdown => DirTree[]
|
|
48
76
|
|
|
49
|
-
const options:
|
|
77
|
+
const options: Options = {}
|
|
50
78
|
const outputs = dirTrees.map((dirTree) => convert(dirTree, options)) // DirTree[] => output[]
|
|
51
79
|
|
|
52
80
|
console.log(outputs)
|
|
53
81
|
```
|
|
54
82
|
|
|
55
|
-
|
|
83
|
+
### Type
|
|
84
|
+
|
|
85
|
+
#### Structure
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
type DirNode = {
|
|
89
|
+
name: string
|
|
90
|
+
children: DirNode[]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type DirTree = DirNode[]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Options
|
|
56
97
|
|
|
57
98
|
```ts
|
|
58
99
|
type Options = {
|
|
@@ -63,28 +104,13 @@ type Options = {
|
|
|
63
104
|
}
|
|
64
105
|
```
|
|
65
106
|
|
|
66
|
-
###
|
|
67
|
-
|
|
68
|
-
```shell
|
|
69
|
-
dirTreeist <inputFile> [...options]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
#### オプション
|
|
73
|
-
|
|
74
|
-
```test
|
|
75
|
-
-t, --treeType ['normal'|'bold'|'ascii']
|
|
76
|
-
-e, --empty [boolean]
|
|
77
|
-
-space, --spaceBeforeName [boolean]
|
|
78
|
-
-size, --spaceSize [number]
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### オプションの説明
|
|
107
|
+
### Description of options
|
|
82
108
|
|
|
83
109
|
#### treeType
|
|
84
110
|
|
|
85
|
-
|
|
111
|
+
default:`normal`
|
|
86
112
|
|
|
87
|
-
normal
|
|
113
|
+
##### normal
|
|
88
114
|
|
|
89
115
|
```
|
|
90
116
|
│
|
|
@@ -93,7 +119,7 @@ normal
|
|
|
93
119
|
└─
|
|
94
120
|
```
|
|
95
121
|
|
|
96
|
-
bold
|
|
122
|
+
##### bold
|
|
97
123
|
|
|
98
124
|
```
|
|
99
125
|
┃
|
|
@@ -102,7 +128,7 @@ bold
|
|
|
102
128
|
┗━
|
|
103
129
|
```
|
|
104
130
|
|
|
105
|
-
ascii
|
|
131
|
+
##### ascii
|
|
106
132
|
|
|
107
133
|
```
|
|
108
134
|
|
|
|
@@ -113,7 +139,9 @@ ascii
|
|
|
113
139
|
|
|
114
140
|
#### emptyLineBeforeUpperHierarchy : boolean
|
|
115
141
|
|
|
116
|
-
|
|
142
|
+
default:`false`
|
|
143
|
+
|
|
144
|
+
##### true
|
|
117
145
|
|
|
118
146
|
```text
|
|
119
147
|
(true)
|
|
@@ -129,10 +157,11 @@ ascii
|
|
|
129
157
|
|
|
130
158
|
#### spaceBeforeName : boolean
|
|
131
159
|
|
|
132
|
-
|
|
160
|
+
default: `false`
|
|
161
|
+
|
|
162
|
+
##### true
|
|
133
163
|
|
|
134
164
|
```text
|
|
135
|
-
(true)
|
|
136
165
|
├─ /components
|
|
137
166
|
│ ├─ App.tsx
|
|
138
167
|
│ └─ App.css
|
|
@@ -144,10 +173,11 @@ ascii
|
|
|
144
173
|
|
|
145
174
|
#### spaceSize : number
|
|
146
175
|
|
|
147
|
-
|
|
176
|
+
default:`2`
|
|
177
|
+
|
|
178
|
+
##### 4
|
|
148
179
|
|
|
149
180
|
```text
|
|
150
|
-
(4)
|
|
151
181
|
├──/components
|
|
152
182
|
│ ├──App.tsx
|
|
153
183
|
│ └──App.css
|
package/dist/index.cjs
CHANGED
|
@@ -9918,8 +9918,8 @@ const convert = (dirTree, options) => {
|
|
|
9918
9918
|
return reduce(dirTree, buildOption(options, defaultOptions), '', 0, false);
|
|
9919
9919
|
};
|
|
9920
9920
|
|
|
9921
|
-
const dirtreest = (markdown) => {
|
|
9922
|
-
return parse(markdown).map((dirtree) => convert(dirtree));
|
|
9921
|
+
const dirtreest = (markdown, option) => {
|
|
9922
|
+
return parse(markdown).map((dirtree) => convert(dirtree, option));
|
|
9923
9923
|
};
|
|
9924
9924
|
|
|
9925
9925
|
exports.convert = convert;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parse } from './modules/parse';
|
|
2
2
|
import { convert } from './modules/convert';
|
|
3
|
-
import { DirTree } from './types/index';
|
|
4
|
-
declare const dirtreest: (markdown: string) => string[];
|
|
3
|
+
import { DirTree, Options } from './types/index';
|
|
4
|
+
declare const dirtreest: (markdown: string, option?: Options) => string[];
|
|
5
5
|
export { parse, convert };
|
|
6
6
|
export default dirtreest;
|
|
7
|
-
export type { DirTree };
|
|
7
|
+
export type { DirTree, Options };
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEhD,QAAA,MAAM,SAAS,aAAc,MAAM,WAAW,OAAO,aAEpD,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACzB,eAAe,SAAS,CAAA;AACxB,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parse } from './modules/parse';
|
|
2
2
|
import { convert } from './modules/convert';
|
|
3
|
-
const dirtreest = (markdown) => {
|
|
4
|
-
return parse(markdown).map((dirtree) => convert(dirtree));
|
|
3
|
+
const dirtreest = (markdown, option) => {
|
|
4
|
+
return parse(markdown).map((dirtree) => convert(dirtree, option));
|
|
5
5
|
};
|
|
6
6
|
export { parse, convert };
|
|
7
7
|
export default dirtreest;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAI3C,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAI3C,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,MAAgB,EAAE,EAAE;IACvD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AACnE,CAAC,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACzB,eAAe,SAAS,CAAA"}
|
package/dist/modules/convert.js
CHANGED
package/dist/modules/options.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k4a_l/dirtreeist",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
"import": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"dev": "vite",
|
|
15
15
|
"clean": "rm -rf ./dist/ ",
|
|
16
|
-
"build:esm": "tsc",
|
|
16
|
+
"build:esm": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
|
17
17
|
"build:cjs": "rollup -c rollup.config.js",
|
|
18
18
|
"build": "yarn clean && yarn build:esm && yarn build:cjs",
|
|
19
19
|
"test": "vitest",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"rollup": "^2.79.0",
|
|
36
36
|
"ts-jest": "^28.0.8",
|
|
37
37
|
"ts-node-dev": "^2.0.0",
|
|
38
|
+
"tsc-alias": "^1.7.0",
|
|
38
39
|
"tslib": "^2.4.0",
|
|
39
40
|
"typescript": "^4.8.2",
|
|
40
41
|
"vite-tsconfig-paths": "^3.5.0",
|