Simple amberc example

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple amberc example

Sean P. DeNigris
Administrator
I read the help for amberc, but there are so many options I don't know where to start...

What would the invocation look like to turn a dead-simple single-ST-package app into a single JS app file? And how would that effect the standard index.html file?

I tried:

    amberc -n amber-livingcontract MainPackageCreatedByAmberInit.js PackageImportedFromPharo.js App

which created App.js, but when I replaced the:
     require([
          'amber/devel',
          'amber-livingcontract/MainPackageCreatedByAmberInit',
          'amber-livingcontract/PackageImportedFromPharo',
with:
      require([
          'amber/devel',
          'amber-livingcontract/App',...

my app stopped working with a long list of errors culminating in "TypeError: smalltalk.MyClassDefinedInMainPackageCreatedByAmberInit is undefined" :(

For instance, what do I put for -l? Would that be all the other things like:
      require([
          'amber/devel',
          ...
          'bower_components/jstree/dist/jstree.min',
          'bower_components/jquery/jquery-migrate',

I tried:
  amberc -l bower_components/jquery/jquery-migrate.js bower_components/jstree/dist/jstree.min.js js/splitter.js bower_components/pathjs/path.js -n amber-livingcontract MainPackageCreatedByAmberInit.js PackageImportedFromPharo.js App
but got:
  [Error: File not found: /usr/local/lib/node_modules/amber-cli/node_modules/amber/support/deprecated-vm-files/jstree.min.js]

Any guidance would be appreciated. Thanks in advance.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Simple amberc example

Herby Vojčík
Amberc is not to create browser bundles. It creates cli programs for node.js.

"Sean P. DeNigris" <[hidden email]>napísal/a:

>I read the help for amberc, but there are so many options I don't know where
>to start...
>
>What would the invocation look like to turn a dead-simple single-ST-package
>app into a single JS app file? And how would that effect the standard
>index.html file?
>
>I tried:
>
>    amberc -n amber-livingcontract MainPackageCreatedByAmberInit.js
>PackageImportedFromPharo.js App
>
>which created App.js, but when I replaced the:
>     require([
>          'amber/devel',
>          'amber-livingcontract/MainPackageCreatedByAmberInit',
>          'amber-livingcontract/PackageImportedFromPharo',
>with:
>      require([
>          'amber/devel',
>          'amber-livingcontract/App',...
>
>my app stopped working with a long list of errors culminating in "TypeError:
>smalltalk.MyClassDefinedInMainPackageCreatedByAmberInit is undefined" :(
>
>For instance, what do I put for -l? Would that be all the other things like:
>      require([
>          'amber/devel',
>          ...
>          'bower_components/jstree/dist/jstree.min',
>          'bower_components/jquery/jquery-migrate',
>
>I tried:
>  amberc -l bower_components/jquery/jquery-migrate.js
>bower_components/jstree/dist/jstree.min.js js/splitter.js
>bower_components/pathjs/path.js -n amber-livingcontract
>MainPackageCreatedByAmberInit.js PackageImportedFromPharo.js App
>but got:
>  [Error: File not found:
>/usr/local/lib/node_modules/amber-cli/node_modules/amber/support/deprecated-vm-files/jstree.min.js]
>
>Any guidance would be appreciated. Thanks in advance.
>
>
>
>-----
>Cheers,
>Sean
>--
>View this message in context: http://forum.world.st/Simple-amberc-example-tp4770208.html
>Sent from the Amber Smalltalk mailing list archive at Nabble.com.
>
>--
>You received this message because you are subscribed to the Google Groups "amber-lang" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Simple amberc example

Herby Vojčík
In reply to this post by Sean P. DeNigris
[private]

Sean P. DeNigris wrote:

> I read the help for amberc, but there are so many options I don't know where
> to start...
>
> What would the invocation look like to turn a dead-simple single-ST-package
> app into a single JS app file? And how would that effect the standard
> index.html file?
>
> I tried:
>
>      amberc -n amber-livingcontract MainPackageCreatedByAmberInit.js
> PackageImportedFromPharo.js App
>
> which created App.js, but when I replaced the:
>       require([
>            'amber/devel',
>            'amber-livingcontract/MainPackageCreatedByAmberInit',
>            'amber-livingcontract/PackageImportedFromPharo',
> with:
>        require([
>            'amber/devel',
>            'amber-livingcontract/App',...

You never change to require calls. You always want the same modules, no
matter how they are actually loaded. You probably misunderstood module
name for its load path. See below.

> my app stopped working with a long list of errors culminating in "TypeError:
> smalltalk.MyClassDefinedInMainPackageCreatedByAmberInit is undefined" :(
>
> For instance, what do I put for -l? Would that be all the other things like:
>        require([
>            'amber/devel',
>            ...
>            'bower_components/jstree/dist/jstree.min',
>            'bower_components/jquery/jquery-migrate',

This is plain wrong. You should set up mapping from meaningful names to
the bower-installed modules. You map all code you use. All, not just
your own namespace. IOW, the require.config() call is longer. You should
_never_ use path to file as a module name. It's a symbolic-module-name,
not a path-to-load. That's the likely root of you previous
misundertanding where you replaced the parameters to require load.

amber-cli does assemble the aforementioned mapping for you,
automatically, from provided snippets (that's how amber libraries can
work well together, merging their own mappings). The `amber config`
command does it. You can look at amber master to see it at work, as only
0.13 have the .amd.json snippets required for `amber config` to work
(and 0.13-cli-created projects, as I sent in another email).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.