-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Fix copying top-level demos files #216
Conversation
1. Remove the `externalDir` variable that was computed but not used. 2. Remove the local unused `globalize` variable. 3. Declare the local `external` variable - previously, build code was overwriting the `external` global.
The logic to copy files from demos was faulty for top-level files - it was copying them to the `undefined` subdirectory. This is now fixed. Also, dot-files are no longer copied; we don't need the ESLint config copied, for example.
I cannot fully test this locally as demo embeds don't load in my local setup based on You can also verify that while https://jqueryui.com/resources/demos/search.js is a 404, https://jqueryui.com/resources/demos/undefined/search.js does exist. 🙂 I think we can merge it even without fully testing locally. |
@Krinkle one thing - while this PR definitely fixes some copying issues, I don't think it will fix the demos in itself. jQuery UI deploy code deAMDifies JS the HTML and the resulting HTML doesn't use RequireJS at all. |
The proper fix will most likely also require (no pun intended) making |
Actually, I could test it via a simple:
and opening http://localhost:7001/resources/demos/autocomplete/multiple-remote.html in a browser. PR incoming... |
The `jqueryui.com` demos build process deAMDifies HTML files, replacing required JS files with direct script tags. On the other hand, when running demos locally from the jQuery UI repository, RequireJS is used. This used to work fine until we got a new `search.js` file introduced in jquerygh-2187. The deAMDifying process doesn't touch non-HTML files which made loading autocomplete demos crash on "require is not a function" To resolve the issues without a major rearchitecture of the build process, the `search.js` file now detects AMD and use `require`, falling back to relying on the `jQuery` global in the other case. Ref jquerygh-2187 Ref jquery/jqueryui.com#216
The jQuery UI fix is available at jquery/jquery-ui#2274. I tested both the in-repo setup and the jqueryui.com one. |
The `jqueryui.com` demos build process deAMDifies HTML files, replacing required JS files with direct script tags. On the other hand, when running demos locally from the jQuery UI repository, RequireJS is used. This used to work fine until we got a new `search.js` file introduced in gh-2187. The deAMDifying process doesn't touch non-HTML files which made loading autocomplete demos crash on "require is not a function" To resolve the issues without a major rearchitecture of the build process, the `search.js` file now detects AMD and uses `require`, falling back to relying on the `jQuery` global in the other case. Closes gh-2274 Ref gh-2187 Ref jquery/jqueryui.com#216
As expected, https://stage.jqueryui.com/autocomplete/#multiple-remote now loads It should be working in production once jQuery UI 1.14.0 is released. |
The logic to copy files from demos was faulty for top-level files - it was
copying them to the
undefined
subdirectory. This is now fixed.Also, dot-files are no longer copied; we don't need the ESLint config copied,
for example.
Also, the first commit contains some minor cleanup:
externalDir
variable that was computed but not used.globalize
variable.external
variable - previously, build code wasoverwriting the
external
global.