Giter Site home page Giter Site logo

Comments (21)

renaudpawlak avatar renaudpawlak commented on May 18, 2024 2

I will give it a first try today (I have just finished something and I have a free slot)... we will see how it goes... maybe it will go very smoothly. I'll keep in touch.

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024 2

Ok! I have good news. I managed to create an Angular 2 quickstart with JSweet. That's cool :)
Since translating the Angular definitions automatically seemed to pose many problems, and because of the short deadline to have something working, I have decided to create the Angular 2 definitions in the project itself. Eventually these definitions (def.angular package) will be bundled in a candy, but right now, you will need to extend them for your own needs.

So, I have a first support of decorators, only for types. It follows this proposal. It will be extended to variables, functions, and parameter decorators, but the most important for Angular 2 is done.

One really cool thing about this project is that JSweet just converts to TypeScript and tsc takes care of the TS to JS conversion (there is a new option jsOnly, which allows JSweet to let an external tsc conf to take care of the JavaScript generation). This is a first but I think it could become a more common use case as TS declarations get more and more easily available.

All the details on how to use in the project: https://github.com/cincheo/jsweet-angular2-quickstart

Please tell me if this is a good start for you or if something is missing or unclear.

I hope you will enjoy it as much as I enjoyed making Angular 2 work with JSweet ;)

from jsweet.

kiamesdavies avatar kiamesdavies commented on May 18, 2024 1

Please, any progress with decorators? I really want to get started with Angular 2 and beloved JSweet

from jsweet.

kito99 avatar kito99 commented on May 18, 2024 1

@renaudpawlak, I'm doing a JavaOne presentation on JSweet and I was hoping to use it with Angular2. What's the status of this? Are there any other barriers to Angular2 support?

from jsweet.

kito99 avatar kito99 commented on May 18, 2024 1

@renaudpawlak, I just got it working locally. I had to add the repositories to pom.xml:

  <repositories>
    <repository>
      <id>jsweet-central</id>
      <name>libs-release</name>
      <url>http://repository.jsweet.org/artifactory/libs-release-local</url>
    </repository>
    <repository>
      <snapshots />
      <id>jsweet-snapshots</id>
      <name>libs-snapshot</name>
      <url>http://repository.jsweet.org/artifactory/libs-snapshot-local</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>jsweet-plugins-release</id>
      <name>plugins-release</name>
      <url>http://repository.jsweet.org/artifactory/plugins-release-local</url>
    </pluginRepository>
    <pluginRepository>
      <snapshots />
      <id>jsweet-plugins-snapshots</id>
      <name>plugins-snapshot</name>
      <url>http://repository.jsweet.org/artifactory/plugins-snapshot-local</url>
    </pluginRepository>
  </pluginRepositories>

I also had to run mvn install before running mvn generate-sources.

So far, so good!

from jsweet.

lgrignon avatar lgrignon commented on May 18, 2024

Important point, for sure.
You did not mention that we may need to declare "ambient" decorators (from candies, or home made js libs). However, it seems trivial since we could only declare the @decorator public @interface ... without declaring the function. Still, there could be a problem if we decide to raise an error if the function related to the decorator does not exist. There, we could annotate @decorator with @ambient.

What do you think about (1) check that the decorator function exists (2) annotate with Ambient in candies and local declarations?

Thanks.

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

Well... there has been more demand on React, so I did it first. But I am really impatient to make Angular 2 to work! Now that React works, Angular 2 will probably be one of the next things to be done. I'll keep you updated.

from jsweet.

kiamesdavies avatar kiamesdavies commented on May 18, 2024

Wow, thanks for the prompt response. Will delay our project and focus on
the server side for now, anxiously waiting.

Good job.
On Apr 21, 2016 5:45 PM, "Renaud Pawlak" [email protected] wrote:

Well... there has been more demand on React, so I did it first. But I am
really impatient to make Angular 2 to work! Now that React works, Angular 2
will probably be one of the next things to be done. I'll keep you updated.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#43 (comment)

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

