js_dependency 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +5 -5
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +9 -8
- data/lib/js_dependency/cli.rb +5 -0
- data/lib/js_dependency/cli_utils/config.rb +1 -1
- data/lib/js_dependency/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ac19bdd54aa746f7e5f40bb7cf8c92660eb8384c074347734f8e484d60d878
|
4
|
+
data.tar.gz: a5f4a090fec3d3a4af1c8a8b5747efc830f8f92c4f29dce852e91348c0d867c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0902a104039ef853937b3d1739ec0f1fe249d17f7428d23457124e66b16003a8f7a3136ceefb14a6f3122c99bfcbeeeec0f77d589066f6e0956d95e11b36b963'
|
7
|
+
data.tar.gz: 746f673194445bf43f180a2ec650bd2530795e9966e8cc6a35f5bb55d37ff8688187ceaff41475117bd166d6a788624a3bbb63555b52901231a5d46dace1f4dd
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-08-11
|
3
|
+
# on 2022-08-11 15:14:43 UTC using RuboCop version 1.34.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -9,12 +9,12 @@
|
|
9
9
|
# Offense count: 3
|
10
10
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
11
11
|
Metrics/AbcSize:
|
12
|
-
Max:
|
12
|
+
Max: 33
|
13
13
|
|
14
14
|
# Offense count: 3
|
15
15
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
16
16
|
Metrics/CyclomaticComplexity:
|
17
|
-
Max:
|
17
|
+
Max: 19
|
18
18
|
|
19
19
|
# Offense count: 8
|
20
20
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
@@ -29,14 +29,14 @@ Metrics/ParameterLists:
|
|
29
29
|
# Offense count: 3
|
30
30
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
31
31
|
Metrics/PerceivedComplexity:
|
32
|
-
Max:
|
32
|
+
Max: 20
|
33
33
|
|
34
34
|
# Offense count: 1
|
35
35
|
Style/MultilineBlockChain:
|
36
36
|
Exclude:
|
37
37
|
- 'lib/js_dependency/mermaid/root.rb'
|
38
38
|
|
39
|
-
# Offense count:
|
39
|
+
# Offense count: 8
|
40
40
|
# This cop supports safe autocorrection (--autocorrect).
|
41
41
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
42
42
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,6 +56,7 @@ parent_analyze_level -> -p
|
|
56
56
|
name_level -> -n
|
57
57
|
output_path -> -o
|
58
58
|
exclude -> -e
|
59
|
+
alias_paths -> -a
|
59
60
|
```
|
60
61
|
|
61
62
|
#### Export Mermaid Format
|
@@ -63,31 +64,31 @@ exclude -> -e
|
|
63
64
|
##### Single target path
|
64
65
|
|
65
66
|
```shell
|
66
|
-
js_dependency -s ./src -t ./src/App.vue -o ./mermaid.txt -c 2 -p 2 -n 1
|
67
|
+
js_dependency -s ./src -t ./src/App.vue -o ./mermaid.txt -c 2 -p 2 -n 1 -a @:./pages
|
67
68
|
```
|
68
69
|
|
69
70
|
##### Multiple target paths
|
70
71
|
|
71
72
|
```shell
|
72
|
-
js_dependency -s ./src -t ./src/App.vue ./src/components/Sub.vue -o ./mermaid.txt -c 2 -p 2 -n 1
|
73
|
+
js_dependency -s ./src -t ./src/App.vue ./src/components/Sub.vue -o ./mermaid.txt -c 2 -p 2 -n 1 -a @:./pages
|
73
74
|
```
|
74
75
|
|
75
|
-
##### Exclude path which
|
76
|
+
##### Exclude path which include exclude words `-e` from output
|
76
77
|
|
77
78
|
```shell
|
78
|
-
js_dependency -s ./src -t ./src/App.vue -o ./mermaid.txt -c 2 -p 2 -n 1 -e excludeWord1 excludeWord2
|
79
|
+
js_dependency -s ./src -t ./src/App.vue -o ./mermaid.txt -c 2 -p 2 -n 1 -e excludeWord1 excludeWord2 -a @:./pages
|
79
80
|
```
|
80
81
|
|
81
82
|
#### Export parents components list
|
82
83
|
|
83
84
|
```shell
|
84
|
-
js_dependency parents -s ./src -t ./src/App.vue -o ./parents.txt -p 2
|
85
|
+
js_dependency parents -s ./src -t ./src/App.vue -o ./parents.txt -p 2 -a @:./pages
|
85
86
|
```
|
86
87
|
|
87
88
|
#### Export children components list
|
88
89
|
|
89
90
|
```shell
|
90
|
-
js_dependency childrent -s ./src -t ./src/App.vue -o ./children.txt -c 2
|
91
|
+
js_dependency childrent -s ./src -t ./src/App.vue -o ./children.txt -c 2 -a @:./pages
|
91
92
|
```
|
92
93
|
|
93
94
|
#### Export orphan components list
|
@@ -95,7 +96,7 @@ js_dependency childrent -s ./src -t ./src/App.vue -o ./children.txt -c 2
|
|
95
96
|
Components that are not used in other components.
|
96
97
|
|
97
98
|
```shell
|
98
|
-
js_dependency orphan -s ./src
|
99
|
+
js_dependency orphan -s ./src -a @:./pages
|
99
100
|
```
|
100
101
|
|
101
102
|
#### Export left components list
|
@@ -103,7 +104,7 @@ js_dependency orphan -s ./src
|
|
103
104
|
Components that do not import other components.
|
104
105
|
|
105
106
|
```shell
|
106
|
-
js_dependency leave -s ./src
|
107
|
+
js_dependency leave -s ./src -a @:./pages
|
107
108
|
```
|
108
109
|
|
109
110
|
### By ruby code
|
data/lib/js_dependency/cli.rb
CHANGED
@@ -15,6 +15,7 @@ module JsDependency
|
|
15
15
|
method_option :parent_analyze_level, type: :numeric, aliases: "-p", desc: "Output level of parent dependency"
|
16
16
|
method_option :name_level, type: :numeric, aliases: "-n", desc: "Output name level"
|
17
17
|
method_option :excludes, type: :array, aliases: "-e", desc: "Exclude the word that is included in the path"
|
18
|
+
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
18
19
|
|
19
20
|
def export_mermaid
|
20
21
|
args = JsDependency::CliUtils::Yaml.new.args
|
@@ -37,6 +38,7 @@ module JsDependency
|
|
37
38
|
method_option :output_path, type: :string, aliases: "-o", desc: "Output file path"
|
38
39
|
method_option :parent_analyze_level, type: :numeric, aliases: "-p", desc: "Output level of parent dependency"
|
39
40
|
method_option :excludes, type: :array, aliases: "-e", desc: "Exclude the word that is included in the path"
|
41
|
+
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
40
42
|
|
41
43
|
def parents
|
42
44
|
args = JsDependency::CliUtils::Yaml.new.args
|
@@ -57,6 +59,7 @@ module JsDependency
|
|
57
59
|
method_option :output_path, type: :string, aliases: "-o", desc: "Output file path"
|
58
60
|
method_option :child_analyze_level, type: :numeric, aliases: "-c", desc: "Output level of child dependency"
|
59
61
|
method_option :excludes, type: :array, aliases: "-e", desc: "Exclude the word that is included in the path"
|
62
|
+
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
60
63
|
|
61
64
|
def children
|
62
65
|
args = JsDependency::CliUtils::Yaml.new.args
|
@@ -73,6 +76,7 @@ module JsDependency
|
|
73
76
|
|
74
77
|
desc "orphan", "export components than is not depended by others"
|
75
78
|
method_option :src_path, type: :string, aliases: "-s", desc: "Root folder."
|
79
|
+
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
76
80
|
|
77
81
|
def orphan
|
78
82
|
args = JsDependency::CliUtils::Yaml.new.args
|
@@ -85,6 +89,7 @@ module JsDependency
|
|
85
89
|
|
86
90
|
desc "leave", "export components than is not depended by others"
|
87
91
|
method_option :src_path, type: :string, aliases: "-s", desc: "Root folder."
|
92
|
+
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
88
93
|
|
89
94
|
def leave
|
90
95
|
args = JsDependency::CliUtils::Yaml.new.args
|
@@ -15,7 +15,7 @@ module JsDependency
|
|
15
15
|
@child_analyze_level = options[:child_analyze_level] || args[:child_analyze_level] || 2
|
16
16
|
@parent_analyze_level = options[:parent_analyze_level] || args[:parent_analyze_level] || 2
|
17
17
|
@output_path = options[:output_path] || args[:output_path] || nil
|
18
|
-
@alias_paths = args[:alias_paths] ||
|
18
|
+
@alias_paths = options[:alias_paths] || args[:alias_paths] || {}
|
19
19
|
@name_level = options[:name_level] || args[:name_level] || 1
|
20
20
|
@excludes = if options[:excludes]&.length&.positive?
|
21
21
|
options[:excludes]
|