js-routes 2.2.8 → 2.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -9
- data/Readme.md +60 -45
- data/lib/js_routes/configuration.rb +80 -34
- data/lib/js_routes/engine.rb +2 -0
- data/lib/js_routes/generators/base.rb +19 -0
- data/lib/js_routes/generators/middleware.rb +6 -8
- data/lib/js_routes/generators/webpacker.rb +1 -3
- data/lib/js_routes/instance.rb +50 -15
- data/lib/js_routes/middleware.rb +16 -3
- data/lib/js_routes/route.rb +60 -17
- data/lib/js_routes/types.rb +38 -0
- data/lib/js_routes/version.rb +2 -1
- data/lib/js_routes.rb +25 -7
- metadata +28 -45
- data/.document +0 -5
- data/.eslintrc.js +0 -15
- data/.github/workflows/ci.yml +0 -36
- data/.gitignore +0 -65
- data/.nvmrc +0 -1
- data/.rspec +0 -1
- data/Appraisals +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -37
- data/VERSION_2_UPGRADE.md +0 -66
- data/gemfiles/rails50_sprockets_3.gemfile +0 -8
- data/gemfiles/rails51_sprockets_3.gemfile +0 -8
- data/gemfiles/rails52_sprockets_3.gemfile +0 -8
- data/gemfiles/rails70_sprockets_4.gemfile +0 -8
- data/js-routes.gemspec +0 -39
- data/package.json +0 -38
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/assets/javascripts/.gitkeep +0 -0
- data/spec/dummy/config/routes.rb +0 -55
- data/spec/js_routes/default_serializer_spec.rb +0 -31
- data/spec/js_routes/module_types/amd_spec.rb +0 -35
- data/spec/js_routes/module_types/cjs_spec.rb +0 -15
- data/spec/js_routes/module_types/dts/routes.spec.d.ts +0 -115
- data/spec/js_routes/module_types/dts/test.spec.ts +0 -56
- data/spec/js_routes/module_types/dts_spec.rb +0 -111
- data/spec/js_routes/module_types/esm_spec.rb +0 -45
- data/spec/js_routes/module_types/nil_spec.rb +0 -87
- data/spec/js_routes/module_types/umd_spec.rb +0 -85
- data/spec/js_routes/options_spec.rb +0 -508
- data/spec/js_routes/rails_routes_compatibility_spec.rb +0 -473
- data/spec/js_routes/route_specification_spec.rb +0 -37
- data/spec/js_routes/zzz_sprockets_spec.rb +0 -152
- data/spec/spec_helper.rb +0 -135
- data/spec/support/routes.rb +0 -81
- data/spec/tsconfig.json +0 -4
- data/tsconfig.json +0 -28
- data/yarn.lock +0 -2457
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sorbet-runtime
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: sprockets-rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +72,14 @@ dependencies:
|
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.2.25
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.2.25
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: appraisal
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,33 +150,17 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: 0.4.0
|
139
|
-
description:
|
140
|
-
helpers
|
153
|
+
description: Exposes all Rails Routes URL helpers as javascript module
|
141
154
|
email: agresso@gmail.com
|
142
155
|
executables: []
|
143
156
|
extensions: []
|
144
157
|
extra_rdoc_files:
|
145
158
|
- LICENSE.txt
|
146
159
|
files:
|
147
|
-
- ".document"
|
148
|
-
- ".eslintrc.js"
|
149
|
-
- ".github/workflows/ci.yml"
|
150
|
-
- ".gitignore"
|
151
|
-
- ".nvmrc"
|
152
|
-
- ".rspec"
|
153
|
-
- Appraisals
|
154
160
|
- CHANGELOG.md
|
155
|
-
- Gemfile
|
156
161
|
- LICENSE.txt
|
157
|
-
- Rakefile
|
158
162
|
- Readme.md
|
159
|
-
- VERSION_2_UPGRADE.md
|
160
163
|
- app/assets/javascripts/js-routes.js.erb
|
161
|
-
- gemfiles/rails50_sprockets_3.gemfile
|
162
|
-
- gemfiles/rails51_sprockets_3.gemfile
|
163
|
-
- gemfiles/rails52_sprockets_3.gemfile
|
164
|
-
- gemfiles/rails70_sprockets_4.gemfile
|
165
|
-
- js-routes.gemspec
|
166
164
|
- lib/js-routes.rb
|
167
165
|
- lib/js_routes.rb
|
168
166
|
- lib/js_routes/configuration.rb
|
@@ -173,6 +171,7 @@ files:
|
|
173
171
|
- lib/js_routes/instance.rb
|
174
172
|
- lib/js_routes/middleware.rb
|
175
173
|
- lib/js_routes/route.rb
|
174
|
+
- lib/js_routes/types.rb
|
176
175
|
- lib/js_routes/version.rb
|
177
176
|
- lib/routes.d.ts
|
178
177
|
- lib/routes.js
|
@@ -181,32 +180,16 @@ files:
|
|
181
180
|
- lib/templates/erb.js
|
182
181
|
- lib/templates/initializer.rb
|
183
182
|
- lib/templates/routes.js.erb
|
184
|
-
- package.json
|
185
|
-
- spec/dummy/app/assets/config/manifest.js
|
186
|
-
- spec/dummy/app/assets/javascripts/.gitkeep
|
187
|
-
- spec/dummy/config/routes.rb
|
188
|
-
- spec/js_routes/default_serializer_spec.rb
|
189
|
-
- spec/js_routes/module_types/amd_spec.rb
|
190
|
-
- spec/js_routes/module_types/cjs_spec.rb
|
191
|
-
- spec/js_routes/module_types/dts/routes.spec.d.ts
|
192
|
-
- spec/js_routes/module_types/dts/test.spec.ts
|
193
|
-
- spec/js_routes/module_types/dts_spec.rb
|
194
|
-
- spec/js_routes/module_types/esm_spec.rb
|
195
|
-
- spec/js_routes/module_types/nil_spec.rb
|
196
|
-
- spec/js_routes/module_types/umd_spec.rb
|
197
|
-
- spec/js_routes/options_spec.rb
|
198
|
-
- spec/js_routes/rails_routes_compatibility_spec.rb
|
199
|
-
- spec/js_routes/route_specification_spec.rb
|
200
|
-
- spec/js_routes/zzz_sprockets_spec.rb
|
201
|
-
- spec/spec_helper.rb
|
202
|
-
- spec/support/routes.rb
|
203
|
-
- spec/tsconfig.json
|
204
|
-
- tsconfig.json
|
205
|
-
- yarn.lock
|
206
183
|
homepage: http://github.com/railsware/js-routes
|
207
184
|
licenses:
|
208
185
|
- MIT
|
209
|
-
metadata:
|
186
|
+
metadata:
|
187
|
+
bug_tracker_uri: https://github.com/railsware/js-routes/issues
|
188
|
+
changelog_uri: https://github.com/railsware/js-routes/blob/v2.2.10/CHANGELOG.md
|
189
|
+
documentation_uri: https://github.com/railsware/js-routes
|
190
|
+
source_code_uri: https://github.com/railsware/js-routes/tree/v2.2.10/activerecord
|
191
|
+
rubygems_mfa_required: 'true'
|
192
|
+
github_repo: ssh://github.com/railsware/js-routes
|
210
193
|
post_install_message:
|
211
194
|
rdoc_options: []
|
212
195
|
require_paths:
|
@@ -222,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
205
|
- !ruby/object:Gem::Version
|
223
206
|
version: '0'
|
224
207
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
208
|
+
rubygems_version: 3.2.22
|
226
209
|
signing_key:
|
227
210
|
specification_version: 4
|
228
211
|
summary: Brings Rails named routes to javascript
|
data/.document
DELETED
data/.eslintrc.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
root: true,
|
3
|
-
extends: [
|
4
|
-
'eslint:recommended',
|
5
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
6
|
-
'plugin:@typescript-eslint/recommended',
|
7
|
-
'prettier',
|
8
|
-
],
|
9
|
-
parser: '@typescript-eslint/parser',
|
10
|
-
plugins: ['@typescript-eslint'],
|
11
|
-
rules: {
|
12
|
-
'@typescript-eslint/ban-types': 'off',
|
13
|
-
'@typescript-eslint/no-explicit-any': 'off'
|
14
|
-
},
|
15
|
-
};
|
data/.github/workflows/ci.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
pull_request:
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
build:
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
strategy:
|
13
|
-
matrix:
|
14
|
-
ruby: ["2.7"]
|
15
|
-
gemfile:
|
16
|
-
- gemfiles/rails50_sprockets_3.gemfile
|
17
|
-
- gemfiles/rails51_sprockets_3.gemfile
|
18
|
-
- gemfiles/rails52_sprockets_3.gemfile
|
19
|
-
- gemfiles/rails70_sprockets_4.gemfile
|
20
|
-
|
21
|
-
env:
|
22
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
23
|
-
steps:
|
24
|
-
- uses: actions/checkout@v2
|
25
|
-
- uses: ruby/setup-ruby@v1
|
26
|
-
with:
|
27
|
-
ruby-version: ${{ matrix.ruby }}
|
28
|
-
- uses: actions/setup-node@v3
|
29
|
-
with:
|
30
|
-
node-version: "16"
|
31
|
-
- name: install dependencies
|
32
|
-
run: |
|
33
|
-
bundle install --jobs 3 --retry 3
|
34
|
-
yarn install
|
35
|
-
- name: test
|
36
|
-
run: bundle exec rake spec
|
data/.gitignore
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
# rcov generated
|
2
|
-
coverage
|
3
|
-
|
4
|
-
# rdoc generated
|
5
|
-
rdoc
|
6
|
-
|
7
|
-
# yard generated
|
8
|
-
doc
|
9
|
-
.yardoc
|
10
|
-
log
|
11
|
-
|
12
|
-
# bundler
|
13
|
-
.bundle
|
14
|
-
|
15
|
-
# jeweler generated
|
16
|
-
pkg
|
17
|
-
tmp
|
18
|
-
|
19
|
-
node_modules
|
20
|
-
|
21
|
-
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
22
|
-
#
|
23
|
-
# * Create a file at ~/.gitignore
|
24
|
-
# * Include files you want ignored
|
25
|
-
# * Run: git config --global core.excludesfile ~/.gitignore
|
26
|
-
#
|
27
|
-
# After doing this, these files will be ignored in all your git projects,
|
28
|
-
# saving you from having to 'pollute' every project you touch with them
|
29
|
-
#
|
30
|
-
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
31
|
-
#
|
32
|
-
# For MacOS:
|
33
|
-
#
|
34
|
-
#.DS_Store
|
35
|
-
|
36
|
-
# For TextMate
|
37
|
-
#*.tmproj
|
38
|
-
#tmtags
|
39
|
-
|
40
|
-
# For emacs:
|
41
|
-
#*~
|
42
|
-
#\#*
|
43
|
-
#.\#*
|
44
|
-
|
45
|
-
# For vim:
|
46
|
-
#*.swp
|
47
|
-
|
48
|
-
# For redcar:
|
49
|
-
#.redcar
|
50
|
-
|
51
|
-
# For rubinius:
|
52
|
-
#*.rbc
|
53
|
-
.rvmrc
|
54
|
-
.ruby-version
|
55
|
-
|
56
|
-
Gemfile.lock
|
57
|
-
gemfiles/*.lock
|
58
|
-
|
59
|
-
.DS_Store
|
60
|
-
|
61
|
-
/spec/dummy/app/assets/javascripts/routes.js
|
62
|
-
/spec/dummy/logs
|
63
|
-
/spec/dummy/tmp
|
64
|
-
node_modules
|
65
|
-
|
data/.nvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
14
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Appraisals
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
def define_appraisal(rails, version, sprockets)
|
2
|
-
sprockets.each do |sprocket|
|
3
|
-
appraise "#{rails}-sprockets-#{sprocket}" do
|
4
|
-
gem "railties", "~> #{version}"
|
5
|
-
gem "sprockets", "~> #{sprocket}.0"
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
[
|
11
|
-
[:rails50, '5.0.5', [3]],
|
12
|
-
[:rails51, '5.1.3', [3]],
|
13
|
-
[:rails52, '5.2.3', [3]],
|
14
|
-
[:rails70, '7.0.3.1', [4]]
|
15
|
-
].each do |name, version, sprockets|
|
16
|
-
define_appraisal(name, version, sprockets)
|
17
|
-
end
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler'
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
require 'bundler/gem_tasks'
|
12
|
-
require 'rspec/core'
|
13
|
-
require 'rspec/core/rake_task'
|
14
|
-
require 'appraisal'
|
15
|
-
require 'rails/version'
|
16
|
-
if Rails.version < "6.1"
|
17
|
-
load "rails/tasks/routes.rake"
|
18
|
-
end
|
19
|
-
|
20
|
-
RSpec::Core::RakeTask.new(:spec)
|
21
|
-
|
22
|
-
task :test_all => :appraisal # test all rails
|
23
|
-
|
24
|
-
task :default => :spec
|
25
|
-
|
26
|
-
|
27
|
-
namespace :spec do
|
28
|
-
desc "Print all routes defined in test env"
|
29
|
-
task :routes do
|
30
|
-
require './spec/spec_helper'
|
31
|
-
require 'action_dispatch/routing/inspector'
|
32
|
-
draw_routes
|
33
|
-
all_routes = Rails.application.routes.routes
|
34
|
-
inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
|
35
|
-
puts inspector.format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new)
|
36
|
-
end
|
37
|
-
end
|
data/VERSION_2_UPGRADE.md
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
## Version 2.0 upgrade notes
|
2
|
-
|
3
|
-
### Using ESM module by default
|
4
|
-
|
5
|
-
New version of JsRoutes doesn't try to guess your javascript environment module system because JS has generated a ton of legacy module systems in the past.
|
6
|
-
[ESM+Webpacker](/Readme.md#webpacker) upgrade is recommended.
|
7
|
-
|
8
|
-
However, if you don't want to follow that pass, specify `module_type` configuration option instead based on module system available in your JS environment.
|
9
|
-
Here are supported values:
|
10
|
-
|
11
|
-
* CJS
|
12
|
-
* UMD
|
13
|
-
* AMD
|
14
|
-
* ESM
|
15
|
-
* nil
|
16
|
-
|
17
|
-
[Explaination Article](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm)
|
18
|
-
|
19
|
-
If you don't want to use any JS module system and make routes available via a **global variable**, specify `nil` as a `module_type` and use `namespace` option:
|
20
|
-
|
21
|
-
``` ruby
|
22
|
-
JsRoutes.setup do |config|
|
23
|
-
config.module_type = nil
|
24
|
-
config.namespace = "Routes"
|
25
|
-
end
|
26
|
-
```
|
27
|
-
|
28
|
-
### JSDoc comment
|
29
|
-
|
30
|
-
New version of js-routes generates function comment in the [JSDoc](https://jsdoc.app) format.
|
31
|
-
If you have any problems with that, you can disable it like this:
|
32
|
-
|
33
|
-
|
34
|
-
``` ruby
|
35
|
-
JsRoutes.setup do |config|
|
36
|
-
config.documentation = false
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
### `required_params` renamed
|
41
|
-
|
42
|
-
In case you are using `required_params` property, it is now renamed and converted to a method:
|
43
|
-
|
44
|
-
``` javascript
|
45
|
-
// Old style
|
46
|
-
Routes.post_path.required_params // => ['id']
|
47
|
-
// New style
|
48
|
-
Routes.post_path.requiredParams() // => ['id']
|
49
|
-
```
|
50
|
-
|
51
|
-
### ParameterMissing error rework
|
52
|
-
|
53
|
-
`ParameterMissing` is renamed to `ParametersMissing` error and now list all missing parameters instead of just first encountered in its message. Missing parameters are now available via `ParametersMissing#keys` property.
|
54
|
-
|
55
|
-
``` javascript
|
56
|
-
try {
|
57
|
-
return Routes.inbox_path();
|
58
|
-
} catch(error) {
|
59
|
-
if (error.name === 'ParametersMissing') {
|
60
|
-
console.warn(`Missing route keys ${error.keys.join(', ')}. Ignoring.`);
|
61
|
-
return "#";
|
62
|
-
} else {
|
63
|
-
throw error;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
```
|
data/js-routes.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'js_routes/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{js-routes}
|
8
|
-
s.version = JsRoutes::VERSION
|
9
|
-
|
10
|
-
if s.respond_to? :required_rubygems_version=
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0")
|
12
|
-
end
|
13
|
-
s.authors = ["Bogdan Gusiev"]
|
14
|
-
s.description = %q{Generates javascript file that defines all Rails named routes as javascript helpers}
|
15
|
-
s.email = %q{agresso@gmail.com}
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"LICENSE.txt"
|
18
|
-
]
|
19
|
-
s.required_ruby_version = '>= 2.4.0'
|
20
|
-
s.files = `git ls-files`.split("\n")
|
21
|
-
s.homepage = %q{http://github.com/railsware/js-routes}
|
22
|
-
s.licenses = ["MIT"]
|
23
|
-
s.require_paths = ["lib"]
|
24
|
-
s.summary = %q{Brings Rails named routes to javascript}
|
25
|
-
|
26
|
-
s.add_runtime_dependency(%q<railties>, [">= 4"])
|
27
|
-
s.add_development_dependency(%q<sprockets-rails>)
|
28
|
-
s.add_development_dependency(%q<rspec>, [">= 3.10.0"])
|
29
|
-
s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
|
30
|
-
s.add_development_dependency(%q<appraisal>, [">= 0.5.2"])
|
31
|
-
s.add_development_dependency(%q<bump>, [">= 0.10.0"])
|
32
|
-
if defined?(JRUBY_VERSION)
|
33
|
-
s.add_development_dependency(%q<therubyrhino>, [">= 2.0.4"])
|
34
|
-
else
|
35
|
-
s.add_development_dependency(%q<byebug>)
|
36
|
-
s.add_development_dependency(%q<pry-byebug>)
|
37
|
-
s.add_development_dependency(%q<mini_racer>, [">= 0.4.0"])
|
38
|
-
end
|
39
|
-
end
|
data/package.json
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "js-routes",
|
3
|
-
"version": "1.0.0",
|
4
|
-
"main": "index.js",
|
5
|
-
"repository": "git@github.com:railsware/js-routes.git",
|
6
|
-
"author": "Bogdan Gusiev <agresso@gmail.com>, Alexey Vasiliev <https://leopard.in.ua> ",
|
7
|
-
"license": "MIT",
|
8
|
-
"private": false,
|
9
|
-
"devDependencies": {
|
10
|
-
"typescript": "^4.1.2"
|
11
|
-
},
|
12
|
-
"dependencies": {
|
13
|
-
"@typescript-eslint/eslint-plugin": "^4.9.0",
|
14
|
-
"@typescript-eslint/parser": "^4.9.0",
|
15
|
-
"eslint": "^8.35.0",
|
16
|
-
"eslint-config-prettier": "^8.7.0",
|
17
|
-
"eslint-plugin-import": "^2.27.5",
|
18
|
-
"husky": "^4.3.0",
|
19
|
-
"lint-staged": "^10.5.2",
|
20
|
-
"pinst": "^2.1.1",
|
21
|
-
"prettier": "^2.8.4"
|
22
|
-
},
|
23
|
-
"scripts": {
|
24
|
-
"build": "tsc && yarn lint:fix",
|
25
|
-
"lint:fix": "yarn eslint --fix && yarn prettier --write lib/routes.ts",
|
26
|
-
"postinstall": "yarn husky-upgrade"
|
27
|
-
},
|
28
|
-
"husky": {
|
29
|
-
"hooks": {
|
30
|
-
"pre-commit": "yarn lint:fix"
|
31
|
-
}
|
32
|
-
},
|
33
|
-
"lint-staged": {
|
34
|
-
"./lib/routes.ts": [
|
35
|
-
"yarn lint:fix"
|
36
|
-
]
|
37
|
-
}
|
38
|
-
}
|
File without changes
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
App.routes.draw do
|
2
|
-
resource "3df1b2d050ae5a96eac8565c9daef37a"
|
3
|
-
resource "341f9e69e3db1c344de2fc6551885711"
|
4
|
-
resource "0e1bcb2dc1ce4d80ec15cae9140fb99a"
|
5
|
-
resource "15b91c612530bfc69c70d121c8713da4"
|
6
|
-
resource "49e12936168a64dce4d4ec148104fb5a"
|
7
|
-
resource "d878104611f88952aba49965c1d2d573"
|
8
|
-
resource "0e94bfc3c8aaee5ea09579fe73cbdaff"
|
9
|
-
resource "e1c2dd2ea9c63b380eb0947a0e1f49aa"
|
10
|
-
resource "587c6e26ad7f9a6aa09f81add77b16f5"
|
11
|
-
resource "8e00bfffebe0c874d6dad1c7b8c7cd6b"
|
12
|
-
resource "394482d3515e7e49989a8496afa7d367"
|
13
|
-
resource "4ab9c701622cba87eae50795564abe1c"
|
14
|
-
resource "af4b4a2ea501fefbdb8367eb108b2e14"
|
15
|
-
resource "116d17a93932a9a3e5bd2750665582f9"
|
16
|
-
resource "315f0a62063288cd56373c8a00870596"
|
17
|
-
resource "d5357ec6df4589f81ca8689cf0231667"
|
18
|
-
resource "560a3b8cf807e873843cd889400cd52b"
|
19
|
-
resource "361de6041f545e67db1aeaa6206c8ac7"
|
20
|
-
resource "28b0a54de4a0884386f1e324edc13194"
|
21
|
-
resource "ab77f21a956d956295187806cdf38cd1"
|
22
|
-
resource "0b8a362fd486247fb7c41898709b9815"
|
23
|
-
resource "5efa0a96733bc027b3309ffb54d1d1d0"
|
24
|
-
resource "70a3ee535c59fcf59c58b6d39178833c"
|
25
|
-
resource "5095fc05868c673ce450524f78cd28d3"
|
26
|
-
resource "79b994cfbc79432d644a3b83804f4924"
|
27
|
-
resource "e25125c477cd451fd74a76eaaebc9165"
|
28
|
-
resource "672fbfb432687e2fee7d0e799cc10ea4"
|
29
|
-
resource "2eb8350243305659082eb92b2e5b702c"
|
30
|
-
resource "08c9973b624e10b10dc7235659c81346"
|
31
|
-
resource "fee0d4b123529a2c652bef0ec0116ef2"
|
32
|
-
resource "8422445d2aa176b7733473164c461a2e"
|
33
|
-
resource "c24b8252b235431ca3df21a6ac119062"
|
34
|
-
resource "c08c66c7fc40e9937ff84a86f6c6d18a"
|
35
|
-
resource "964851acca72064d861188150e848d55"
|
36
|
-
resource "d02927a4fd37b37c03dbad5d3c7a4753"
|
37
|
-
resource "2a69df680ff9bd8d3855d9ce5a4e51f7"
|
38
|
-
resource "d8daed677f9a9a6926005afbdeebcf73"
|
39
|
-
resource "83d4db872f5f148e9ead108d483fec78"
|
40
|
-
resource "09f9fb4250595d26f4149b76fcfa957d"
|
41
|
-
resource "956cdb4d3cbf36bb9ccb7c7fcc36a602"
|
42
|
-
resource "02816449a6c929f55f8bad958f25d25a"
|
43
|
-
resource "2dd7ae38bd72f7e8b26aafb5f002d634"
|
44
|
-
resource "c7c9aaa3f7131f1e7dbc9325b3426d3e"
|
45
|
-
resource "7556e7d17c2a26acbad7d5fa86e6e640"
|
46
|
-
resource "d03081ef427a227a808c708282fdc86b"
|
47
|
-
resource "8f610d21e6e499c1eea98ca08191c05f"
|
48
|
-
resource "b6b412ae8a369f6bfc7f312245eacc8c"
|
49
|
-
resource "e9bcda8b00879c49bd7f05afee59a28e"
|
50
|
-
resource "6e89f4baddd4044b42be7c2d3b382567"
|
51
|
-
resource "5959c376d15a609f2e74f4f351d0a565"
|
52
|
-
resource "3b7e418511c305c78f2d2c292a3a1289"
|
53
|
-
resource "87acf6bf6e8191ff8900f420b33d5268"
|
54
|
-
resource "648a9b17078423f29f42aa2ecac1cc7d"
|
55
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe JsRoutes, "#serialize" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
evallib(module_type: nil, namespace: 'Routes')
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should provide this method" do
|
10
|
-
expectjs("Routes.serialize({a: 1, b: [2,3], c: {d: 4, e: 5}, f: ''})").to eq(
|
11
|
-
"a=1&b%5B%5D=2&b%5B%5D=3&c%5Bd%5D=4&c%5Be%5D=5&f="
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should provide this method" do
|
16
|
-
expectjs("Routes.serialize({a: 1, b: [2,3], c: {d: 4, e: 5}, f: ''})").to eq(
|
17
|
-
"a=1&b%5B%5D=2&b%5B%5D=3&c%5Bd%5D=4&c%5Be%5D=5&f="
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "works with JS suckiness" do
|
22
|
-
expectjs(
|
23
|
-
[
|
24
|
-
"const query = Object.create(null);",
|
25
|
-
"query.a = 1;",
|
26
|
-
"query.b = 2;",
|
27
|
-
"Routes.serialize(query);",
|
28
|
-
].join("\n")
|
29
|
-
).to eq("a=1&b=2")
|
30
|
-
end
|
31
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe JsRoutes, "compatibility with AMD/require.js" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
evaljs("var global = this;", force: true)
|
7
|
-
evaljs("global.GlobalCheck = {};")
|
8
|
-
evaljs("global.define = function (requirs, callback) { global.GlobalCheck['js-routes'] = callback.call(this); return global.GlobalCheck['js-routes']; };")
|
9
|
-
evaljs("global.define.amd = { jQuery: true };")
|
10
|
-
strRequire =<<EOF
|
11
|
-
global.require = function (r, callback) {
|
12
|
-
var allArgs, i;
|
13
|
-
|
14
|
-
allArgs = (function() {
|
15
|
-
var _i, _len, _results;
|
16
|
-
_results = [];
|
17
|
-
for (_i = 0, _len = r.length; _i < _len; _i++) {
|
18
|
-
i = r[_i];
|
19
|
-
_results.push(global.GlobalCheck[i]);
|
20
|
-
}
|
21
|
-
return _results;
|
22
|
-
})();
|
23
|
-
|
24
|
-
return callback.apply(null, allArgs);
|
25
|
-
};
|
26
|
-
EOF
|
27
|
-
evaljs(strRequire)
|
28
|
-
evaljs(JsRoutes.generate(module_type: 'AMD'))
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should working from require" do
|
32
|
-
expectjs("require(['js-routes'], function(r){ return r.inboxes_path(); })").to eq(test_routes.inboxes_path())
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe JsRoutes, "compatibility with CJS" do
|
4
|
-
before(:each) do
|
5
|
-
evaljs("module = { exports: null }")
|
6
|
-
evaljs(JsRoutes.generate(
|
7
|
-
module_type: 'CJS',
|
8
|
-
include: /^inboxes/
|
9
|
-
))
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should define module exports" do
|
13
|
-
expectjs("module.exports.inboxes_path()").to eq(test_routes.inboxes_path())
|
14
|
-
end
|
15
|
-
end
|