cincheo/jsweet-examples

Example with polymer .

Opened this issue · 12 comments

Could you create a polymer example ?

Hello, it should be fairly simple. Candies are available. I contributed to those on DefTyped. We will miss the "iron & paper" components candies though because of the missing definitions. We should use @ambient or @interface here to strongly type polymer components.
Would you be interested in creating this example?

First i will try the "@ambient https://github.com/Ambient or @interface
https://github.com/Interface" approach instead of a pure java approach .

But this is the fitting occasion for me to learn more from Jsweet .

I will see .

regards .

On 23 March 2016 at 22:14, Louis Grignon notifications@github.com wrote:

Hello, it should be fairly simple. Candies are available. I contributed to
those on DefTyped. We will miss the "iron & paper" components candies
though because of the missing definitions. We should use @ambient
https://github.com/Ambient or @interface https://github.com/Interface
here to strongly type polymer components.
Would you be interested in creating this example?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#14 (comment)

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11

ponthiaux.eric@gmail.com

Hi guys,
I have just fixed the polymer-ts candy. So if you want to create a polymer example with that candy, you are most welcome to do so :)

Nice, thanks, I will give a try soon.

Great news!

I finally got time to publish a polymer example. It works like a charm!
https://github.com/lgrignon/jsweet-cordova-polymer-example

I followed the following tutorial so readers could have a reference documentation:
http://code.tutsplus.com/tutorials/how-to-create-a-to-do-list-app-with-polymer-and-cordova--cms-25434

Hi guys ,

I suspect a problem in the deployment of the most recent version of "
jsweet -core " in your repository .

Trying to build the maven plugin gives me :

*$ mvn clean install [INFO] Scanning for projects... [INFO] [INFO]

[INFO] Building JSweet maven plugin 1.1.1 [INFO]

Downloading:
http://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom
http://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom
Downloading:
http://repository.jsweet.org/artifactory/ext-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom
http://repository.jsweet.org/artifactory/ext-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom

[INFO]

[INFO] BUILD FAILURE [INFO]

[INFO] Total time: 1.022s [INFO] Finished at: Fri Jul 01 13:18:16 CEST 2016

[INFO] Final Memory: 20M/981M [INFO]

