How to bundle a js plugin without global namespace clashes - plugins

I'm in the process of building a javascript plugin that people will be able to install by simply pasting a script tag into their HTML. At times I may wish to include a third-party library in my plugin, but I want to make sure that my plugin will still work if used on a web site that relies on a different version of this same library. Is there a tool I can use to somehow modify the namespace of my required dependencies so that they don't interfere with any other existing scripts or libraries? I have been researching browserify but it's not immediately clear to me from the docs that it can be used to avoid this problem.

Related

How to create a babel plugin for internal use

How do we use a babel plugin that is not already accepted in a babel repository? I had trouble finding this answer reading through the babel plugin documentation.
We are interested in writing a babel plugin for for...in loops to address a bug in ios9 (ios9 Safari miscalculating sum). Although we would be happy to contribute it to the babel community, I was also wondering if it doesn't get accepted or isn't ready for general consumption, how to start using and testing it locally.
It's possible to make use of custom babel plugins that you can host on git.
You can refer to https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md for learning how you can develop and test your babel plugin locally.
Once you have developed the plugin, you can add a dependency for it in your project's package.json file.
Note that if you plan to make the plugin repository private, you'd have to create a personal access token (for Github) to allow npm to fetch repository contents. In that case, the example entry in your package.json file would be as follows:
"babel-plugin-transform-for-of-loop": "git+https://{token}:x-oauth-basic#github.com/username/babel-plugin-transform-for-of-loop"
Whatever package name that you pick for your plugin, you will need to add a reference for it in the .babelrc file. For this example, it would be as follows:
{
...
"plugins": [
"babel-plugin-transform-for-of-loop"
]
}
With that done, you should simply run npm install and your plugin would become active for your project.

How to extend angular-cli via a custom plugin

I want to extend angular-cli via a custom plugin. I want to write this plugin by myself. How can i do this? If i write an ember-cli plugin, can i use this one in angular-cli? I read that not all ember-cli plugins are working in angular-cli. I would like to have an example, or some information about the architecture of angular-cli.

Project on Google go, imports of libraries

everyone.
I am new to Go language and currently I am trying to understand the basics of building Go applications. I met the following problem.
For example, I am using other libraries in my project. I have them locally, on my computer, so my project works fine.
I am loading my code on github and another programmer download it. As I understand, my code won't work, because this programmer doesn't have the libraries I used.
So the question is: What is the best way to share my project with all libraries it has? Should I upload these libraries in the separate repositories? Then to use my project, people need to look inside the code to detect which libraries I am using to download them one by one?
For example, in Java there is such thing like Maven or Ant, which downloads all required dependencies. Is there any tools like this for Go?
Let's call the main file of my project main.go
And I am using my own library: mathutil.go
what is the best way to make this project run on other computers?
Go's dependencies work very much like using Maven or IVY transitive dependencies. When someone does "go get" of your package, anything you depend on will automatically download.
For example, in your source:
import "github.com/foo/bar"
go will automatically download that to your $GOPATH/src/github.com/foo/bar along with your code.
Assuming the third party libs you use are hosted in a public repo (ie: github) then people don't need to do anything.
If the libraries you used are not available on a public repo, you will need to post them somewhere assuming their licensing allows.
Take a look at golang.org/doc/code.html for more details

Requiring another package from your package in Package Control?

I'm developing a plugin for SublimeText that uses the FullScreenStatus plugin. Is there a way to set it up so that if someone installs my plugin, the FullScreenStatus plugin will be automatically installed as well, like a requires directive? Every other package manager I know of can do this, but I couldn't find anything in the docs and no other package I looked at is trying to require another package.
Since FullScreenStatus is MIT licensed, I could just include it in mine, but is there a way to require it without doing that?
You either have to bundle it yourself, or explain in the install message and README there is an external dependency. If you feel like adding to the discussion on dependency management, feel free to contribute to https://github.com/wbond/sublime_package_control/issues/166. Some initial work can be seen at https://github.com/wbond/sublime_package_control/issues/291#issuecomment-14028788.

Integrate GWT with maven-spring without the Google Plugin for Eclipse

I am facing this weird requirement where I am supposed to create a web page using GWT widgets in an existing spring-maven web project but the corp security doesn't allow me to install any Eclipse plugins. I have the latest SDK but thats about it.
Is there any way to achieve this?
The Google Plugin for Eclipse (GPE), just like so many other Eclipse plugins, is not mandatory; it's just an aid.
But first, if “the corp security doesn't allow me to install any plugin” only means you're not allowed to use the Eclipse marketplace or contact update sites, it's worth mentionning that you can download the update site as a ZIP to be used locally: https://developers.google.com/eclipse/docs/install-from-zip
If that isn't allowed either, then let's look at the features provided by the GPE and how you can possibly do the same without the plugin:
Wizard for creating new projects: you're in a Maven project, so you're not concerned.
Running and debugging: you can do the same with a Java Application launcher. Choose com.google.gwt.dev.DevMode as the Main Class, add the com.google.gwt:gwt-dev JAR to the classpath (you can also add it as a dependency with scope provided, and ignore the warning printed by the gwt-maven-plugin) if needed, add your source folders to the classpath and pass the appropriate arguments.
Wizards: let's be honest, they won't boost your productivity that much.
GWT Compilation: you can do the same with a Java Application launcher. Choose the com.google.gwt.dev.Compiler as the Main Class, add gwt-dev and your source folders to the classpath and pass the appropriate arguments.
Editors: you'll lose the formatting and highlighting of JSNI methods, as well as reference checking of your JSNI references, the auto-complete in UiBinder, and validation of UiBinder and ClientBundle references. All those will be done only when you GWT-compile your project.
RPC: you'll lose the validation of your RPC interfaces and quick-fix to keep your sync and async interfaces in sync. Validation will be done only when you GWT-compile your project.
JUnit: you can do the same with a JUnit launcher: just make sure you add gwt-dev and your source folders to the classpath, and pass the appropriate options as a gwt.args system property (see “Passing Arguments to the Test Infrastructure” in the docs).
Nothing insurmountable.