What's the best way to debug JavaScript on IBM Connections? - ibm-connections

I've been building OpenSocial gadgets for IBM Connections and notice that the JavaScript is pre-fetched, minified and concatenated into a single file by the IBM Connections server.
This is great for production, but having already enabled developer mode in IBM Connections, it would be great if each JS file wasn't pushed onto a single line.
Is there a setting to prevent the minification?
Does IBM Connections generate a source map so that the original JS can be regenerated?
Is there anything else I'm missing?

I'm not aware of any source maps, but the dojo loader can help you out a lot. Add ?debug=true to a URL to have all JS files fetched separately, unminified. Use debug=dojo and the files will still be concatenated, but unminified.
If your URL has a # in it, place the ?debug=dojo before the #.

Related

Vue Frontend + NodeJS backend - local web app (browser)

I need to create an application which will be ran on the browser (local only, not hosted online). I will need to use a lightweight database which has a physical file (eg SQLite3, so I can have a .db file).
Also, just to mention:
I cant use IndexedDB alone to save the data because clearing browser data would clear the entire "database".
I also wouldn't be able to use electron since the bundle is too big. I need the browser for its portability
Also cant use PouchDB, since due to security constraints, online sync (CouchDB, etc) is not possible. Then it would be 100% stored in IndexedDB, which brings me back to my point on bullet 1
My question is - is there a way to create an offline web application build with VueJS frontend + NodeJS backend? I only need NodeJS because SQLite only works on the Node environment.
Deployment is preferably in .html only (is there any way that is possible, and access only using the file protocol file://)? Otherwise, I may consider using a local web server (localhost) - I'm not sure though if it is possible to serve an html file without any installations (node, python, etc), so I would still have to check all my options about this.
Any thoughts?
I am still new to this so please bear with me! There is very limited info online that talks about a 100% offline web application. Thanks a lot!

Server-side file system browser

I am creating a node.js web interface for an internal project in the company I am working at. The web page should allow users to select a file that is in the server memory disk for processing. I want to do something like a file browser but for the server-side file system.
I tried implementing it with jqueryfiletree but was not successful since I can not seem to put it to work. Is there any cheap trick or an useful package to do this?
Thank you in advance.
Using node.js you can get all files names in folder, using the fuction fs.readdir(). After that you can read file by name fs.readfile() and send him on client by http.
I think this is simplest solution.

How to check current browser against the list of supported ones

We have a list of browsers we test our webapp in. I have a task to notify the user if his browser isn't supported or tested to work well with our app.
We have a browserslist configuration in the project and I'm looking for a way to test current browser against the list.
I tried browserlist-useragent but we can't compile it with webpack due to the fact it uses net, fs, tls and other native node modules we don't want to include in our bundle.
Is there any better way do avoid copying the list of supported browsers in many different places and just use browserlist configuration that already exists to detect if user uses supported one or not?
I'd consider using this "utility" package https://github.com/browserslist/browserslist-useragent-regexp in the project that uses browserslist, and then use the file generated by the script suggested by this package to then use anywhere else.
In reality, all you want is the regex in the generated file. This can be placed in any client or server code you need for browser detection. I've placed mine in some classic asp.
Also note that on a Windows PC, the instructions provided don't result in a file containing a RegEx. Instead, you'd need to run npx browserslist-useragent-regexp --allowHigherVersions to display a suitable RegEx on your console, and then add that where needed.

Continuous deployment of a single-page app?

Here's the only solutions I've come up with (don't know if they're the adequate though):
Server-side updates:
Version every client request and have the proxy route to the
appropriate server version.
Cient-side updates:
Notify the client over a websocket connection to re-inject the
script/style tags after X number of idle minutes thereby invoking 2
ajax requests for updated JS/CSS files and refresh the HTML of the
page.
I don't know if this is something that shouldn't be a priority in the early stages of the app and I should just take the entire app down for "scheduled maintenance" in the early hours of the morning.
For SEO purposes, the front page's HTML is sent by the server along with the single JS/CSS file.
I think the Right Thing (tm) is to make build your single page application in a way where it consumes RESTful API which is public quality. In other words, think about it as if you are publishing your API to the world and when making changes make them backwards compatible. I think this is not as hard as it might think and will leave you with a cleaner system. Certainly better than building a complex versioning and live patching scheme!
If you are deploying to a tomcat server, you can simply overwrite the .js and .css files in the correct "deployed" location....
copy files to /your/deployed/app/location/webapp/js, etc this is a quick and easy way to "hot deploy" a new JS / CSS w/o taking the server down..... however if you have backend support that also needs to be updated, that may require a restart of the tomcat service. in which case something like Jenkins might help. http://www.tomcatexpert.com/blog/2012/03/21/integrating-jenkins-and-apache-tomcat-continuous-deployment

Dojo load time extremely slow on iis

I am currently working on a project that is using Dojo as the js framework. Its a rather rich ui and as such is using (and thus loading) a lot of different .js files for the dojo plug-ins
When run on an apache server running on a mac, the files (all around 1k) are served very quickly (1 or 2 ms) and the page loads pretty fast (<5 seconds)
When run on IIS on Win 7, the files are served at an unbelievably slow rate (150ms - 1s), thus causing the page to take up to 3 minutes to load.
I have searched the internet to try to find a solution and have come up empty.
Anyone have any ideas?
Why not let Google serve the Dojo files for you?
The AJAX Libraries API is a content
distribution network and loading
architecture for the most popular,
open source JavaScript libraries. By
using the google.load() method, your
application has high speed, globally
available access to a growing list of
the most popular, open source
JavaScript libraries.
What you need to do is build an optimized version of your code. That way you will have far fewer hits to your server (but I guess they'll still be slow, until you discover the iis problem) Dojo runs out of the box as individual files which is great for development, but without running the build scripts to concatenate all these files together, the experience is poor. The CDN does build profiles for dojo base and certain profiles, like dijit.dijit. Doing a dojo.require on these profiles in addition to the individual requires would enable this after running a build. You would need to do create layers for your code as well. The build scripts can also concatenate css and inline template files, remove comments and whitespace, etc.
Have you actually tried measuring the load times on the intended target production server?
If you're just testing this on local development environments (or in development/test VM's) then I think you're comparing apples with oranges (pardon the pun :) ).

Resources