How to run aurelia-plugins/aurelia-plugins-google-places-autocomplete locally - aurelia

I have installed this aurelia plugin in my project: https://github.com/aurelia-plugins/aurelia-plugins-google-places-autocomplete which is basically an Aurelia wrapper for google places autocomplete.
Unfortunately I'm experience a "regeneratorRuntime is not defined" issue when using it (It has been reported in the repo). And the reason seems to be the way that async/await are transpiled. I have found a possible solution to fix the issue as seen here: Babel 6 regeneratorRuntime is not defined with async/await
I have cloned the repo and installed now I just need to be able to run it locally to test it out. Does someone know how I can run that repo locally. Thank you very much.

Usually what I do when I want to test a plugin is I will create test project where I run the plugin as a feature. Features work just like plugins except they are local to your project's structure. Instead of doing
aurelia.use
.plugin('aurelia-plugins-google-places-autocomplete', config => { \\...
You will do
aurelia.use
.feature('aurelia-plugins-google-places-autocomplete', config => { \\...
This is assuming you place the plugin in src\aurelia-plugins-google-places-autocomplete.
This is a story that I would like to see us come up with a pattern for. Maybe we'll add something to the skeleton-plugin project that will help with this.

Related

Installing dependencys with Gradle Kotlin DSL does not work

Hi everyone I am new to IntelliJ in general and especially to Gradle and I feel like a total noob. :D
Im not sure if this is a Kotlin DSL thing or if I just do it the wrong way and it wouldn't work in Groovey either.
After hours of trial and error and reading other SO posts I'm still not able to install a simple dependency... it can't be that hard...
Currently I am playing around with Jetpack Compose for Desktop even though it's still in alpha and it works but for the love of god I am not able to add a dependency.
So here is my Problem:
I try to install the dependency like they say I should in
https://developer.android.com/jetpack/compose/navigation#kts
and yes I know it's an android package so it may not compile or it may crash during runtime but shouldn't it at least find and download the dependency???
So... if I add
implementation("androidx.navigation:navigation-compose:2.4.0-alpha10")
to my build.gradle.kts
And try to compile it I get an exception during the build process:
What I tried so far:
I checked if the repository maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
who is configured in my build.gradle.kts repositories-section and in my settings.gradle.kts pluginManagement-section contains the package that I want.
The site https://mvnrepository.com/artifact/androidx.navigation/navigation-compose?repo=space-public-compose-dev tells me, that the repository contains the package that I need.
I checked the error log itself.
But I don't relly know what it tries to say.
I use Java SDK16, since I expect downward compatibility and the fact that the dependency is still in alpha I assume it should be compatible.
I use Kotlin 1.5....
that's it.
Thanks for reading all that :) I really appreciate your time... If I forgot some crucial information let me know and I will add it as soon as I can.
the problem which I feel is, is you are basically opening the wrong file. (I don't use jetpack compose so the answer might differ)
on the top left corner in the image, where there is project dropdown, open it and select android.
now there will be a different set of files in the Gradle folder, in fact, there will be 2 different files in that folder.
build.gradle (project: <project_name>)
build.gradle (Module: <project_name>.app)
open the second file and there will be dependencies copy + paste implementation code there.
the file which you have opened is actually the first file.
Well... here I am back again answering my own question.
After I switched to the terminal in IntelliJ Idea (which to be honest I could have thought of that prior to posting my question) there was highlighted text that gave me the necessary insight, why it wasn't working.
And after some searching the web in order to find out what an "aar" file is and why I didn't get a jar file like I expected it turns out that android has it's own little file format for android applications and that those cannot be used in regular java/kotlin projects.
I read somewhere, that 'aar' files contain a jar file and some other stuff and extracting the jar file from the aar file may be a way to get it working, but it didn't fix anything, maybe because the dependencies of the navigation package are aar files as well and therefor I'd need those packages as well and extract the jar file from those as well and it all seems like this isn't the right way...
So I guess I have to wait until Jetpack Compose for desktop somehow is able to use aar files or until the repositories deliver the packages in a regular jar file.

Executing a kotlin -script.kts with a dependency from github

I am aware that *.kts scripts can include a dependency like this:
#!/usr/bin/env kscript
#file:DependsOn("com.domain.project:name:1.0-SNAPSHOT")
I created a small library to process different text snippets and uploaded it on github.
Is it possible to use this library as a dependency within a kotlin script without going through mvnRepository or something similar?
something like this for example:
#!/usr/bin/env kscript
#file:DependsOn("com.github.username.project")
I was not able to find a method of requesting the dependency from the repository or the direct url of a jar file.
I was however able to use jitpack on top of my regular github repository. Unfortunately, pointing to the master branch did not work for me, but creating a release seem to work just fine.
The resulting boilerplate looks like this:
#!/usr/bin/env kscript
#file:MavenRepository("com.github.username:repo:1.0.0", "https://jitpack.io")
#file:DependsOn("com.github.username:repo:1.0.0")
import repo.MyLibrary
fun useLibrary(){
val library = MyLibrary()
library.use()
}
Where com.github.username is the personal github account, repo is the repository and 1.0.0 is the release version tag.

Make IntelliJ understand usage of Babel's moduleRoot

For our project we use EcmaScript 6 through Babel, Gulp and npm.
We have three projects: Base, Common and Game.
We're actively developing Common and Game so we have those checked out (and npm link from Game to Common), while we get the Base project through npm and don't change it often.
The import paths we use start with the project name such as import "Base/utils/svg" or import "Game/model/boardtile". The map according to the following on the file system:
Base → /intellij-project/base-project-src/node_modules/base/
Common → /intellij-project/base-project-src/js/
Game → /intellij-project/game-project-src/js/
The problem: IntelliJ does not understand this import scheme. We use the moduleRoot and moduleId options of Babel to identify our AMD modules that way during the gulp build process. When that is done we concatenate everything into one big file. That works, but IntelliJ does not know that we do this magic.
Is there a way to still make IntelliJ understand our imports? So that it will know that Base/utils/svg actually means /intellij-project/base-project-src/node_modules/base/? At the moment the IDE is mostly a glorified text editor, as refactorings obviously relies on the IDE understanding the imports.
Note: Unfortunately I can't change the import structure, as it's a decision I can't change. Nor can I switch to other tools instead of the above mentioned ones, such as WebPack.
I'm facing the same problem with this. I'm looking for a way to get rid of the annoying relative paths as you guys have done, but to get them to work with IntelliJ is another piece of work.
What can help is the symlink approach that can be found here.
https://gist.github.com/branneman/8048520
IntelliJ can work nicely with node_modules, so you could symlink a folder in your node_modules to point to the real thing. Then I suppose IntelliJ will be able to resolve your imports.

Play 2 dependency on a local module in Intellij Idea

I am kind of new to PlayFramework 2 and can not figure out how to resolve play 2 application dependencies. I need to add dependency on a local module loaded in IntellijIdea, not a jar file or repository.
While adding module dependencies in Idea project setting works just fine and ide itself is able to resolve them (autocompletion, imports etc are working), when trying to run in play2, its compiler cannot resolve any dependencies.
I manually configured Build.scala (adding val appDependencies = Seq("" % "" % "")) but am puzzled as to what resolvers I should use. I cannot point to a jar file, as it is a work in progress and such a file should be updated too often. Doing so would defeat the whole purpose of managed dependencies.
Play's main build mechanism uses SBT, which needs to know how to find all sources required for the build. There are several options for this:
make your module an SBT project itself and publish it to your local ivy repository. However that might be somewhat complex at this stage, and would involve adding your local ivy repository to the resolvers and re-publishing every time you change something in the module
declare your module as a sub-project. Play's documentation describes the process of working with sub-projects, I think this is the way you'd like to try out since then the idea command on Play's console will generate the IntelliJ configuration for the main application and the module.

How do I reference play framework third party modules without referencing an absolute path?

Here is my situation. I have a play app which uses the guice module. In order to work with the guice module:
I installed it using play install guice. This installs it in the $PLAY_HOME/modules which is fine by me. I don't want to edit the module files in any way whatsoever.
Then I declared the module in my dependencies.yml like so: - play -> guice 1.2
Within my app, I ran play dependencies, and this resoles the module just fine and creates a modules/guice-1.2 file that references the guice module.
The issue is that the content of that file is something like the following: /some-absolute-path/play-1.2.x/modules/guice-1.2.
That works fine when working locally for development. But when I want to move to a production server, with a different install of Play! (i.e. with a different absolute path to it) it will obviously fail.
So what's the best way to deal with this?
For now I've resorted to declaring the module in the application.conf file like this: module.guice=${play.path}/modules/guice-1.2.
Unfortunately the ${play.path} magic doesn't seem to work on those generated files.
By the way I use version 1.2.3 of Play!
you should try with ${application.path} in your dependencies.yml file, like in this example
require:
- play -> crud
- provided -> DateHelper 1.0
repositories:
- provided:
type: local
artifact: "${application.path}/jar/[module]-[revision].jar"
contains:
- provided -> *
see this question: How can I specify a local jar file as a dependency in Play! Framework 1.x
When you run in production you will either resync the dependencies (via play deps command) with the local installation of Play or in some scenarios you can precompile everything and then there will be no issues with the paths.
That second scenario is the one with Heroku, for example.
It's not answer to your question, but I have faced with same issue.
I don't want to call resync the dependencies on production.
I don't want to ask my team members, install special module.
I don't want to commit file containing absolute path with module location.
The only workaround that I find: do not install module in Play! application, just include jars which use this module manually. play-guice.jar should be included as #opensas suggested, aopalliance and com.google.inject as regular dependencies in dependencies.yml.
The funny thing, that resync dependencies is also deleting .svn files, so back-up its before calling this command.