I am using polymer core and paper components to build my app, working great! But when I want to deploy my app to production I don't have a clear way of knowing what all common polymer dependencies I have to package with my app and shared those common elements across multiple apps.
For example:
To use https://github.com/Polymer/paper-button, I include a link to ../paper-button/paper-button.html which might have other dependencies. I used vulcanize but it seems to inline all components which is not an ideal (in terms of size) way to share via a CDN.
Any suggestions on how to deal with this?
I suggest using Bower, or another dependency management framework. Using bower, you can declare what the dependencies of your app are:
{
"dependencies": {
"polymer": "Polymer/polymer#master",
"paper-button": "Polymer/paper-button#master"
}
}
and then use bower install to add those dependencies to your application. The benefit there is that bower will then install the dependencies of your dependencies, and their dependencies, and so on.
With bower you could run bower list and it will list the dependency hierarchy.
If you don't want to use bower, or have trouble setting it up, the Polymer Elements Catalog does a pretty good job of providing an archive of the components you want with all the appropriate dependencies.
Related
We have main big application and are going to create separate small applications (microservices) using different libraries (Angular, React etc.) and compile them into webcomponent to use them anywhere. The main application has some libraries (example underscore.js), some of our components use the same libraries (example lodash.js), in this scenario we see a lot of conflicts when using webcomponents inside main application. Do you have any ideas on how can we isolate webcomponent libraries and they can work in isolated mode. Also we have used ShadowDOM, but no luck.
There's no such isolated mode shipped with the Web Components technologies. All imported libraries will share the same namespace.
Shadow DOM is not about Javascript code isolation but only deals with DOM et CSS isolations.
If you want to resolve conflicts with imported 3rd-party libraries you could either:
Design your website to import 3rd-party import only once, in a global dependency script.
Use a module loader that will manage library loading for you, for example require.js, or the built-in feature ES6 module import feature, or even your own Vanilla module loader.
Isolate the different parts of you site with <iframe>elements (if possible, but you may loose some interaction features).
All these solutations have advantages and drawbacks. It depends on your needs.
I started to use web components from bower recently in my applications. I am trying to tweak a small logic in a particular web component. I want to know is there a way we can change the js logic specific to a component in my local js file instead of forking a repository and try to do it.
Thanks in advance.
For quick hacks you can go to bower_components and experiment. For persistent changes you will need a fork.
Of course you could try monkey-patching by replacing methods/functions but it's ugly and brittle in case the dependency library changes.
While working on a number of Aurelia applications we reached the point that we need to share code between these applications.
The code to be shared is not something we (actually our customer) would like to be open sourced. So we were thinking of creating private jspm packages so we can easily reuse our modules when needed. This idea is inspired on this blogpost
Jspm does support linking packages as well so that is something we would really like to use during development, as the code to be reused is not yet stable enough.
Workflow with linked jspm packages
So our intended workflow is to create different number of projects/modules with ES2016 code and create jspm packages from these projects. These packages will then be installed and linked in our applications.
Transpiling
As far as we know jspm packages need to be transpiled before you install it into your project. So we always need to transpile code if there is any change.
According to this systemjs/babel-plugin documentation there will be support for on the fly transpiling in version 0.17 (which is in beta at this point). Currently we're using jspm version 0.16.32 which does not support on the fly transpiling with babel 6.
Somehow this workflow feels over-engineered, so we consider on the fly transpiling in our applications, though we fear a performance penalty.
How would you approach sharing es2016 code between different Aurelia applications?
Is there anyway to achieve code reuse without using jspm packages?
I personally would publish the packages to an internal npm feed of some sort. Set up the internal feed to mirror the public npm feed, then set your .npmrc to point to the private feed. Then just
jspm install npm:my-private-package
I have elements built with Polymer which needs to run on multiple sites (a widget) which:
Don't have Polymer included (fine, I can include)
Polymer already included at a compatible version (brilliant, unlikely)
Polymer at an unknown version (too old or too new, tricky)
Is it possible to load Polymer in a namespace? e.g. myObj.Polymer or MyPolymerName
I have found polymer-js which will let me load Polymer as a module, but this isn't an official way. This still exports to the global scope
The solution for now is to rely on package management to resolve Polymer to a single compatible version for a project and its dependencies, and HTML Imports to de-duplicate loading of dependencies from multiple sources.
If you vend your elements as Bower packages, then a site can include them, with their dependencies and imports of Polymer, and if a compatible version of Polymer is available, use that one version across the whole project.
In the future version of Polymer, after ES6 modules and loaders are fully spec'ed, we will probably have a version of Polymer that's only exported via modules so that multiple versions can be scoped to their explicit imports and can safely coexist on a page.
I am performing Android app reverse engineering (decompilation and further analysis). I wish to analyse the package dependencies between different packages inside the same apk file. Is there any tool which does this? Else, how can I deduce package dependency in apk files?
I wish to analyse the package dependencies between different packages inside the same apk file. Please let me know if there is any tool which does this
A tool called Dexter is available to find out all the packages present in an apk. Also, if there is a program dependency among any 2 packages, Dexter show it with an edge. It could be noted that the edges do not have any weight to indicate the strength of the dependency.
The only dependencies that I have run into with apk files are with the framework from the device. If you are dealing with a standard app available from the Play, then it generally contains everything that it needs inside its own package.
Some of the custom builds like Amazon Kindle Fire, Barns & Noble Nook, etc have built custom launchers and other services which then offer other functions through their frameworks.
The framework-res.apk is typically stored in the /system/framework location. You can extract that from your device and place it in your apktool folder of your %userprofile%/~. Apktool (I am assuming that is one of the tools you are using) will then reference it when it does the work.