-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GBL 4.1: working vite install, scripts from local and engine working
- Loading branch information
Showing
18 changed files
with
263 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
vite: bin/vite dev | ||
web: bin/rails s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// To see this message, add the following to the `<head>` section in your | ||
// views/layouts/application.html.erb | ||
// | ||
// <%= vite_client_tag %> | ||
// <%= vite_javascript_tag 'application' %> | ||
console.log('Vite ⚡️ Rails - Engine') | ||
|
||
// If using a TypeScript entrypoint file: | ||
// <%= vite_typescript_tag 'application' %> | ||
// | ||
// If you want to use .jsx or .tsx, add the extension: | ||
// <%= vite_javascript_tag 'application.jsx' %> | ||
|
||
console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails') | ||
|
||
// Example: Load Rails libraries in Vite. | ||
// | ||
// import * as Turbo from '@hotwired/turbo' | ||
// Turbo.start() | ||
// | ||
// import ActiveStorage from '@rails/activestorage' | ||
// ActiveStorage.start() | ||
// | ||
// // Import all channels. | ||
// const channels = import.meta.globEager('./**/*_channel.js') | ||
|
||
// Example: Import a stylesheet in app/frontend/index.css | ||
// import '~/index.css' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'vite' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
|
||
bundle_binstub = File.expand_path("bundle", __dir__) | ||
|
||
if File.file?(bundle_binstub) | ||
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") | ||
load(bundle_binstub) | ||
else | ||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. | ||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") | ||
end | ||
end | ||
|
||
require "rubygems" | ||
require "bundler/setup" | ||
|
||
load Gem.bin_path("vite_ruby", "vite") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"all": { | ||
"sourceCodeDir": "app/frontend", | ||
"publicOutputDir": "geoblacklight-admin-vite", | ||
"watchAdditionalPaths": [] | ||
}, | ||
"development": { | ||
"autoBuild": true, | ||
"port": 3037 | ||
}, | ||
"test": { | ||
"autoBuild": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
lib/generators/geoblacklight_admin/templates/api_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
lib/generators/geoblacklight_admin/templates/base.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<%= content_tag :html, class: 'no-js', **html_tag_attributes do %> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="geoblacklight-version" content="<%= Geoblacklight::VERSION %>"> | ||
|
||
<!-- Internet Explorer use the highest version available --> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
|
||
<title><%= render_page_title %></title> | ||
<script> | ||
document.querySelector('html').classList.remove('no-js'); | ||
</script> | ||
<%= opensearch_description_tag application_name, opensearch_catalog_url(format: 'xml') %> | ||
<%= favicon_link_tag %> | ||
<%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %> | ||
<%= javascript_include_tag "application", "data-turbo-track": "reload" %> | ||
|
||
<%= vite_client_tag %> | ||
<%= vite_javascript_tag 'application' %> | ||
|
||
<%= csrf_meta_tags %> | ||
<%= content_for(:head) %> | ||
</head> | ||
<body class="<%= render_body_class %>"> | ||
<nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>"> | ||
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %> | ||
<%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %> | ||
<%= content_for(:skip_links) %> | ||
</nav> | ||
<%= render partial: 'shared/header_navbar' %> | ||
|
||
<main id="main-container" class="<%= container_classes %>" role="main" aria-label="<%= t('blacklight.main.aria.main_container') %>"> | ||
<%= content_for(:container_header) %> | ||
|
||
<%= render partial: 'shared/flash_msg', layout: 'shared/flash_messages' %> | ||
|
||
<div class="row"> | ||
<%= content_for?(:content) ? yield(:content) : yield %> | ||
</div> | ||
</main> | ||
|
||
<%= render partial: 'shared/footer' %> | ||
<%= render partial: 'shared/modal' %> | ||
</body> | ||
<% end %> |
16 changes: 16 additions & 0 deletions
16
lib/generators/geoblacklight_admin/templates/config/vite.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"all": { | ||
"sourceCodeDir": "app/frontend", | ||
"watchAdditionalPaths": [] | ||
}, | ||
"development": { | ||
"autoBuild": true, | ||
"publicOutputDir": "vite-dev", | ||
"port": 3036 | ||
}, | ||
"test": { | ||
"autoBuild": true, | ||
"publicOutputDir": "vite-test", | ||
"port": 3037 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
ViteRuby.env['GBL_ADMIN_ASSETS_PATH'] = | ||
"#{ Gem.loaded_specs['geoblacklight_admin'].full_gem_path }/app/frontend" |
30 changes: 30 additions & 0 deletions
30
lib/generators/geoblacklight_admin/templates/frontend/entrypoints/application.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// To see this message, add the following to the `<head>` section in your | ||
// views/layouts/application.html.erb | ||
// | ||
// <%= vite_client_tag %> | ||
// <%= vite_javascript_tag 'application' %> | ||
console.log('Vite ⚡️ Rails - Local') | ||
|
||
// If using a TypeScript entrypoint file: | ||
// <%= vite_typescript_tag 'application' %> | ||
// | ||
// If you want to use .jsx or .tsx, add the extension: | ||
// <%= vite_javascript_tag 'application.jsx' %> | ||
|
||
console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails') | ||
|
||
// Example: Load Rails libraries in Vite. | ||
// | ||
// import * as Turbo from '@hotwired/turbo' | ||
// Turbo.start() | ||
// | ||
// import ActiveStorage from '@rails/activestorage' | ||
// ActiveStorage.start() | ||
// | ||
// // Import all channels. | ||
// const channels = import.meta.globEager('./**/*_channel.js') | ||
|
||
// Example: Import a stylesheet in app/frontend/index.css | ||
// import '~/index.css' | ||
|
||
import '@gbl_admin/entrypoints/engine' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
lib/generators/geoblacklight_admin/templates/vite.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineConfig } from 'vite' | ||
import rails from 'vite-plugin-rails' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
rails(), | ||
], | ||
// GBL Admin: Import assets from arbitrary paths. | ||
resolve: { | ||
alias: { | ||
'@gbl_admin/': `${process.env.GBL_ADMIN_ASSETS_PATH}/`, | ||
}, | ||
}, | ||
server: { | ||
fs: { | ||
allow: [process.env.GBL_ADMIN_ASSETS_PATH!], | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"devDependencies": { | ||
"vite": "^5.0.0", | ||
"vite-plugin-ruby": "^5.0.0", | ||
"vite-plugin-rails": "^0.5.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'vite' | ||
import RubyPlugin from 'vite-plugin-ruby' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
RubyPlugin(), | ||
], | ||
}) |