Skip to content

Commit

Permalink
Update and pin jquery-serializejson
Browse files Browse the repository at this point in the history
Moving from 2.4.2 to 3.2.1 for our use seems have no breaking changes:
https://github.com/marioizquierdo/jquery.serializeJSON/blob/8a2f2cfebd928b65509181bcdf01f8de243ed573/CHANGELOG.md

Importmap was used to download and pin the CDN package. Combined with
the node-resolve plugin for rollup, this is working for me on builds
using the rolled up assets as well as experimental builds using only
importmaps.
  • Loading branch information
taylor-steve committed Aug 14, 2024
1 parent 827ddcb commit 180a7f2
Show file tree
Hide file tree
Showing 14 changed files with 255 additions and 719 deletions.
3 changes: 2 additions & 1 deletion app/assets/config/spotlight/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//= link_tree ../../images
//= link_tree ../../../javascript .js
//= link_tree ../../../../vendor/assets/javascripts .js
//= link_tree ../../../../vendor/assets/javascripts .js
//= link_tree ../../../../vendor/javascript .js
240 changes: 5 additions & 235 deletions app/assets/javascripts/spotlight/spotlight.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.esm.js.map

Large diffs are not rendered by default.

250 changes: 11 additions & 239 deletions app/assets/javascripts/spotlight/spotlight.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/javascript/spotlight/admin/block_mixins/formable.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import jQuery from 'jquery';
import serializeJSON from 'jquery-serializejson';

(function ($){
SirTrevor.BlockMixins.Formable = {
mixinName: "Formable",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/spotlight/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'nestable'
import 'parameterize'
import 'bootstrap-tagsinput'
import 'jquery.serializejson'
import 'leaflet-iiif'
import 'Leaflet.Editable'
import 'Path.Drag'
Expand Down
1 change: 1 addition & 0 deletions config/importmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

pin_all_from File.expand_path('../app/javascript/spotlight', __dir__), under: 'spotlight'
pin_all_from File.expand_path('../vendor/assets/javascripts', __dir__)
pin 'jquery-serializejson' # @3.2.1
1 change: 1 addition & 0 deletions lib/spotlight/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Engine < ::Rails::Engine

initializer 'spotlight.assets.precompile' do |app|
app.config.assets.paths << Engine.root.join('app/javascript')
app.config.assets.paths << Engine.root.join('vendor/javascript')
app.config.assets.precompile += PRECOMPILE_ASSETS
end

Expand Down
211 changes: 209 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"url": "git+https://github.com/projectblacklight/spotlight.git"
},
"files": [
"app/assets", "vendor/assets"
"app/assets",
"vendor/assets"
],
"author": "",
"license": "Apache-2.0",
Expand All @@ -20,6 +21,7 @@
},
"homepage": "https://github.com/projectblacklight/spotlight#readme",
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"rollup": "^2.60.0",
"rollup-plugin-includepaths": "^0.2.4"
},
Expand Down
20 changes: 16 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
'use strict'

import includePaths from 'rollup-plugin-includepaths';
import resolve from '@rollup/plugin-node-resolve';

const path = require('path')

const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'

const fileDest = `spotlight${ESM ? '.esm' : ''}`
const external = []
const globals = {}
const external = [
'jquery'
]
const globals = {
'jquery': 'jQuery'
}

let includePathOptions = {
include: {},
paths: ['app/javascript', 'vendor/assets/javascripts'],
paths: [
'app/javascript',
'vendor/assets/javascripts',
'vendor/javascript'
],
external: [],
extensions: ['.js', '.es6']
};
Expand All @@ -27,7 +36,10 @@ const rollupConfig = {
generatedCode: 'es2015'
},
external,
plugins: [includePaths(includePathOptions)]
plugins: [
includePaths(includePathOptions),
resolve()
]
}

if (!ESM) {
Expand Down
Loading

0 comments on commit 180a7f2

Please sign in to comment.