Repackage Firefox SDK extensions - javascript

First af all, I'm newbie in Firefox SDK, so any small hint can be a great help for me. To modify a FF SDK extension, I unziped the .xpi file and changed one line of a js file and then ziped it again(as .xpi).But it does't work any more.Actually I followed the instruction explained here except there were no jar file in the directory structure of this addon, so I changed .js files directly. The directory structure of the package is as bellow:
/data
/doc
/lib
/node_modules
bootstrap.js
index.js
install.rdf
package.json
Even I tried to unzip and then zip the file again without doing any modification, but It didn't helped to see if it works or not, but it didn't work again. Is there any trick I miss? How should I repackage it?

I found the answer to my question. The directory structure were the same, but as the code is using add-on SDK, xpi should be produced by jpm. So I modified desired js codes and then I used jpm to produce xpi and it works well now.;)

Related

How to decode JavaScript files chunk.js? [duplicate]

Is there any way to convert webpack bundled js file into source code ts?
I have bundle.js file with me bundled with webpack. Unfortunately the source code files are deleted by a stupid accident. I want to reverse engineer my bundle.js file to get back my source code typescript files. Is there any possible way to achieve this?
Do you still have your source map files by any chance (e.g. main.bundle.js.map )? If so, you can run your app (ng serve), open the Chrome Dev Tools in your browser and you'll see your sources in TypeScript under the tab Sources -> webpack://
You may try using debundle node module.
Debundle

WebStorm Error: Please specify path to JavaScript file correctly

I am using WebStorm on Windows to work on node.js projects.
Recently, when I open one of my projects that are located on the OneDrive directory I got the 'Error: Please specify path to JavaScript file correctly' when I run a .JS file. However if I move the same project folder to an other directory (Desktop for example) it works correctly.
PS: Nodemon keeps restarting forever when running on the onedrive project.
How can I fix it?
Please see https://youtrack.jetbrains.com/issue/IDEABKL-7619#comment=27-2504574 for possible workaround.
And, if possible, use some VCS for sharing instead of OneDrive, see https://intellij-support.jetbrains.com/hc/articles/206544839.

Phantom.js doesn't run from the OSX console

I'm developing an ExtJS app and I'd like to render the view as pdf using Phantom.js. I've downloaded binary package for OSX, after unpacking added a symlink to it as well as added it to the PATH. After running 'phantomjs' in the console I get :
phantomjs script.js
And that's all. When I try running any of the example scripts it crashes saying that require is undefined, I can't check the version and basically it's unusable. I can run the bat file though, and it gives me phantomjs shell. After removing all I've downloaded previously I can still run 'phantomjs' command with the same outcome. Probably because Sencha's SDK have it but it's not visible in the PATH so I'm not sure. Any ideas ?
as always found the problem seconds after submitting question. Sencha's SDK had some custom or broken version of phantomjs.bat, and the whole folder was added to the PATH.

Installing Firefox plugins issue

I am trying to install my own firefox plugin. I follow this tutorial. But each time this gives me following error:-
Firefox could not install the file at
file:///home/ubuntu/googbar.xpi
because: Install script not found
-204
That error means that your file doesn't have an install.rdf file. Please note that it needs to be at the top level of the XPI archive. So maybe you made a mistake packing the file and install.rdf landed in a subdirectory. You can check the list of files using unzip -l googbar.xpi command, it should list install.rdf without a directory name before it.

Jsmin on folder with subfolders

I am running jsmin to compress all the javascript files of my ASP.Net web application as a postbuild event in the csproj file like this:
"JsMin.exe"
"$(ProjectDir)script"
"$(ProjectDir)script\minified.js"
This was working fine when I kept all js files in the root of the script folder. But as it was starting to become alot of files in this folder, I decided to divide the files into subfolders. Now it seems that jsmin only fetches the js files in the root folder, and I cannot see that it has any option to include files in sub-folders. Does anyone have a good solution for a situation like this? Would seem to me that it should be a pretty common thing to do, so that is why I was a bit surprised it was not a parameter to jsmin.exe enabling sub-folders.
You should be able to use DOS' for command to do that:
for /R "$(ProjectDir)scripts/debug" %s in (*.js) do JsMin.exe %s > "$(ProjectDir)scripts/release/%~ns.min.js"
That assumes the scripts are in (or in directories within) a directory named ~/scripts/debug and minifies them to ~/scripts/release with the .js replaced by .min.js.
I've tested that in CMD, but not as a build event in VS. So, you may need to tweak the syntax slightly.
A little late to the party, but below is the code to make Dave Ward's suggestion of recursively minifying javascript files.
Here is the code ported to work using a Visual Studio build event:
for /r "$(ProjectDir)scripts" %%s in (*.js) do $(SolutionDir)tools\jsmin.exe < %%s > "$(ProjectDir)debug\%%~ns.min.js"
type "$(ProjectDir)debug\*.min.js" | "$(SolutionDir)tools\jsmin.exe" > "$(ProjectDir)release\local.min.js"
del "$(ProjectDir)debug\*.min.js"
The above code recurses the scripts folder (the root and sub-directories) for all scripts and places them in a debug folder (this can be any other folder in your directory as long as you have read/write perms set on it and it's not apart of the directory structure you are recursing. It then minifyies all the *.min.js in the debug directory and cleans them up afterwards. I scoured the net trying to find this solution and couldn't so I hope this helps someone in need :)

Categories