js_dependency 0.3.9 → 0.3.10
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 +2 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/js_dependency/cli.rb +10 -5
- data/lib/js_dependency/cli_utils/yaml.rb +30 -10
- data/lib/js_dependency/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153a609f4227a43182ed6e6a469bcfe466ffe130c5f6d8033771545ca13b4198
|
4
|
+
data.tar.gz: 32cd8dd2ec33e8906b0bad39c8a4a6378e4909285486f52b6c93915891bed8bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e3437906da40a60ed9e129dc8b2a3157221a61d34982bce433dfb8f8b3c7ee198cba9c85b6f230079db5a3a08fe9bb1c103d38763ce139a5aed81ecf5c9e10
|
7
|
+
data.tar.gz: cf47aa344e700868b2dd76c67ad4323acc2a47e9f0e4d9736d0ae30a981715bb639c52b4d9322b243122879abaf892b314479d39a3c29e4dba56df848cfbe0a0
|
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-
|
3
|
+
# on 2022-08-13 03:35:35 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
|
@@ -36,7 +36,7 @@ Style/MultilineBlockChain:
|
|
36
36
|
Exclude:
|
37
37
|
- 'lib/js_dependency/mermaid/root.rb'
|
38
38
|
|
39
|
-
# Offense count:
|
39
|
+
# Offense count: 9
|
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
@@ -46,6 +46,12 @@ excludes: # Exclude words that you want to skip from export.
|
|
46
46
|
- excludeWord2
|
47
47
|
```
|
48
48
|
|
49
|
+
If you want to specify .js_dependency.yml as another path, you can add option path by `-f` option.
|
50
|
+
|
51
|
+
```shell
|
52
|
+
js_dependency -f path/to/yourfilename.yml
|
53
|
+
```
|
54
|
+
|
49
55
|
Each parameter is overridden by the command line.
|
50
56
|
|
51
57
|
```
|
data/lib/js_dependency/cli.rb
CHANGED
@@ -16,9 +16,10 @@ module JsDependency
|
|
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
18
|
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
19
|
+
method_option :file_config, type: :string, aliases: "-f", desc: "Configuration file path."
|
19
20
|
|
20
21
|
def export_mermaid
|
21
|
-
args = JsDependency::CliUtils::Yaml.new.args
|
22
|
+
args = JsDependency::CliUtils::Yaml.new(path: options[:file_config]).args
|
22
23
|
config = JsDependency::CliUtils::Config.new(options, args)
|
23
24
|
puts JsDependency.export_mermaid(
|
24
25
|
config.src_path,
|
@@ -39,9 +40,10 @@ module JsDependency
|
|
39
40
|
method_option :parent_analyze_level, type: :numeric, aliases: "-p", desc: "Output level of parent dependency"
|
40
41
|
method_option :excludes, type: :array, aliases: "-e", desc: "Exclude the word that is included in the path"
|
41
42
|
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
43
|
+
method_option :file_config, type: :string, aliases: "-f", desc: "Configuration file path."
|
42
44
|
|
43
45
|
def parents
|
44
|
-
args = JsDependency::CliUtils::Yaml.new.args
|
46
|
+
args = JsDependency::CliUtils::Yaml.new(path: options[:file_config]).args
|
45
47
|
config = JsDependency::CliUtils::Config.new(options, args)
|
46
48
|
puts JsDependency.parents(
|
47
49
|
config.src_path,
|
@@ -60,9 +62,10 @@ module JsDependency
|
|
60
62
|
method_option :child_analyze_level, type: :numeric, aliases: "-c", desc: "Output level of child dependency"
|
61
63
|
method_option :excludes, type: :array, aliases: "-e", desc: "Exclude the word that is included in the path"
|
62
64
|
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
65
|
+
method_option :file_config, type: :string, aliases: "-f", desc: "Configuration file path."
|
63
66
|
|
64
67
|
def children
|
65
|
-
args = JsDependency::CliUtils::Yaml.new.args
|
68
|
+
args = JsDependency::CliUtils::Yaml.new(path: options[:file_config]).args
|
66
69
|
config = JsDependency::CliUtils::Config.new(options, args)
|
67
70
|
puts JsDependency.children(
|
68
71
|
config.src_path,
|
@@ -77,9 +80,10 @@ module JsDependency
|
|
77
80
|
desc "orphan", "export components than is not depended by others"
|
78
81
|
method_option :src_path, type: :string, aliases: "-s", desc: "Root folder."
|
79
82
|
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
83
|
+
method_option :file_config, type: :string, aliases: "-f", desc: "Configuration file path."
|
80
84
|
|
81
85
|
def orphan
|
82
|
-
args = JsDependency::CliUtils::Yaml.new.args
|
86
|
+
args = JsDependency::CliUtils::Yaml.new(path: options[:file_config]).args
|
83
87
|
config = JsDependency::CliUtils::Config.new(options, args)
|
84
88
|
puts JsDependency.orphan(
|
85
89
|
config.src_path,
|
@@ -90,9 +94,10 @@ module JsDependency
|
|
90
94
|
desc "leave", "export components than is not depended by others"
|
91
95
|
method_option :src_path, type: :string, aliases: "-s", desc: "Root folder."
|
92
96
|
method_option :alias_paths, type: :hash, aliases: "-a", desc: "Alias paths by hash format."
|
97
|
+
method_option :file_config, type: :string, aliases: "-f", desc: "Configuration file path."
|
93
98
|
|
94
99
|
def leave
|
95
|
-
args = JsDependency::CliUtils::Yaml.new.args
|
100
|
+
args = JsDependency::CliUtils::Yaml.new(path: options[:file_config]).args
|
96
101
|
config = JsDependency::CliUtils::Config.new(options, args)
|
97
102
|
puts JsDependency.leave(
|
98
103
|
config.src_path,
|
@@ -3,22 +3,42 @@
|
|
3
3
|
module JsDependency
|
4
4
|
module CliUtils
|
5
5
|
class Yaml
|
6
|
-
attr_reader :
|
7
|
-
:
|
6
|
+
attr_reader :dir_path,
|
7
|
+
:path
|
8
8
|
|
9
9
|
# @param [String, nil] dir_path
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
# @param [String, nil] path
|
11
|
+
def initialize(dir_path: nil, path: nil)
|
12
|
+
@dir_path = present?(dir_path) ? dir_path : Dir.pwd
|
13
|
+
@path = path
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Hash]
|
17
|
+
def args
|
18
|
+
pathname = if present?(@path)
|
19
|
+
Pathname.new(@path)
|
20
|
+
else
|
21
|
+
config_pathname
|
22
|
+
end
|
23
|
+
|
24
|
+
if pathname.nil?
|
25
|
+
{}
|
26
|
+
else
|
27
|
+
symbolize_keys(YAML.safe_load(pathname.read))
|
28
|
+
end
|
18
29
|
end
|
19
30
|
|
20
31
|
private
|
21
32
|
|
33
|
+
# @param [String] str
|
34
|
+
# @return [TrueClass, FalseClass]
|
35
|
+
def present?(str)
|
36
|
+
return false if str.nil?
|
37
|
+
return false if str.empty?
|
38
|
+
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
22
42
|
# @return [Pathname, nil]
|
23
43
|
def config_pathname
|
24
44
|
dir_pathname = Pathname.new(@dir_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_dependency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- junara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pathname
|