Running Ceylon JS app

64 views
Skip to first unread message

Lucono

unread,
Nov 3, 2016, 1:07:13 AM11/3/16
to ceylon-users
After setting up a Ceylon JS project with a basic JS module and compiling, it produces the JS output module under the /modules directory of the project root.

However, the compiled .js file produced of the module has a line that "requires" the ceylon.language package:

require('ceylon/language/1.3.0/ceylon.language-1.3.0');

However, the ceylon.language JS module was not downloaded or installed under the /modules folder of the project root.

Is there a way as part of compiling a Ceylon JS module, to have the ceylon.language (or other Ceylon JS modules) be properly downloaded and situated under the project root's /modules folder, so that everything is ready to be run in node?

Thanks.


Stephane Epardaud

unread,
Nov 3, 2016, 4:53:51 AM11/3/16
to ceylon...@googlegroups.com
You can use `ceylon copy --output for-node --with-dependencies --include-language my.module/1` to create a folder with all your deps so that Require.js will find them all in `for-node`.

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/840c972c-7442-455e-b26a-8375c014e893%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Gavin King

unread,
Nov 3, 2016, 7:52:01 AM11/3/16
to ceylon...@googlegroups.com
This is something that is now discussed in the tour:

https://ceylon-lang.org/documentation/1.3/tour/modules/#resolving_dependencies_at_runtime

On Thu, Nov 3, 2016 at 9:53 AM, Stephane Epardaud
<stephane...@gmail.com> wrote:
> You can use `ceylon copy --output for-node --with-dependencies
> --include-language my.module/1` to create a folder with all your deps so
> that Require.js will find them all in `for-node`.
>
> On 3 November 2016 at 06:07, Lucono <lucon...@gmail.com> wrote:
>>
>> After setting up a Ceylon JS project with a basic JS module and compiling,
>> it produces the JS output module under the /modules directory of the project
>> root.
>>
>> However, the compiled .js file produced of the module has a line that
>> "requires" the ceylon.language package:
>>
>> require('ceylon/language/1.3.0/ceylon.language-1.3.0');
>>
>> However, the ceylon.language JS module was not downloaded or installed
>> under the /modules folder of the project root.
>>
>> Is there a way as part of compiling a Ceylon JS module, to have the
>> ceylon.language (or other Ceylon JS modules) be properly downloaded and
>> situated under the project root's /modules folder, so that everything is
>> ready to be run in node?
>>
>> Thanks.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ceylon-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ceylon-users...@googlegroups.com.
>> To post to this group, send email to ceylon...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/ceylon-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ceylon-users/840c972c-7442-455e-b26a-8375c014e893%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Stéphane Épardaud
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/CAKU9E9suHOmApn%3DXtk3%2Bi-F%3DgNMW61NL-9an%2B%2Bupk_vR_%2BUpyQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Lucono

unread,
Nov 3, 2016, 9:42:09 PM11/3/16
to ceylon-users
Thanks Steph, Gavin.

Different but related question - is there any setup that allows JS ceylon modules in Ceylon Herd to be resolved at runtime right off of Herd? (I guess Ceylon Herd would have to be able to present itself as an npm repository for JS modules available there).

Stephane Epardaud

unread,
Nov 4, 2016, 6:25:32 AM11/4/16
to ceylon...@googlegroups.com
If your modules are all on Herd then you only need to point node.js to its URL and it will work. Herd serves files as if they were from your local module folder.

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Enrique Zamudio

unread,
Nov 4, 2016, 1:21:49 PM11/4/16
to ceylon-users
Since you can only specify local paths in the NODE_PATH environment variable, you need to download any remote modules. If you have run your module with the run-js command then remote modules have already been downloaded to your local repo/cache, so you can point to that (it's under .ceylon/repo in your home dir).
Reply all
Reply to author
Forward
0 new messages