mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
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:
parent
a7034c5a14
commit
888f50543d
|
@ -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}`;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"]}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
2
app/assets/stylesheets/vendor/svg-arrow.css
vendored
2
app/assets/stylesheets/vendor/svg-arrow.css
vendored
|
@ -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}
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user