-
Notifications
You must be signed in to change notification settings - Fork 67
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
Bundle jquery.uls and use language-data as dependency #394
base: master
Are you sure you want to change the base?
Conversation
This is probably good, but:
|
OK, I think I've found some issues. Most notably, in language-data there are no JS tests for these util functions:
Their functionality in jquery.uls and in language-data appears to be different, too. |
Can you please file a bug report with details in language-data repository about this? I did a quick comparison of code for these three methods and I could not find difference.
The tests were just copied from jquery.uls when language-data library was created. We need to add test wherever missing. But that is general improvements for language-data library. Not directly related to this pull request.
This need be addressed, But I think this is independent of what is tried in this pull request - at least technically. Any upstream changes released in language-data comes to jquery.uls as the result of this pull request.
This is done as dependency updates. We have defined a dependency like this: Whenever we release new version of language-data, in this repo, we need to change this line in package.json and use the latest version number. Then, along with any other jquery.uls changes, we can run npm run build, npm publish etc to release new version of jquery.uls |
<script src="../src/jquery.uls.lcd.js"></script> | ||
<script src="../src/jquery.uls.languagefilter.js"></script> | ||
<script src="../src/jquery.uls.core.js"></script> | ||
<script src="../jquery.uls.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running the examples directly from the root examples
directory no longer works. We should update the README.md file to mention that the users should build the files, and then run the examples from the dist/examples
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this PR is done, I plan to create a static application running from dist folder in github pages or netlify or similar places. Along with that I will address this confusion
Changes ======= Introduce rollup based bundler to create single js, css files. This allows easy usage and no need to include every source code files explicitly. Fixes issue #326 Add language-data as dependency to the library Instead of using scripts to clone the language-data repo and then create our javascript files from it, directly use language-data as dev-dependency. The final bundle will include language-data. So it is not an external dependency for bundle. Approach ======== To avoid any breakage in consumers, no change in jquery plugins were introduced. No method signature change too. All plugin definitions moved to src/index.js. index.js also import the language-data and alias that to $.uls.data. So, jquery.uls.data.js and jquery.uls.data.utils.js files were deleted. The scripts to generate this files was also deleted. All other changes in jquery.uls.*.js is just indendation change because of the removal of IIFE. The resuling bundle will have IIFE. IIFE block has to be removed to expose the classes for exporting as modules. Examples were updated to refer javascript, css and styles from dist folder. Future steps ============ Introduction of build step allows * To modernize the codebase to new versions of javascript * To drop jquery dependency and optionally keep the jquery plugins * Remove grunt based CI system
Also remove unwanted dev-dependencies
Remove rollup-plugin-sourcemaps modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, approved.
There were some conflicts which when resolving overrode some changes, I've checked and added them back.
I do like this approach, but it is a breaking change:
These are solvable issues, but I think this warrants a major version bump, and I'd like us to also reach out to the projects using jquery.uls for their feedback and concerns, and we probably should prepare patches for ULS/Translate before we merge it. Else we may end up in a situation we cannot update jquery.uls until those patches are ready. |
Changes
Introduce rollup based bundler to create single js, css files.
This allows easy usage and no need to include every source code files
explicitly. Fixes issue #326
Add language-data as dependency to the library
Instead of using scripts to clone the language-data repo and then create
our javascript files from it, directly use language-data as dev-dependency.
The final bundle will include language-data. So it is not an external
dependency for bundle.
Approach
To avoid any breakage in consumers, no change in jquery plugins were
introduced. No method signature change too. All plugin definitions
moved to src/index.js. index.js also import the language-data
and alias that to $.uls.data.
So, jquery.uls.data.js and jquery.uls.data.utils.js files were deleted.
The scripts to generate this files was also deleted.
All other changes in jquery.uls.*.js is just indendation change
because of the removal of IIFE. The resuling bundle will have IIFE.
IIFE block has to be removed to expose the classes for exporting
as modules.
Examples were updated to refer javascript, css and styles from dist
folder.
Future steps
Introduction of build step allows