@k4a_l/dirtreeist 0.1.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/.eslint.js ADDED
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ root: true, // .eslintrc.jsがプロジェクトのルートに配置させているか(指定がないと上位階層へ設定ファイルを探索される)
3
+ parser: "@typescript-eslint/parser", // ESLintにTypeScriptを理解させる
4
+ parserOptions: {},
5
+ plugins: [
6
+ "@typescript-eslint", // ESLintのTypeScriptプラグインのルールを適用できる様にする(/eslint-pluginは省略可)
7
+ ],
8
+ extends: [
9
+ "eslint:recommended", // ESLintのJavaScriptルールセットを適用
10
+ "plugin:@typescript-eslint/eslint-recommended", // eslint:recommendedに含まれるルールを型チェックでカバーできるものは無効化
11
+ "plugin:@typescript-eslint/recommended", // 型チェックが不要なルールを適用
12
+ "plugin:@typescript-eslint/recommended-requiring-type-checking", // 型チェックが必要なルールを適用
13
+ "prettier",
14
+ "prettier/@typescript-eslint", // eslint-config-prettierがv8.0.0以上の場合不要です
15
+ ],
16
+ };
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # DirTreeist
2
+
3
+ マークダウンのリスト構造や DirTree 構造からディレクトリ構成図を作成します。
4
+
5
+ ## Demo
6
+
7
+ ### ディレクトリ構成図例
8
+
9
+ ```text
10
+ ├──components
11
+ │ ├──App.tsx
12
+ │ └──App.css
13
+ ├──config.json
14
+ └──utils
15
+ └──converter.ts
16
+ ```
17
+
18
+ ## DirTree 構造
19
+
20
+ ```ts
21
+ type DirNode = {
22
+ name: string;
23
+ children: DirNode[];
24
+ };
25
+
26
+ type DirTree = DirNode[];
27
+ ```
28
+
29
+ ## 使い方
30
+
31
+ ### TypeScript Module
32
+
33
+ ```ts
34
+ import { parser, converter, OptionType } from "dirTreeist";
35
+
36
+ const markdownList = `
37
+ - components
38
+ - App.tsx
39
+ - App.css
40
+ - config.json
41
+ - utils
42
+ - converter.ts
43
+ `;
44
+
45
+ const dirTree = parser(markdownList); // markdown => DirTree
46
+
47
+ const options: OptionType = {};
48
+ const output = converter(dirtree, options); // DirTree => output(like Demo)
49
+ ```
50
+
51
+ #### オプション
52
+
53
+ ```ts
54
+ type OptionType = {
55
+ treeType?: 1 | 2 | 3;
56
+ emptyBeforeUpperHierarche?: boolean;
57
+ spaceBeforeName?: boolean;
58
+ spaceSize?: boolean;
59
+ };
60
+ ```
61
+
62
+ ### CLI
63
+
64
+ ```shell
65
+ dirTreeist <inputFile> [...options]
66
+ ```
67
+
68
+ #### オプション
69
+
70
+ ```test
71
+ -t, --treeType [1|2|3]
72
+ -e, --empty [boolean]
73
+ -space, --spaceBeforeName [boolean]
74
+ -size, --spaceSize [number]
75
+ ```
76
+
77
+ ### オプションの説明
78
+
79
+ #### emptyLineBeforeUpperHierarchy : boolean
80
+
81
+ デフォルト値:false
82
+
83
+ ```text
84
+ (true)
85
+ ├──components
86
+ │ ├──App.tsx
87
+ │ └──App.css
88
+
89
+ ├──config.json
90
+ └──utils
91
+ └──converter.ts
92
+ ```
93
+
94
+ #### spaceBeforeName : boolean
95
+
96
+ デフォルト値:false
97
+
98
+ ```text
99
+ (true)
100
+ ├── components
101
+ │ ├── App.tsx
102
+ │ └── App.css
103
+
104
+ ├── config.json
105
+ └── utils
106
+ └── converter.ts
107
+ ```
108
+
109
+ #### spaceSize : number
110
+
111
+ デフォルト値:2
112
+
113
+ ```text
114
+ (4)
115
+ ├──── components
116
+ │ ├── App.tsx
117
+ │ └── App.css
118
+
119
+ ├──── config.json
120
+ └──── utils
121
+ └── converter.ts
122
+ ```
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ console.log("hello world");
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC"}
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ roots: ["<rootDir>/src"],
3
+ testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
4
+ transform: {
5
+ "^.+\\.(ts|tsx)$": "ts-jest",
6
+ },
7
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@k4a_l/dirtreeist",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "author": "kasahala",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "dev": "ts-node-dev --respawn src/index.ts",
10
+ "build": "tsc",
11
+ "test": "jest"
12
+ },
13
+ "devDependencies": {
14
+ "@types/jest": "^29.0.0",
15
+ "@typescript-eslint/eslint-plugin": "^5.36.2",
16
+ "@typescript-eslint/parser": "^5.36.2",
17
+ "eslint": "^8.23.0",
18
+ "eslint-config-prettier": "^8.5.0",
19
+ "jest": "^29.0.2",
20
+ "prettier": "^2.7.1",
21
+ "ts-jest": "^28.0.8",
22
+ "ts-node-dev": "^2.0.0",
23
+ "typescript": "^4.8.2"
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes