geoblacklight 4.3.0 → 4.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/app/assets/images/blacklight/geoblacklight-icons.json +558 -279
  4. data/app/assets/images/blacklight/northwestern-university.svg +5 -0
  5. data/app/javascript/index.js +7 -0
  6. data/app/javascript/stylesheets/openlayers.css +1 -0
  7. data/config/locales/geoblacklight.en.yml +2 -1
  8. data/lib/generators/geoblacklight/install_generator.rb +19 -11
  9. data/lib/generators/geoblacklight/templates/clover.js +1 -1
  10. data/lib/generators/geoblacklight/templates/ol.js +2 -1
  11. data/lib/generators/geoblacklight/templates/package-test.json +10 -0
  12. data/lib/generators/geoblacklight/templates/package.json +3 -0
  13. data/lib/generators/geoblacklight/templates/vite.config.ts +1 -12
  14. data/lib/generators/geoblacklight/templates/vite.json +1 -1
  15. data/lib/geoblacklight/version.rb +1 -1
  16. data/package.json +25 -5
  17. data/spec/features/full_screen_controll_spec.rb +1 -1
  18. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -1
  19. data/vite.config.ts +20 -4
  20. metadata +9 -11
  21. data/app/frontend/entrypoints/application.js +0 -28
  22. data/app/frontend/entrypoints/clover.js +0 -5
  23. data/app/frontend/entrypoints/ol.js +0 -5
  24. data/app/frontend/stylesheets/openlayers.css +0 -1
  25. data/config/vite.json +0 -14
  26. data/lib/generators/geoblacklight/templates/vite.rb +0 -4
  27. /data/app/{frontend → javascript}/clover/clover_initializer.js +0 -0
  28. /data/app/{frontend → javascript}/openlayers/basemaps.js +0 -0
  29. /data/app/{frontend → javascript}/openlayers/ol_initializer.js +0 -0
@@ -0,0 +1,5 @@
1
+ <!-- Generated by IcoMoon.io -->
2
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="33" height="32" viewBox="0 0 33 32">
3
+ <title>northwestern-university</title>
4
+ <path fill="#6c757d" d="M21.118 0.238v2.258l3.79 0.953 0.749 0.93v18.088l-18.984-22.468h-5.583v1.691l3.087 3.472v23.455l-4.176 1.169v1.974h11.972v-1.986l-3.711-0.987-0.76-0.942v-18.86l19.325 23.013h2.235v-28.437l4.199-1.271v-2.054z"></path>
5
+ </svg>
@@ -0,0 +1,7 @@
1
+ import OlInitializer from './openlayers/ol_initializer'
2
+ import CloverInitializer from './clover/clover_initializer'
3
+
4
+ export {
5
+ OlInitializer,
6
+ CloverInitializer
7
+ }
@@ -0,0 +1 @@
1
+ @import "../../../node_modules/ol/ol.css";
@@ -166,7 +166,8 @@ en:
166
166
  multilinestring: Multi-line string
167
167
  multipoint: Multi-point
168
168
  multipolygon: Multi-polygon
169
- nebraska: University of Nebraska
169
+ nebraska: University of Nebraska-Lincoln
170
+ northwestern-university: Northwestern University
170
171
  nyu: New York University
171
172
  ohio-state: The Ohio State University
172
173
  penn-state: Penn State University
@@ -5,9 +5,10 @@ require "rails/generators"
5
5
  module Geoblacklight
6
6
  class Install < Rails::Generators::Base
7
7
  source_root File.expand_path("../templates", __FILE__)
8
-
9
8
  desc "Install Geoblacklight"
10
9
 
10
+ class_option :test, type: :boolean, default: false, aliases: "-t", desc: "Indicates that app will be installed in a test environment"
11
+
11
12
  def allow_geoblacklight_params
12
13
  gbl_params = <<-PARAMS
13
14
  before_action :allow_geoblacklight_params
@@ -116,28 +117,35 @@ module Geoblacklight
116
117
  copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb"
117
118
  end
118
119
 
119
- # Run bundle with vite install
120
- def bundle_install
121
- Bundler.with_clean_env do
122
- run "bundle install"
123
- run "bundle exec vite install"
120
+ def copy_package_json
121
+ if options[:test]
122
+ # If building engine cart test app, use specific package.json so the
123
+ # locally built frontend javascript is used instead of the npm package.
124
+ copy_file "package-test.json", "package.json"
125
+ else
126
+ copy_file "package.json", "package.json"
124
127
  end
125
128
  end
126
129
 
127
130
  # Vite - Config files
128
131
  def copy_config_vite_json
129
132
  copy_file "vite.json", "config/vite.json"
130
- copy_file "vite.rb", "config/vite.rb"
131
133
  copy_file "vite.config.ts", "vite.config.ts"
132
- copy_file "package.json", "package.json"
133
-
134
134
  run "yarn install"
135
135
  end
136
136
 
137
+ # Run bundle with vite install
138
+ def bundle_install
139
+ Bundler.with_clean_env do
140
+ run "bundle install"
141
+ run "bundle exec vite install"
142
+ end
143
+ end
144
+
137
145
  # Vite - Copy over the Vite entrypoints
138
146
  def copy_vite_entrypoints
139
- copy_file "clover.js", "app/frontend/entrypoints/clover.js"
140
- copy_file "ol.js", "app/frontend/entrypoints/ol.js"
147
+ copy_file "clover.js", "app/javascript/entrypoints/clover.js"
148
+ copy_file "ol.js", "app/javascript/entrypoints/ol.js"
141
149
  end
142
150
  end
143
151
  end
@@ -1,4 +1,4 @@
1
- import CloverInitializer from '@gbl/clover/clover_initializer'
1
+ import { CloverInitializer } from '@geoblacklight/frontend'
2
2
 
3
3
  document.addEventListener('DOMContentLoaded', () => {
4
4
  new CloverInitializer().run()
@@ -1,4 +1,5 @@
1
- import OlInitializer from '@gbl/openlayers/ol_initializer'
1
+ import '@geoblacklight/frontend/dist/style.css'
2
+ import { OlInitializer } from '@geoblacklight/frontend'
2
3
 
3
4
  document.addEventListener('DOMContentLoaded', () => {
4
5
  new OlInitializer().run()
@@ -0,0 +1,10 @@
1
+ {
2
+ "devDependencies": {
3
+ "vite": "^5.1.5",
4
+ "vite-plugin-ruby": "^5.0.0",
5
+ "vite-plugin-rails": "^0.5.0"
6
+ },
7
+ "scripts": {
8
+ "postinstall": "yarn link @geoblacklight/frontend"
9
+ }
10
+ }
@@ -1,4 +1,7 @@
1
1
  {
2
+ "dependencies": {
3
+ "@geoblacklight/frontend": "^4.4"
4
+ },
2
5
  "devDependencies": {
3
6
  "vite": "^5.1.5",
4
7
  "vite-plugin-ruby": "^5.0.0",
@@ -4,16 +4,5 @@ import rails from 'vite-plugin-rails'
4
4
  export default defineConfig({
5
5
  plugins: [
6
6
  rails(),
7
- ],
8
- // GeoBlacklight: Import assets from arbitrary paths.
9
- resolve: {
10
- alias: {
11
- '@gbl/': `${process.env.GBL_ASSETS_PATH}/`,
12
- },
13
- },
14
- server: {
15
- fs: {
16
- allow: [process.env.GBL_ASSETS_PATH!],
17
- },
18
- },
7
+ ]
19
8
  })
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "all": {
3
- "sourceCodeDir": "app/frontend",
3
+ "sourceCodeDir": "app/javascript",
4
4
  "watchAdditionalPaths": []
5
5
  },
6
6
  "development": {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geoblacklight
4
- VERSION = "4.3.0"
4
+ VERSION = "4.4.0.rc1"
5
5
  end
data/package.json CHANGED
@@ -1,8 +1,29 @@
1
1
  {
2
- "name": "geoblacklight",
3
- "version": "4.0.0",
4
- "private": true,
2
+ "name": "@geoblacklight/frontend",
3
+ "type": "module",
4
+ "version": "4.4.6",
5
5
  "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vite build",
12
+ "watch": "vite build --watch"
13
+ },
14
+ "files": ["dist"],
15
+ "main": "./dist/frontend.js",
16
+ "module": "./dist/frontend.umd.cjs",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/frontend.js",
20
+ "require": "./dist/frontend.umd.cjs"
21
+ },
22
+ "./dist/style.css": {
23
+ "import": "./dist/style.css",
24
+ "require": "./dist/style.css"
25
+ }
26
+ },
6
27
  "dependencies": {
7
28
  "@samvera/clover-iiif": "^2.3.2",
8
29
  "ol": "8.1.0",
@@ -10,7 +31,6 @@
10
31
  "react": "^18.2.0"
11
32
  },
12
33
  "devDependencies": {
13
- "vite": "^5.0.0",
14
- "vite-plugin-ruby": "^5.0.0"
34
+ "vite": "^5.0.0"
15
35
  }
16
36
  }
@@ -17,6 +17,6 @@ end
17
17
  feature "Clover IIIF fullscreen control", js: true do
18
18
  scenario "IIIF layer should have full screen control" do
19
19
  visit solr_document_path("princeton-sx61dn82p")
20
- expect(page).to have_css("#fullPage")
20
+ expect(page).to have_button("Toggle full page")
21
21
  end
22
22
  end
@@ -21,14 +21,25 @@ class TestAppGenerator < Rails::Generators::Base
21
21
  end
22
22
  end
23
23
 
24
+ def build_frontend
25
+ run "yarn install && yarn build"
26
+ end
27
+
28
+ # Ensure local frontend build is linked so internal test app
29
+ # can use local javascript instead of npm package.
30
+ def link_frontend
31
+ run "yarn link"
32
+ end
33
+
24
34
  def run_blacklight_generator
25
35
  say_status("warning", "GENERATING BL", :yellow)
26
36
 
27
37
  generate "blacklight:install", "--devise"
28
38
  end
29
39
 
40
+ # Install geoblacklight with the `test` option
30
41
  def install_engine
31
- generate "geoblacklight:install", "-f"
42
+ generate "geoblacklight:install", "-f --test"
32
43
  end
33
44
 
34
45
  # Symlink fixture document directories so the test app doesn't have to be
data/vite.config.ts CHANGED
@@ -1,8 +1,24 @@
1
+ import { resolve } from 'path'
1
2
  import { defineConfig } from 'vite'
2
- import RubyPlugin from 'vite-plugin-ruby'
3
+ import { exec } from 'child_process'
3
4
 
4
5
  export default defineConfig({
5
- plugins: [
6
- RubyPlugin(),
7
- ],
6
+ build: {
7
+ manifest: true,
8
+ minify: true,
9
+ reportCompressedSize: true,
10
+ lib: {
11
+ entry: resolve(__dirname, 'app/javascript/index.js'),
12
+ name: '@geoblacklight/frontend',
13
+ fileName: 'frontend'
14
+ }
15
+ },
16
+ "plugins": [
17
+ {
18
+ name: 'clobber internal test app vite files and cache',
19
+ buildEnd: async() => {
20
+ exec("cd .internal_test_app && bundle exec vite clobber")
21
+ }
22
+ }
23
+ ]
8
24
  })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-03-08 00:00:00.000000000 Z
14
+ date: 2024-04-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -435,6 +435,7 @@ files:
435
435
  - app/assets/images/blacklight/multipoint.svg
436
436
  - app/assets/images/blacklight/multipolygon.svg
437
437
  - app/assets/images/blacklight/nebraska.svg
438
+ - app/assets/images/blacklight/northwestern-university.svg
438
439
  - app/assets/images/blacklight/nyu.svg
439
440
  - app/assets/images/blacklight/ohio-state.svg
440
441
  - app/assets/images/blacklight/pagelines-brands.svg
@@ -549,18 +550,16 @@ files:
549
550
  - app/controllers/download_controller.rb
550
551
  - app/controllers/relation_controller.rb
551
552
  - app/controllers/wms_controller.rb
552
- - app/frontend/clover/clover_initializer.js
553
- - app/frontend/entrypoints/application.js
554
- - app/frontend/entrypoints/clover.js
555
- - app/frontend/entrypoints/ol.js
556
- - app/frontend/openlayers/basemaps.js
557
- - app/frontend/openlayers/ol_initializer.js
558
- - app/frontend/stylesheets/openlayers.css
559
553
  - app/helpers/arcgis_helper.rb
560
554
  - app/helpers/blacklight_helper.rb
561
555
  - app/helpers/carto_helper.rb
562
556
  - app/helpers/geoblacklight/geoblacklight_helper_behavior.rb
563
557
  - app/helpers/geoblacklight_helper.rb
558
+ - app/javascript/clover/clover_initializer.js
559
+ - app/javascript/index.js
560
+ - app/javascript/openlayers/basemaps.js
561
+ - app/javascript/openlayers/ol_initializer.js
562
+ - app/javascript/stylesheets/openlayers.css
564
563
  - app/models/concerns/geoblacklight/bbox_filter_field.rb
565
564
  - app/models/concerns/geoblacklight/bbox_filter_query.rb
566
565
  - app/models/concerns/geoblacklight/solr_document.rb
@@ -613,7 +612,6 @@ files:
613
612
  - config/initializers/new_gbl_settings_defaults_4.1.yml
614
613
  - config/initializers/rails_config.rb
615
614
  - config/locales/geoblacklight.en.yml
616
- - config/vite.json
617
615
  - geoblacklight.gemspec
618
616
  - jest.config.js
619
617
  - lib/generators/geoblacklight/assets_generator.rb
@@ -627,12 +625,12 @@ files:
627
625
  - lib/generators/geoblacklight/templates/catalog_controller.rb
628
626
  - lib/generators/geoblacklight/templates/clover.js
629
627
  - lib/generators/geoblacklight/templates/ol.js
628
+ - lib/generators/geoblacklight/templates/package-test.json
630
629
  - lib/generators/geoblacklight/templates/package.json
631
630
  - lib/generators/geoblacklight/templates/settings.gbl_v1.yml
632
631
  - lib/generators/geoblacklight/templates/settings.yml
633
632
  - lib/generators/geoblacklight/templates/vite.config.ts
634
633
  - lib/generators/geoblacklight/templates/vite.json
635
- - lib/generators/geoblacklight/templates/vite.rb
636
634
  - lib/geoblacklight.rb
637
635
  - lib/geoblacklight/bounding_box.rb
638
636
  - lib/geoblacklight/constants.rb
@@ -1,28 +0,0 @@
1
- // To see this message, add the following to the `<head>` section in your
2
- // views/layouts/application.html.erb
3
- //
4
- // <%= vite_client_tag %>
5
- // <%= vite_javascript_tag 'application' %>
6
- console.log('Vite ⚡️ Rails - Engine')
7
-
8
- // If using a TypeScript entrypoint file:
9
- // <%= vite_typescript_tag 'application' %>
10
- //
11
- // If you want to use .jsx or .tsx, add the extension:
12
- // <%= vite_javascript_tag 'application.jsx' %>
13
-
14
- console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
15
-
16
- // Example: Load Rails libraries in Vite.
17
- //
18
- // import * as Turbo from '@hotwired/turbo'
19
- // Turbo.start()
20
- //
21
- // import ActiveStorage from '@rails/activestorage'
22
- // ActiveStorage.start()
23
- //
24
- // // Import all channels.
25
- // const channels = import.meta.globEager('./**/*_channel.js')
26
-
27
- // Example: Import a stylesheet in app/frontend/index.css
28
- // import '~/index.css'
@@ -1,5 +0,0 @@
1
- import CloverInitializer from '@/clover/clover_initializer'
2
-
3
- document.addEventListener('DOMContentLoaded', () => {
4
- new CloverInitializer().run()
5
- })
@@ -1,5 +0,0 @@
1
- import OlInitializer from '@/openlayers/ol_initializer'
2
-
3
- document.addEventListener('DOMContentLoaded', () => {
4
- new OlInitializer().run()
5
- })
@@ -1 +0,0 @@
1
- @import "../../../node_modules/ol/ol.css";
data/config/vite.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "all": {
3
- "sourceCodeDir": "app/frontend",
4
- "publicOutputDir": "geoblacklight-vite",
5
- "watchAdditionalPaths": []
6
- },
7
- "development": {
8
- "autoBuild": true,
9
- "port": 3037
10
- },
11
- "test": {
12
- "autoBuild": true
13
- }
14
- }
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ViteRuby.env["GBL_ASSETS_PATH"] =
4
- "#{Gem.loaded_specs["geoblacklight"].full_gem_path}/app/frontend"