-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[SE-3401] Updates JakePackage.zip to make JS minification consistent across different machines #25324
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
[SE-3401] Updates JakePackage.zip to make JS minification consistent across different machines #25324
Conversation
|
Thanks for the pull request, @nizarmah! I've created OSPR-5047 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
7c1061e to
296c518
Compare
|
@nizarmah Thank you for your contribution. Please let me know once it ready for our review. |
c674569 to
59636fd
Compare
8ca80cc to
e93f52f
Compare
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.
@nizarmah Since this only adds the zipped folder, could you include the exact changes you made in a diff format in the description? Also I think it's a good idea to include the minified files.
|
@pkulkark yes, definitely, I'll ping you once that's ready 👍 |
|
Alright, @pkulkark, added all the changes as they were using |
pkulkark
left a comment
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.
Thanks @nizarmah. LGTM 👍
- I tested this: verified that JS minification is consistent across different machines.
- I read through the code
|
@natabene this is ready for edX's review 👍 😃 |
|
@nizarmah Thank you for your contribution. I am lining this up for our review. |
|
@natabene are there any updates on this? This is currently blocking the merge of https://github.com/edx/configuration/pull/6179 Also @doctoryes, based on the discussion from a different pull request, what are your thoughts about removing the zip file, and moving the We will soon have an ansible role for re-building the TinyMCE files, so it might be possible to simplify the process and get remove the ZIP file. |
|
@nizarmah No updates yet, we didn't have enough bandwidth to address this. Hopefully soon. |
|
@nizarmah The commit was six years ago so I've lost context. But I recall needing to make the change mentioned in the commit message here: edx@2a8529d |
|
Thanks for the reply on this @doctoryes 🙂 @pomegranited, since you reviewed https://github.com/edx/configuration/pull/6179, what are your suggestions here? Should I submit follow-up requests to both the configuration and the platform or make changes to the existing two pull requests? The reason I'm asking is that the new follow-up requests will depend on each other, similarly to how the current pull requests do. So, it would create additional blocks. |
|
@nizarmah I think KISS applies here -- just leave this PR as-is and don't worry about a follow-up. If we haven't touched this package in 4 years, then I don't think there's a reason to be in an all-fired hurry to fix what ain't broke. 😄 |
|
@natabene Is it OK if I review this one, since it relates to another PR I'm reviewing? @nizarmah If I just run |
ffba8d7 to
9e6ea6e
Compare
|
@bradenmacdonald I'm glad you mentioned that, it turns out I forgot to update the build instructions. I know I haven't linked a sandbox above, but we can use the one from https://github.com/edx/edx-platform/pull/25695 👍🏼 Here's how I'd personally test it in order to verify that the TinyMCE editor will work for everyone after this change. Switching Back to Default TinyMCE EditorRemoving ADSK Plugin
Rebuilding TinyMCE Editor
Once that's done, go to the TinyMCE editor and verify that the ADSK Plugin is no longer being used. To verify that everything is working normally, you can compare the result to this sandbox which is a default build without rebuilt TinyMCE editor:
Use Adding the ADSK Plugin AgainAdding ADSK Plugin Files
Rebuilding TinyMCE EditorFollow the steps mentioned above in order to rebuild the files, but for step 8 uncomment the Now, open the TinyMCE editor again, and you should have the ADSK Plugin available to use. |
bradenmacdonald
left a comment
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.
👍 Thanks for figuring this out, and for the documentation update, and the very explicit test instructions (just what I needed)! 💯
- I tested this: as described, in PR description and comment
- I read through the code
- I checked for accessibility issues: n/a
- Includes documentation
Please squash to one commit and I'll get this merged.
…ctions The clean-js jake command helps remove all minified js files that get generated using the minify bundle jake command By running clean-js before running the minify command, we ensure that the tinymce files are consistent after being rebuilt/minified. This is helpful with multiple app servers that are applying the same changes to the TinyMCE editor This ensures that no matter on which machine the files are rebuilt, the resulting minified plugin files are consistent among all
bc29b18 to
796621e
Compare
|
@bradenmacdonald I'm glad the testing instructions were helpful 😃 I have squashed. The commit message was mainly about the changes in the commit, because the title of this Pull Request is a bit vague... Let me know if you'd like me to change that though. 👍🏼 |
|
Your PR has finished running tests. There were no failures. |
|
@nizarmah 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
Thank you for the contribution (and thank you @bradenmacdonald for the review)! The PR message for this gives a fantastic level of detail that will undoubtedly be very useful for people who are debugging pipeline issues years down the line. Please feel free to add more of those details to the commit messages on any future issues. Thanks again! |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR may have caused e2e tests to fail on Stage. If you're a member of the edX org, please visit #e2e-troubleshooting on Slack to help diagnose the cause of these failures. Otherwise, it is the reviewer's responsibility. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/deploy_to_stage |
|
EdX Release Notice: This PR has been deployed to the production environment. |
…ctions (openedx#25324) The clean-js jake command helps remove all minified js files that get generated using the minify bundle jake command By running clean-js before running the minify command, we ensure that the tinymce files are consistent after being rebuilt/minified. This is helpful with multiple app servers that are applying the same changes to the TinyMCE editor This ensures that no matter on which machine the files are rebuilt, the resulting minified plugin files are consistent among all (cherry picked from commit b49ebb9)
…ctions (openedx#25324) The clean-js jake command helps remove all minified js files that get generated using the minify bundle jake command By running clean-js before running the minify command, we ensure that the tinymce files are consistent after being rebuilt/minified. This is helpful with multiple app servers that are applying the same changes to the TinyMCE editor This ensures that no matter on which machine the files are rebuilt, the resulting minified plugin files are consistent among all (cherry picked from commit b49ebb9)
…ctions (openedx#25324) The clean-js jake command helps remove all minified js files that get generated using the minify bundle jake command By running clean-js before running the minify command, we ensure that the tinymce files are consistent after being rebuilt/minified. This is helpful with multiple app servers that are applying the same changes to the TinyMCE editor This ensures that no matter on which machine the files are rebuilt, the resulting minified plugin files are consistent among all (cherry picked from commit b49ebb9)
When generating the minified files for the TinyMCE static files using the
vendor_extra/tinymce/JakePackage.zip, there's often a problem that was happening where the files are different after running the following command:This becomes an issue when installing a new TinyMCE plugin on different machines and re-running
jake minify bundle, because the files are not consistent on different machines. This results in a differentcommons.jsfile hash on the different machines, which makes it not possible to use multiple instances with a load balancer.Some of the issues are,
amdlccompiles the minified output for a plugin, and thenuglify-jsdoesn't update the file. Therefore, removed the minification process from theamdlcstep and reverted minification touglify-js.There are other reasons why the
commons.jsfile hash is different, which are mentioned in PR edx#24990.Therefore, this is a follow-up PR to edx#24990.
This PR simply adds a specific configuration for
uglify-js, which is:One of the most important is,
sortwhich makes the mangled variable names consistent on different runs. Also,comparisonsandif_returnare specified because they were sometimes applied, while others times, they weren't.JIRA tickets: SE-3401, SE-3101, SE-3381, OSPR-5047
Testing instructions:
common/static/js/vendor/tinymce/unzip ../../../../../vendor_extra/tinymce/JakePackage.ziprm -rf node_modulesnpm installnpx jake cleanplugin.min.jswere generated correctly using:grep -Er "^undefined$".Author notes and concerns:
Files changed:
package.json:"repository": { - "type" : "git", - "url" : "https://github.com/tinymce/tinymce.git" + "type": "git", + "url": "https://github.com/tinymce/tinymce.git" }, "description": "TinyMCE rich text editor", "author": "Johan Sörlin <spocke@moxiecode.com>", - "bugs": { "url" : "http://www.tinymce.com/develop/bugtracker.php" }, + "bugs": { + "url": "http://www.tinymce.com/develop/bugtracker.php" + }, "private": true, "engines": { - "node" : ">=0.10.26" + "node": ">=0.10.26" }, "devDependencies": { - "jake": ">= 0.7.0", - "amdlc": ">= 0.0.2", - "jshint": ">= 2.1.4", - "eslint": ">= 0.4.2", - "uglify-js": ">= 2.0.0", - "glob": ">= 3.1.12", - "moxie-zip": ">= 0.0.1", - "less": ">= 1.3.1", - "coverjs": ">= 0.0.14" + "jake": "0.7.10", + "amdlc": "0.1.2", + "jshint": "2.4.4", + "eslint": "0.4.5", + "uglify-js": "2.4.13", + "glob": "3.2.9", + "moxie-zip": "0.0.3", + "less": "1.7.0", + "coverjs": "0.0.14" },package-lock.json+ everything...Jakefile.jstools/BuildTools.jsReviewers