Group: Free Javascript Action Team/LibreJS Tips

From LibrePlanet
Jump to: navigation, search
(Tips for LibreJS on Discourse)
 
(Tips for updating LibreJS code quickly after a software update.)
 
Line 29: Line 29:
 
</pre>
 
</pre>
  
Then update your JS file names and source code bundles.
+
I distribute the source code for the JavaScript in Discourse by linking to tarballs of specific directories that contain the source JS for each file that is being served, along with the other JS in that directory, which may be shared by other JS files. This helps to reduce the number of JS bundles that need to be made, without requiring that one serve the entire Discourse Git repo.
 +
 
 +
After upgrading, I suggest copying and pasting the new, rejected JS file names over the existing file names in the Web Labels repo. Then do a git diff to see a summary of what has changed. Look under each diff entry to see the .tgz file that needs to be updated. Unpack the original tgz files and look at what is inside of them. Clone the Discourse app repo, and check out the git commit ID reported by the forum admin page. Run a find command in the discourse app repo for one of those files in the unpacked tgz. Look at what is in its parent folder. If its contents matches, that's one of the tgzs you need to create and copy into the Web Labels repo. Copy them over, clean out the temporary tgz unpack directories, then commit and push. Visit the Web Labels page to refresh the JS list cache for the plugin. Visit the forum to see what else needs fixing. Rinse and repeat.

Latest revision as of 15:53, 17 August 2020

For certain software, like Discourse, there are ways to speed up your manual LibreJS Web Labels work after updating your site with new JS.

Discourse

You'll need to Add a Web Labels link after each time you upgrade:

./launcher enter app

patch -p1 << EOF
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 9cb5efcce9..5003d5e57c 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -96,6 +96,8 @@
     <section id='main'>
     </section>

+    <div style="display: none"><a href="https://weblabels.fsf.org/forum.members.fsf.org/CURRENT/" rel="jslicense">JS Licenses</a></div>
+
     <div id='offscreen-content'>
     </div>

EOF

exit

./launcher restart app   ## not 'rebuild'!

I distribute the source code for the JavaScript in Discourse by linking to tarballs of specific directories that contain the source JS for each file that is being served, along with the other JS in that directory, which may be shared by other JS files. This helps to reduce the number of JS bundles that need to be made, without requiring that one serve the entire Discourse Git repo.

After upgrading, I suggest copying and pasting the new, rejected JS file names over the existing file names in the Web Labels repo. Then do a git diff to see a summary of what has changed. Look under each diff entry to see the .tgz file that needs to be updated. Unpack the original tgz files and look at what is inside of them. Clone the Discourse app repo, and check out the git commit ID reported by the forum admin page. Run a find command in the discourse app repo for one of those files in the unpacked tgz. Look at what is in its parent folder. If its contents matches, that's one of the tgzs you need to create and copy into the Web Labels repo. Copy them over, clean out the temporary tgz unpack directories, then commit and push. Visit the Web Labels page to refresh the JS list cache for the plugin. Visit the forum to see what else needs fixing. Rinse and repeat.