DEV: Fix javascript:update rake task (#17098)

* The `javascript:update` rake task failed because recent versions of chart.js use a lowercase filename (`chart.min.js` instead of `Chart.min.js`)

* Changed `loadScript()` to use lowercase keys to lookup scripts

* `svg-arrow.css` seems to have changed slightly (linebreak at the end of file)
This commit is contained in:
Gerhard Schlager 2022-06-15 19:49:04 +02:00 committed by GitHub
parent a7034c5a14
commit 888f50543d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 5 deletions

View File

@ -119,7 +119,7 @@ export function cacheBuster(url) {
if (PUBLIC_JS_VERSIONS) {
let [folder, ...lib] = url.split("/").filter(Boolean);
if (folder === "javascripts") {
lib = lib.join("/");
lib = lib.join("/").toLowerCase();
const versionedPath = PUBLIC_JS_VERSIONS[lib];
if (versionedPath) {
return `/javascripts/${versionedPath}`;

View File

@ -4,7 +4,7 @@
export const PUBLIC_JS_VERSIONS = {
"ace/ace.js": "ace.js/1.4.13/ace.js",
"jsoneditor.js": "@json-editor/json-editor/2.6.1/jsoneditor.js",
"Chart.min.js": "chart.js/3.5.1/Chart.min.js",
"chart.min.js": "chart.js/3.5.1/chart.min.js",
"chartjs-plugin-datalabels.min.js":
"chartjs-plugin-datalabels/2.0.0/chartjs-plugin-datalabels.min.js",
"diffhtml.min.js": "diffhtml/1.0.0-beta.20/diffhtml.min.js",

View File

@ -24,4 +24,15 @@ module("Unit | Utility | load-script", function () {
`/javascripts/${jsVersions["ace/ace.js"]}`
);
});
test("lookups are case-insensitive", (assert) => {
assert.strictEqual(
cacheBuster("/javascripts/Chart.min.js"),
`/javascripts/${jsVersions["chart.min.js"]}`
);
assert.strictEqual(
cacheBuster("/javascripts/chart.min.js"),
`/javascripts/${jsVersions["chart.min.js"]}`
);
});
});

View File

@ -1 +1 @@
.tippy-box[data-placement^=top]>.tippy-svg-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-svg-arrow:after,.tippy-box[data-placement^=top]>.tippy-svg-arrow>svg{top:16px;transform:rotate(180deg)}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow>svg{bottom:16px}.tippy-box[data-placement^=left]>.tippy-svg-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-svg-arrow:after,.tippy-box[data-placement^=left]>.tippy-svg-arrow>svg{transform:rotate(90deg);top:calc(50% - 3px);left:11px}.tippy-box[data-placement^=right]>.tippy-svg-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-svg-arrow:after,.tippy-box[data-placement^=right]>.tippy-svg-arrow>svg{transform:rotate(-90deg);top:calc(50% - 3px);right:11px}.tippy-svg-arrow{width:16px;height:16px;fill:#333;text-align:initial}.tippy-svg-arrow,.tippy-svg-arrow>svg{position:absolute}
.tippy-box[data-placement^=top]>.tippy-svg-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-svg-arrow:after,.tippy-box[data-placement^=top]>.tippy-svg-arrow>svg{top:16px;transform:rotate(180deg)}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-svg-arrow>svg{bottom:16px}.tippy-box[data-placement^=left]>.tippy-svg-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-svg-arrow:after,.tippy-box[data-placement^=left]>.tippy-svg-arrow>svg{transform:rotate(90deg);top:calc(50% - 3px);left:11px}.tippy-box[data-placement^=right]>.tippy-svg-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-svg-arrow:after,.tippy-box[data-placement^=right]>.tippy-svg-arrow>svg{transform:rotate(-90deg);top:calc(50% - 3px);right:11px}.tippy-svg-arrow{width:16px;height:16px;fill:#333;text-align:initial}.tippy-svg-arrow,.tippy-svg-arrow>svg{position:absolute}

View File

@ -75,7 +75,7 @@ def dependencies
package_name: '@json-editor/json-editor',
public: true
}, {
source: 'chart.js/dist/Chart.min.js',
source: 'chart.js/dist/chart.min.js',
public: true
}, {
source: 'chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.min.js',
@ -310,7 +310,7 @@ task 'javascript:update' => 'clean_up' do
else
package_dir_name = public_path_name(f)
package_version = JSON.parse(File.read("#{library_src}/#{node_package_name(f)}/package.json"))["version"]
versions[filename] = "#{package_dir_name}/#{package_version}/#{filename}"
versions[filename.downcase] = "#{package_dir_name}/#{package_version}/#{filename}"
path = "#{public_js}/#{package_dir_name}/#{package_version}"
dest = "#{path}/#{filename}"