@k4a_l/dirtreeist 0.1.6 → 0.2.0

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # DirTreeist
2
+ Create a directory Structure Diagram from a markdown lists.
2
3
 
3
- マークダウンのリスト構造や DirTree 構造からディレクトリ構成図を作成します。
4
+ ## Example
5
+ ### Input
4
6
 
5
- ## Demo
7
+ ```markdown
8
+ - /components
9
+ - App.tsx
10
+ - App.css
11
+ - config.json
12
+ - /utils
13
+ - converter.ts
14
+ - parser.ts
15
+ ```
6
16
 
7
- ### ディレクトリ構成図例
17
+ ### Output
8
18
 
9
19
  ```text
10
20
  ├─/components
@@ -16,24 +26,11 @@
16
26
  └─parser.ts
17
27
  ```
18
28
 
19
- ## DirTree 構造
20
-
21
- ```ts
22
- type DirNode = {
23
- name: string
24
- children: DirNode[]
25
- }
26
-
27
- type DirTree = DirNode[]
28
- ```
29
-
30
- ## 使い方
29
+ ## How to use
31
30
 
32
- ### TypeScript Module
31
+ ### TypeScript
33
32
 
34
33
  ```ts
35
- import { parse, convert, OptionType } from 'dirTreeist'
36
-
37
34
  const markdown = `
38
35
  - /components
39
36
  - App.tsx
@@ -43,16 +40,44 @@ const markdown = `
43
40
  - converter.ts
44
41
  - parser.ts
45
42
  `
43
+ ```
44
+
45
+ ```tsx
46
+ import dirtreest, { Options } from '@k4a_l/dirtreeist'
47
+
48
+ const options: Options = {}
49
+ const outputs = dirtreest(markdown, options) // DirTree[] => output[]
50
+
51
+ console.log(outputs)
52
+ ```
53
+
54
+ or
55
+
56
+ ```tsx
57
+ import { parse, convert, Options } from '@k4a_l/dirtreeist'
46
58
 
47
59
  const dirTrees = parse(markdown) // markdown => DirTree[]
48
60
 
49
- const options: OptionType = {}
61
+ const options: Options = {}
50
62
  const outputs = dirTrees.map((dirTree) => convert(dirTree, options)) // DirTree[] => output[]
51
63
 
52
64
  console.log(outputs)
53
65
  ```
54
66
 
55
- #### オプション
67
+ ### Type
68
+
69
+ #### Structure
70
+
71
+ ```ts
72
+ type DirNode = {
73
+ name: string
74
+ children: DirNode[]
75
+ }
76
+
77
+ type DirTree = DirNode[]
78
+ ```
79
+
80
+ #### Options
56
81
 
57
82
  ```ts
58
83
  type Options = {
@@ -63,28 +88,13 @@ type Options = {
63
88
  }
64
89
  ```
65
90
 
66
- ### CLI
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
- ### オプションの説明
91
+ ### Description of options
82
92
 
83
93
  #### treeType
84
94
 
85
- デフォルト値:normal
95
+ default:`normal`
86
96
 
87
- normal
97
+ ##### normal
88
98
 
89
99
  ```
90
100
 
@@ -93,7 +103,7 @@ normal
93
103
  └─
94
104
  ```
95
105
 
96
- bold
106
+ ##### bold
97
107
 
98
108
  ```
99
109
 
@@ -102,7 +112,7 @@ bold
102
112
  ┗━
103
113
  ```
104
114
 
105
- ascii
115
+ ##### ascii
106
116
 
107
117
  ```
108
118
  |
@@ -113,7 +123,9 @@ ascii
113
123
 
114
124
  #### emptyLineBeforeUpperHierarchy : boolean
115
125
 
116
- デフォルト値:false
126
+ default:`false`
127
+
128
+ ##### true
117
129
 
118
130
  ```text
119
131
  (true)
@@ -129,10 +141,11 @@ ascii
129
141
 
130
142
  #### spaceBeforeName : boolean
131
143
 
132
- デフォルト値:false
144
+ default: `false`
145
+
146
+ ##### true
133
147
 
134
148
  ```text
135
- (true)
136
149
  ├─ /components
137
150
  │ ├─ App.tsx
138
151
  │ └─ App.css
@@ -144,10 +157,11 @@ ascii
144
157
 
145
158
  #### spaceSize : number
146
159
 
147
- デフォルト値:2
160
+ default:`2`
161
+
162
+ ##### 4
148
163
 
149
164
  ```text
150
- (4)
151
165
  ├──/components
152
166
  │ ├──App.tsx
153
167
  │ └──App.css
package/dist/index.cjs CHANGED
@@ -9918,10 +9918,9 @@ 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));
9923
- };
9924
- console.log('hello');
9921
+ const dirtreest = (markdown, option) => {
9922
+ return parse(markdown).map((dirtree) => convert(dirtree, option));
9923
+ };
9925
9924
 
9926
9925
  exports.convert = convert;
9927
9926
  exports["default"] = dirtreest;
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
@@ -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;AAEvC,QAAA,MAAM,SAAS,aAAc,MAAM,aAElC,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAEzB,eAAe,SAAS,CAAA;AACxB,YAAY,EAAE,OAAO,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,9 +1,8 @@
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;
8
- console.log('hello');
9
8
  //# sourceMappingURL=index.js.map
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;IACrC,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAEzB,eAAe,SAAS,CAAA;AAGxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k4a_l/dirtreeist",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  "import": "./dist/index.js",