Hi. Excellent initiative! Well, AFAIK, this is the only barrier (but I cannot be sure until annotations are supported). Actually, all boils down to the core barrier: having more time ;)
I could give it a try (but I cannot promise it will work perfectly). When would be your final date to have it working?

from jsweet.

kito99 avatar kito99 commented on May 18, 2024

Thanks for the quick response, @renaudpawlak.

Well, my presentation is in exactly two weeks, so ASAP :-). Here is a link: https://oracle.rainfocus.com/scripts/catalog/oow16.jsp?event=javaone&search=jsweet&search.event=javaone.

I realize that's a very short time frame, so it may be better to shoot for December. I'm giving the same presentation again (although probably to a much smaller audience): https://live360events.com/Events/Orlando-2016/Sessions/Tuesday/ADT06-Full-Stack-Java-with-JSweet-Angular-2-PrimeNG-and-JAXRS.aspx.

If Angular2 support isn't possible with JSweet, I'll probably change the JavaOne session to just use TypeScript on the front-end.

from jsweet.

kito99 avatar kito99 commented on May 18, 2024

Wow! Thanks so much, @renaudpawlak! So far it looks great, but I'll take a deeper look at it tomorrow!

After we get through the Angular stuff, we can talk about PolymerTS ;-).

from jsweet.

lgrignon avatar lgrignon commented on May 18, 2024

Haha, actually we already got this one running ;) take a look at:
https://github.com/lgrignon/jsweet-cordova-polymer-example

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

@kito99 do you need anything else for your presentation? Don't hesitate to tell me if anything is unclear or if you hit any issue.

from jsweet.

kito99 avatar kito99 commented on May 18, 2024

Thanks for pointing that out, @lgrignon. I'll have to take a closer look when I get a chance. I'm using PolymerTS on currently, so I'd love to see the same support for annotations/decorators ;-).

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

Grrr. I always forget the repos. Thank you for reporting. I have just pushed them.
I don't see why you'd have to run mvn install first... I'll have to start fresh when possible to understand, I guess.

from jsweet.

kito99 avatar kito99 commented on May 18, 2024

@renaudpawlak, how hard would it be to create a candy for PrimeNG (https://github.com/primefaces/primeng)?

from jsweet.

kito99 avatar kito99 commented on May 18, 2024

I'll start leaving issues/questions in the angular2-starter project. I've already found a few things.

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

I have just created a quickstart project to show how to create candies from an existing JS lib: https://github.com/cincheo/jsweet-candy-js-quickstart

As you can see, it is pretty straightforward, and I don't see any limitations to the approach (can be used to write a primeng candy)... but I still need to document better how to write definitions with JSweet.

@kito99 please do ask your questions. Maybe you want to share an example project and maybe we could build a first angular 2 candy for the occasion. Don't hesitate to use my private email when it gets too much into the details.

from jsweet.

mindhivefi avatar mindhivefi commented on May 18, 2024

Is there something changed with decorator support or am I doing something wrong? The transpiler makes the references to annotations right but it does not compile the actual annotation ts-classes at all. With the latest transpiler I qet error like:
...ERROR output:48 - cannot find module './TestAnnotation' at ...`

from jsweet.

renaudpawlak avatar renaudpawlak commented on May 18, 2024

Current snapshot (2.0.0-SNAPSHOT) supports class, method, and field decorators. See the related test to see what is supported exactly. If it does not work as in the test, it might be a configuration issue (or an edge-case bug).

from jsweet.

mindhivefi avatar mindhivefi commented on May 18, 2024

Okey. Your example helped me forward. Thanks!

It seems that the decorator can not be defined on separate file. If I add all decorations to same java file where the Globals are defined it works. I don't know yet very well how JSweet works from inside, but I can guess there is a natural explanation why it works like this.

from jsweet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.