[ERROR] Failed to execute goal on project jsweet-maven-plugin: Could not
resolve dependencies for project
org.jsweet:jsweet-maven-plugin:maven-plugin:1.1.1: Failed to collect
dependencies at org.jsweet:jsweet-transpiler:jar:1.1.1 ->
org.jsweet.candies:es6-promise:jar:0.0.0-SNAPSHOT ->
org.jsweet.candies:jsweet-core:jar:1.2.0-SNAPSHOT: Failed to read artifact
descriptor for org.jsweet.candies:jsweet-core:jar:1.2.0-SNAPSHOT: Could not
transfer artifact
org.jsweet.candies:jsweet-core:pom:1.2.0-20160630.220652-24 from/to
jsweet-release (http://repository.jsweet.org/artifactory/libs-release-local
http://repository.jsweet.org/artifactory/libs-release-local): Failed to
transfer file:
http://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom
http://repository.jsweet.org/artifactory/libs-release-local/org/jsweet/candies/jsweet-core/1.2.0-SNAPSHOT/jsweet-core-1.2.0-20160630.220652-24.pom.
Return code is: 409 , ReasonPhrase:Conflict. -> [Help 1] [ERROR] [ERROR] To
see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [ERROR] For more information about the errors and possible
solutions, please read the following articles: [ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException*

Regards .

On 20 May 2016 at 17:30, Louis Grignon notifications@github.com wrote:

Great news!

I finally got time to publish a polymer example. It works like a charm!
https://github.com/lgrignon/jsweet-cordova-polymer-example

I followed the following tutorial so readers could have a reference
documentation:

http://code.tutsplus.com/tutorials/how-to-create-a-to-do-list-app-with-polymer-and-cordova--cms-25434


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#14 (comment)

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11

ponthiaux.eric@gmail.com

Hello. I am just looking at it, I get back to you asap.

Could you please try again? It should be better.

Look perfect now .

Thanks .

On 1 July 2016 at 15:28, Louis Grignon notifications@github.com wrote:

Could you please try again? It should be better.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAqUAZ9UB1CgXFTCjjJMG1hcWuWOHRoTks5qRRYMgaJpZM4H3bVu
.

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11

ponthiaux.eric@gmail.com

Good evening,

Where can I find an example on how to build a candy ?

I found some lines that talk about it in the jsweet documentation , but
this is not enough to make a concrete example.

Regards .

Eric.

On 1 July 2016 at 17:03, ponthiaux eric ponthiaux.eric@gmail.com wrote:

Look perfect now .

Thanks .

On 1 July 2016 at 15:28, Louis Grignon notifications@github.com wrote:

Could you please try again? It should be better.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAqUAZ9UB1CgXFTCjjJMG1hcWuWOHRoTks5qRRYMgaJpZM4H3bVu
.

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11 <%28%2B33%29%2006%2014%2067%2013%2011>

ponthiaux.eric@gmail.com

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11

ponthiaux.eric@gmail.com

Hi Eric,

It all depends from what you want to build a candy. If you want to build a candy from a JSweet program, then you can use the following build section in your Maven pom.xml.

Key points:

  • put the generated JavaScript code in the jar so that it can be automatically extracted by JSweet in the client project
  • generate the TypeScript defs (declaration option)
  • put the generated TypeScript defs in the jar (mandatory because JSweet delegates to tsc)
  • the plugin management part is just to avoid errors under Eclipse (so you can get rid of it if you are not using Eclipse)
    <build>

        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <fork>true</fork>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jsweet</groupId>
                <artifactId>jsweet-maven-plugin</artifactId>
                <version>1.2.0-SNAPSHOT</version>
                <configuration>
                    <bundle>true</bundle>
                    <outDir>src/main/resources/META-INF/resources/webjars/${project.name}/${project.version}</outDir>
                    <tsOut>.jsweet/ts</tsOut>
                    <targetVersion>ES5</targetVersion>
                    <verbose>true</verbose>
                    <declaration>true</declaration>
                    <dtsOut>src/main/resources/src/typings</dtsOut>
                    <encoding>UTF-8</encoding>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-js</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>jsweet</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/resources/src/typings</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                        <fileset>
                            <directory>src/main/resources/META-INF/resources/webjars</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.jsweet</groupId>
                                        <artifactId>jsweet-maven-plugin</artifactId>
                                        <versionRange>
                                            [1.0.0-RC1,)
                                        </versionRange>
                                        <goals>
                                            <goal>jsweet</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

You also need a src/main/resources/META-INF/candy-metadata.json containing:

{
    "transpilerVersion": "1.1.1"
}

Then just mvn deploy/install.

And of course use is as a regular Maven artifact in your client project.

Tell me if anything is unclear.

Good evening Renaud .

Finally i've done a bit of reverse engineering on an original candy jar and
then found how to properly do it .

Thanks a lot for the answer .

Regards.

Eric.

On 2 July 2016 at 21:00, Renaud Pawlak notifications@github.com wrote:

Hi Eric,

It all depends from what you want to build a candy. If you want to build a
candy from a JSweet program, then you can use the following build section
in your Maven pom.xml.

Key points:

  • put the generated JavaScript code in the jar so that it can be
    automatically extracted by JSweet in the client project

  • generate the TypeScript defs (declaration option)

  • put the generated TypeScript defs in the jar (mandatory because
    JSweet delegates to tsc)

  • the plugin management part is just to avoid errors under Eclipse (so
    you can get rid of it if you are not using Eclipse)

    <sourceDirectory>src/main/java</sourceDirectory>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <fork>true</fork>
            </configuration>
        </plugin>
    
        <plugin>
            <groupId>org.jsweet</groupId>
            <artifactId>jsweet-maven-plugin</artifactId>
            <version>1.2.0-SNAPSHOT</version>
            <configuration>
                <bundle>true</bundle>
                <outDir>src/main/resources/META-INF/resources/webjars/${project.name}/${project.version}</outDir>
                <tsOut>.jsweet/ts</tsOut>
                <targetVersion>ES5</targetVersion>
                <verbose>true</verbose>
                <declaration>true</declaration>
                <dtsOut>src/main/resources/src/typings</dtsOut>
                <encoding>UTF-8</encoding>
            </configuration>
            <executions>
                <execution>
                    <id>generate-js</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>jsweet</goal>
                    </goals>
                </execution>
                <execution>
                    <id>clean</id>
                    <phase>clean</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>src/main/resources/src/typings</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                    </fileset>
                    <fileset>
                        <directory>src/main/resources/META-INF/resources/webjars</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings                     only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.jsweet</groupId>
                                    <artifactId>jsweet-maven-plugin</artifactId>
                                    <versionRange>
                                        [1.0.0-RC1,)
                                    </versionRange>
                                    <goals>
                                        <goal>jsweet</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    

You also need a src/main/resources/META-INF/candy-metadata.json
containing:

{
"transpilerVersion": "1.1.1"
}

Then just mvn deploy/install.

And of course use is as a regular Maven artifact in your client project.

Tell me if anything is unclear.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAqUAXXGhOsObCijDVszcsBxB8MZ5C5Dks5qRrU2gaJpZM4H3bVu
.

Eric Ponthiaux *
*Développeur Senior , Consultant .

(+33) 06 14 67 13 11

ponthiaux.eric@gmail.com