@k4a_l/dirtreeist 0.1.0 → 0.1.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/.prettierrc +7 -0
- package/README.md +81 -45
- package/babel.config.js +13 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/convert.d.ts +3 -0
- package/dist/modules/convert.d.ts.map +1 -0
- package/dist/modules/convert.js +6 -0
- package/dist/modules/convert.js.map +1 -0
- package/dist/modules/parse.d.ts +3 -0
- package/dist/modules/parse.d.ts.map +1 -0
- package/dist/modules/parse.js +6 -0
- package/dist/modules/parse.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +14 -4
- package/vitest.config.ts +10 -0
- package/jest.config.js +0 -7
- package/tests/convert.test.js +0 -1
- package/tests/convert.test.ts +0 -0
- package/tests/parser.test.js +0 -1
- package/tests/parser.test.ts +0 -0
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -7,23 +7,24 @@
|
|
|
7
7
|
### ディレクトリ構成図例
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
|
-
|
|
11
|
-
│
|
|
12
|
-
│
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
├─/components
|
|
11
|
+
│ ├─App.tsx
|
|
12
|
+
│ └─App.css
|
|
13
|
+
├─config.json
|
|
14
|
+
└─/utils
|
|
15
|
+
└─converter.ts
|
|
16
|
+
└─parser.ts
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
## DirTree 構造
|
|
19
20
|
|
|
20
21
|
```ts
|
|
21
22
|
type DirNode = {
|
|
22
|
-
name: string
|
|
23
|
-
children: DirNode[]
|
|
24
|
-
}
|
|
23
|
+
name: string
|
|
24
|
+
children: DirNode[]
|
|
25
|
+
}
|
|
25
26
|
|
|
26
|
-
type DirTree = DirNode[]
|
|
27
|
+
type DirTree = DirNode[]
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
## 使い方
|
|
@@ -31,32 +32,35 @@ type DirTree = DirNode[];
|
|
|
31
32
|
### TypeScript Module
|
|
32
33
|
|
|
33
34
|
```ts
|
|
34
|
-
import {
|
|
35
|
+
import { parse, converter, OptionType } from 'dirTreeist'
|
|
35
36
|
|
|
36
|
-
const
|
|
37
|
-
- components
|
|
37
|
+
const markdown = `
|
|
38
|
+
- /components
|
|
38
39
|
- App.tsx
|
|
39
40
|
- App.css
|
|
40
41
|
- config.json
|
|
41
|
-
- utils
|
|
42
|
+
- /utils
|
|
42
43
|
- converter.ts
|
|
43
|
-
|
|
44
|
+
- parser.ts
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
const dirTrees = parse(markdown) // markdown => DirTree[]
|
|
44
48
|
|
|
45
|
-
const
|
|
49
|
+
const options: OptionType = {}
|
|
50
|
+
const outputs = dirTrees.map((dirTree) => converter(dirtree, options)) // DirTree[] => output[]
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
const output = converter(dirtree, options); // DirTree => output(like Demo)
|
|
52
|
+
console.log(outputs)
|
|
49
53
|
```
|
|
50
54
|
|
|
51
55
|
#### オプション
|
|
52
56
|
|
|
53
57
|
```ts
|
|
54
|
-
type
|
|
55
|
-
treeType?:
|
|
56
|
-
emptyBeforeUpperHierarche?: boolean
|
|
57
|
-
spaceBeforeName?: boolean
|
|
58
|
-
spaceSize?:
|
|
59
|
-
}
|
|
58
|
+
type Options = {
|
|
59
|
+
treeType?: 'normal' | 'bold' | 'ascii'
|
|
60
|
+
emptyBeforeUpperHierarche?: boolean
|
|
61
|
+
spaceBeforeName?: boolean
|
|
62
|
+
spaceSize?: number
|
|
63
|
+
}
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
### CLI
|
|
@@ -68,7 +72,7 @@ dirTreeist <inputFile> [...options]
|
|
|
68
72
|
#### オプション
|
|
69
73
|
|
|
70
74
|
```test
|
|
71
|
-
-t, --treeType [
|
|
75
|
+
-t, --treeType ['normal'|'bold'|'ascii']
|
|
72
76
|
-e, --empty [boolean]
|
|
73
77
|
-space, --spaceBeforeName [boolean]
|
|
74
78
|
-size, --spaceSize [number]
|
|
@@ -76,19 +80,51 @@ dirTreeist <inputFile> [...options]
|
|
|
76
80
|
|
|
77
81
|
### オプションの説明
|
|
78
82
|
|
|
83
|
+
#### treeType
|
|
84
|
+
|
|
85
|
+
デフォルト値:normal
|
|
86
|
+
|
|
87
|
+
normal
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
│
|
|
91
|
+
├─
|
|
92
|
+
│
|
|
93
|
+
└─
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
bold
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
┃
|
|
100
|
+
┣━
|
|
101
|
+
┃
|
|
102
|
+
┗━
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
ascii
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
|
|
|
109
|
+
+
|
|
110
|
+
|
|
|
111
|
+
+-
|
|
112
|
+
```
|
|
113
|
+
|
|
79
114
|
#### emptyLineBeforeUpperHierarchy : boolean
|
|
80
115
|
|
|
81
116
|
デフォルト値:false
|
|
82
117
|
|
|
83
118
|
```text
|
|
84
119
|
(true)
|
|
85
|
-
|
|
86
|
-
│
|
|
87
|
-
│
|
|
120
|
+
├─/components
|
|
121
|
+
│ ├─App.tsx
|
|
122
|
+
│ └─App.css
|
|
88
123
|
│
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
124
|
+
├─config.json
|
|
125
|
+
└─/utils
|
|
126
|
+
└─converter.ts
|
|
127
|
+
└─parser.ts
|
|
92
128
|
```
|
|
93
129
|
|
|
94
130
|
#### spaceBeforeName : boolean
|
|
@@ -97,13 +133,13 @@ dirTreeist <inputFile> [...options]
|
|
|
97
133
|
|
|
98
134
|
```text
|
|
99
135
|
(true)
|
|
100
|
-
|
|
101
|
-
│
|
|
102
|
-
│
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
136
|
+
├─ /components
|
|
137
|
+
│ ├─ App.tsx
|
|
138
|
+
│ └─ App.css
|
|
139
|
+
├─ config.json
|
|
140
|
+
└─ /utils
|
|
141
|
+
└─ converter.ts
|
|
142
|
+
└─ parser.ts
|
|
107
143
|
```
|
|
108
144
|
|
|
109
145
|
#### spaceSize : number
|
|
@@ -112,11 +148,11 @@ dirTreeist <inputFile> [...options]
|
|
|
112
148
|
|
|
113
149
|
```text
|
|
114
150
|
(4)
|
|
115
|
-
|
|
116
|
-
│ ├──
|
|
117
|
-
│ └──
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
├──/components
|
|
152
|
+
│ ├──App.tsx
|
|
153
|
+
│ └──App.css
|
|
154
|
+
├──config.json
|
|
155
|
+
└──/utils
|
|
156
|
+
└──converter.ts
|
|
157
|
+
└──parser.ts
|
|
122
158
|
```
|
package/babel.config.js
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convert = exports.parse = void 0;
|
|
4
|
+
const parse_1 = require("./modules/parse");
|
|
5
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
|
|
6
|
+
const convert_1 = require("./modules/convert");
|
|
7
|
+
Object.defineProperty(exports, "convert", { enumerable: true, get: function () { return convert_1.convert; } });
|
|
3
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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAK/B,sFALA,aAAK,OAKA;AAJd,+CAA4C;AAI5B,wFAJP,iBAAO,OAIO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,YAAW,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEhB,0BAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,YAAW,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":";;;AAAA,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEd,sBAAK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAAC;AAEF,aAAK,OAAO,GAAG,OAAO,EAAE,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k4a_l/dirtreeist",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "kasahala",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "ts-node-dev --respawn src/index.ts",
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"test": "
|
|
10
|
+
"build": "rm -rf ./dist/ && tsc",
|
|
11
|
+
"test": "vitest",
|
|
12
|
+
"coverage": "vitest run --coverage"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@types/jest": "^29.0.0",
|
|
16
|
+
"@types/mdast": "^3.0.10",
|
|
15
17
|
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
16
18
|
"@typescript-eslint/parser": "^5.36.2",
|
|
17
19
|
"eslint": "^8.23.0",
|
|
@@ -20,6 +22,14 @@
|
|
|
20
22
|
"prettier": "^2.7.1",
|
|
21
23
|
"ts-jest": "^28.0.8",
|
|
22
24
|
"ts-node-dev": "^2.0.0",
|
|
23
|
-
"typescript": "^4.8.2"
|
|
25
|
+
"typescript": "^4.8.2",
|
|
26
|
+
"vite-tsconfig-paths": "^3.5.0",
|
|
27
|
+
"vitest": "^0.23.1"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"mdast-util-from-markdown": "^1.2.0",
|
|
31
|
+
"remark-parse": "^10.0.1",
|
|
32
|
+
"ts-dedent": "^2.2.0",
|
|
33
|
+
"unified": "^10.1.2"
|
|
24
34
|
}
|
|
25
35
|
}
|
package/vitest.config.ts
ADDED
package/jest.config.js
DELETED
package/tests/convert.test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/tests/convert.test.ts
DELETED
|
File without changes
|
package/tests/parser.test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/tests/parser.test.ts
DELETED
|
File without changes
|