Skip to content

Commit

Permalink
Merge pull request #321 from jonathanhefner/rake-vendor_javascript-esm
Browse files Browse the repository at this point in the history
Update `vendor_javascript` Rake task to download ESM
  • Loading branch information
jonathanhefner authored Oct 5, 2023
2 parents b599e60 + 70601cd commit e52a745
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ end

ASSETS_PATH = "lib/rdoc/generator/template/rails/resources"

desc "Download and vendor JavaScript assets"
task :vendor_javascript do
module Importmap; end
require "importmap/packager"

packager = Importmap::Packager.new(vendor_path: "#{ASSETS_PATH}/js")
imports = packager.import("@hotwired/turbo", from: "unpkg")
imports.each do |package, url|
umd_url = url.gsub("esm.js", "umd.js")
puts %(Vendoring "#{package}" to #{packager.vendor_path}/#{package}.js via download from #{umd_url})
packager.download(package, umd_url)
puts %(Vendoring "#{package}" to #{packager.vendor_path}/#{package}.js via download from #{url})
packager.download(package, url)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ Copyright © 2023 37signals LLC

/**
* The MIT License (MIT)
*
*
* Copyright (c) 2019 Javan Makhmali
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down

0 comments on commit e52a745

Please sign in to comment.