Skip to content
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

Demos: Make autocomplete demos work on jqueryui.com #2274

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

mgol
Copy link
Member

@mgol mgol commented Jul 29, 2024

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.

Ref gh-2187
Ref jquery/jqueryui.com#216

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
@mgol mgol merged commit 600057f into jquery:main Jul 30, 2024
9 checks passed
@mgol mgol deleted the demos-fix branch July 30, 2024 06:31
@mgol mgol removed the Needs review label Jul 30, 2024
@mgol mgol removed request for fnagel and timmywil July 30, 2024 06:32
mgol added a commit to jquery/jqueryui.com that referenced this pull request Jul 30, 2024
* Build: Remove dead code, make the `external` variable local

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.

* Build: Fix copying top-level demos files

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.

Closes gh-216
Ref jquery/jquery-ui#2274
Copy link
Member

@fnagel fnagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants