js-routes 2.3.2 → 2.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -11
- data/Readme.md +1 -1
- data/lib/js_routes/configuration.rb +3 -2
- data/lib/js_routes/middleware.rb +7 -8
- data/lib/js_routes/version.rb +1 -1
- data/lib/js_routes.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1acb75b6e26ae17c5b028fb97d400d0fb061ec582298598e91b05f27a5a9a32c
|
4
|
+
data.tar.gz: 2bc54da6a67463569ad6b239f90392394d666f0b89cde662a09cf35f19b07f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4a84398697f1bfb41f9c0dace8d50a805b5aae36de24382bd5b43214e237a776471267046ec01487cb52ab542f0b61cc46f62a32037476af8aa2510d5b87c77
|
7
|
+
data.tar.gz: db690e312707ad1951b9b9905c62400eb1f70eafbeab95aab94920eab5df57c18d6d18cec1e3bc3bbe133d0a2a98308469fe934b955a43f401357284cf29f9c3
|
data/CHANGELOG.md
CHANGED
@@ -1,21 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v2.3.3
|
4
|
+
|
5
|
+
* Rework default banner to use `routes.rb` digest instead of timestamp to ensure
|
6
|
+
consistent routes.js version accross environments.
|
7
|
+
* Use [JSDoc Tags](https://jsdoc.app/) in banner by default.
|
8
|
+
|
9
|
+
|
10
|
+
The new default banner:
|
11
|
+
|
12
|
+
``` js
|
13
|
+
/**
|
14
|
+
* @file Generated by js-routes 2.3.3. Based on Rails 7.2.0 routes of App.
|
15
|
+
* @see https://github.com/railsware/js-routes
|
16
|
+
* @version e289929fc3fbe69b77aa24c5c3a58fcb1246ad1ea3f4e883f7eafa915ca929f3
|
17
|
+
*/
|
18
|
+
```
|
19
|
+
|
3
20
|
## v2.3.2
|
4
21
|
|
5
22
|
* Add `banner` option that allow to control JSDoc on top of generated file. [#324](https://github.com/bogdan/repo/issues/324).
|
6
23
|
|
7
24
|
``` ruby
|
8
|
-
JsRoutes.
|
9
|
-
c.banner = -> {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
DOC
|
18
|
-
}
|
25
|
+
JsRoutes.setup do |c|
|
26
|
+
c.banner = -> {
|
27
|
+
<<~DOC
|
28
|
+
@file Javascript Route helpers of my magic pony app.
|
29
|
+
@author Bogdan Gusiev
|
30
|
+
@license MIT
|
31
|
+
@version #{JsRoutes.digest}
|
32
|
+
DOC
|
33
|
+
}
|
19
34
|
end
|
20
35
|
```
|
21
36
|
|
data/Readme.md
CHANGED
@@ -483,7 +483,7 @@ While all of these methods are supported by JsRoutes, it is impossible to suppor
|
|
483
483
|
If you are using routes like this, use the following configuration that will prevent required parameters presence to be validated by definition:
|
484
484
|
|
485
485
|
``` ruby
|
486
|
-
JsRoutes.
|
486
|
+
JsRoutes.setup do |c|
|
487
487
|
c.optional_definition_params = true
|
488
488
|
end
|
489
489
|
```
|
@@ -168,8 +168,9 @@ module JsRoutes
|
|
168
168
|
-> () {
|
169
169
|
app = application.is_a?(Proc) ? T.unsafe(application).call : application
|
170
170
|
<<~TXT
|
171
|
-
|
172
|
-
|
171
|
+
@file Generated by js-routes #{JsRoutes::VERSION}. Based on Rails #{Rails.version} routes of #{app.class}.
|
172
|
+
@version #{JsRoutes.digest}
|
173
|
+
@see https://github.com/railsware/js-routes
|
173
174
|
TXT
|
174
175
|
|
175
176
|
}
|
data/lib/js_routes/middleware.rb
CHANGED
@@ -16,8 +16,7 @@ module JsRoutes
|
|
16
16
|
sig { params(app: T.untyped).void }
|
17
17
|
def initialize(app)
|
18
18
|
@app = app
|
19
|
-
@
|
20
|
-
@mtime = T.let(nil, T.nilable(Time))
|
19
|
+
@digest = T.let(nil, T.nilable(String))
|
21
20
|
end
|
22
21
|
|
23
22
|
sig { override.params(env: StringHash).returns(UntypedArray) }
|
@@ -30,10 +29,10 @@ module JsRoutes
|
|
30
29
|
|
31
30
|
sig { void }
|
32
31
|
def update_js_routes
|
33
|
-
|
34
|
-
unless
|
32
|
+
new_digest = fetch_digest
|
33
|
+
unless new_digest == @digest
|
35
34
|
regenerate
|
36
|
-
@
|
35
|
+
@digest = new_digest
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
@@ -42,9 +41,9 @@ module JsRoutes
|
|
42
41
|
JsRoutes.generate!(typed: true)
|
43
42
|
end
|
44
43
|
|
45
|
-
sig { returns(T.nilable(
|
46
|
-
def
|
47
|
-
|
44
|
+
sig { returns(T.nilable(String)) }
|
45
|
+
def fetch_digest
|
46
|
+
JsRoutes.digest
|
48
47
|
rescue Errno::ENOENT
|
49
48
|
nil
|
50
49
|
end
|
data/lib/js_routes/version.rb
CHANGED
data/lib/js_routes.rb
CHANGED
@@ -7,6 +7,7 @@ require "js_routes/configuration"
|
|
7
7
|
require "js_routes/instance"
|
8
8
|
require "js_routes/types"
|
9
9
|
require 'active_support/core_ext/string/indent'
|
10
|
+
require "digest/sha2"
|
10
11
|
|
11
12
|
module JsRoutes
|
12
13
|
extend T::Sig
|
@@ -62,6 +63,13 @@ module JsRoutes
|
|
62
63
|
def json(value)
|
63
64
|
ActiveSupport::JSON.encode(value)
|
64
65
|
end
|
66
|
+
|
67
|
+
sig { returns(String) }
|
68
|
+
def digest
|
69
|
+
Digest::SHA256.file(
|
70
|
+
Rails.root.join("config/routes.rb")
|
71
|
+
).hexdigest
|
72
|
+
end
|
65
73
|
end
|
66
74
|
module Generators
|
67
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
@@ -144,9 +144,9 @@ licenses:
|
|
144
144
|
- MIT
|
145
145
|
metadata:
|
146
146
|
bug_tracker_uri: https://github.com/railsware/js-routes/issues
|
147
|
-
changelog_uri: https://github.com/railsware/js-routes/blob/v2.3.
|
147
|
+
changelog_uri: https://github.com/railsware/js-routes/blob/v2.3.3/CHANGELOG.md
|
148
148
|
documentation_uri: https://github.com/railsware/js-routes
|
149
|
-
source_code_uri: https://github.com/railsware/js-routes/tree/v2.3.
|
149
|
+
source_code_uri: https://github.com/railsware/js-routes/tree/v2.3.3/activerecord
|
150
150
|
rubygems_mfa_required: 'true'
|
151
151
|
github_repo: ssh://github.com/railsware/js-routes
|
152
152
|
post_install_message:
|