Deployment

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

Deployment

Sean P. DeNigris
Administrator
We *really* need a doc!

I collected all the (seemingly outdated) information from list threads at https://github.com/amber-smalltalk/amber/wiki/Deploying-Amber

Does anyone have a workflow they're using that we can start with?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Herby Vojčík
You may try the preview on how the process may look like with 0.13.0 alpha versions.

Do `(sudo) npm -g install amber-cli@~0.13.0` to install prerelease amber 0.13, then create a new project with `amber init`.

That project is already r.js-optimization-ready. You should have r.js installed globally ((sudo) npm -g install requirejs), and all you need to do is run `r.js -o app.build.js` (well, first, you need to run `amber config`, amber-cli does not yet run it automatically upon init). The r.js optimizer builds all-in-1.js file for you with your project classes as well as 'amber/deploy' set and minifies it.

In index.html you then only need to load that one file instead of require.js and config.js.
The rest (include 'require([...], function (...' should stay the same, the difference is the with all-in-1.js, no actual loading happens, require(...) call have already everything defined in the file, so it only instantates it and runs it.

There is nothing more, of yet, for deploy.
 Things like removing context-creating parts from .js files is planned, as well, and probably a few more, but that's it for now.

Herby

Sean P. DeNigris wrote:

> We *really* need a doc!
>
> I collected all the (seemingly outdated) information from list threads at
> https://github.com/amber-smalltalk/amber/wiki/Deploying-Amber
>
> Does anyone have a workflow they're using that we can start with?
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Deployment-tp4769977.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.
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Sean P. DeNigris
Administrator
Herby Vojčík wrote
The r.js optimizer builds all-in-1.js file for you...
I built the all-in-1 file...

Herby Vojčík wrote
In index.html you then only need to load that one file instead of require.js and config.js
It looks like you still need to load require.js, but the call to config.js can be replaced...

Herby Vojčík wrote
The rest (include 'require([...], function (...' should stay the same
If I leave the require as the generated default:
      require([
          'amber/devel',
          'amber-myproject/MyProject',
          'amber-myproject/MyProject-Tests']...
I get:
  Error: Script error for: amber/devel http://requirejs.org/docs/errors.html#scripterror
  Error: Script error for: amber-myproject/MyProject-Tests http://requirejs.org/docs/errors.html#scripterror

If I replace it with "require([ 'amber/helpers' ]..." and remove the smalltalk.initialize call (which then generates an error)...
"console.log(smalltalk);" in the function to require shows the object on the console, "console.log(smalltalk.globals.Object._new());" reports "TypeError: smalltalk.globals.Object._new is not a function"

So my questions are:
1. What is the correct index.html code?
2. What is the preferred way to kick off app code when using the all-in-one? Is it still in the index.html require, or can it be squeezed into the all-in-one somehow?

Thanks!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Herby Vojčík


Sean P. DeNigris wrote:

> Herby Vojčík wrote
>> The r.js optimizer builds all-in-1.js file for you...
>
> I built the all-in-1 file...
>
>
> Herby Vojčík wrote
>> In index.html you then only need to load that one file instead of
>> require.js and config.js
>
> It looks like you still need to load require.js, but the call to config.js
> can be replaced...

Ah, yes. It is possible to include requirejs inside it as well, with
some tweaks in app.build.js. I did it for different project and it was
really only one file.

> Herby Vojčík wrote
>> The rest (include 'require([...], function (...' should stay the same
>
> If I leave the require as the generated default:
>        require([
>            'amber/devel',
>            'amber-myproject/MyProject',
>            'amber-myproject/MyProject-Tests']...
> I get:
>    Error: Script error for: amber/devel
> http://requirejs.org/docs/errors.html#scripterror
>    Error: Script error for: amber-myproject/MyProject-Tests
> http://requirejs.org/docs/errors.html#scripterror
>
> If I replace it with "require([ 'amber/helpers' ]..." and remove the
> smalltalk.initialize call (which then generates an error)...
> "console.log(smalltalk);" in the function to require shows the object on the
> console, "console.log(smalltalk.globals.Object._new());" reports "TypeError:
> smalltalk.globals.Object._new is not a function"
>
> So my questions are:
> 1. What is the correct index.html code?

The correct is not to change anything. IOW, load it exactly same as you
would load it if there wasn't any all-in-1 file.

That said, all-in-1.js is produced with 'amber/deploy', not
'amber/devel' set. So correct load is to require that set instead of
'amver/devel'. It is presumed that when people actually deploy, they
will load 'amber/deploy' set instead of 'amber/devel' set (or if they
really want a compiler for something, they will load 'amber/lang').

You can of course build all-in-1.js with amber/devel set as well, but
that would be a bit strange, as you would not be able to save anything,
since modules are not loaded from true urls but defined in the all-in-1.js.

> 2. What is the preferred way to kick off app code when using the all-in-one?

The same as without it. Replace 'amber/devel' with 'amber/deploy' and
you're done.

> Is it still in the index.html require, or can it be squeezed into the
> all-in-one somehow?
>
> Thanks!
>
>
>
> -----
> Cheers,
> Sean
> --

--
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: Deployment

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


Sean P. DeNigris wrote:

> Herby Vojčík wrote
>> The r.js optimizer builds all-in-1.js file for you...
>
> I built the all-in-1 file...
>
>
> Herby Vojčík wrote
>> In index.html you then only need to load that one file instead of
>> require.js and config.js
>
> It looks like you still need to load require.js, but the call to config.js
> can be replaced...

Just adding 'amber/requirejs/require.min' to include: array in
app.build.js should do it.

--
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: Deployment

Sean P. DeNigris
Administrator
Herby Vojčík wrote
Just adding 'amber/requirejs/require.min' to include: array in
app.build.js should do it.
Yes that worked... any reason for this not to be the default (along with the path: entry)?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Herby Vojčík


Sean P. DeNigris wrote:
> Herby Vojčík wrote
>> Just adding 'amber/requirejs/require.min' to include: array in
>> app.build.js should do it.
>
> Yes that worked... any reason for this not to be the default (along with the

I forgot?

> path: entry)?

???

> -----
> Cheers,
> Sean
> --

--
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: Deployment

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


Sean P. DeNigris wrote:
> Herby Vojčík wrote
>> Just adding 'amber/requirejs/require.min' to include: array in
>> app.build.js should do it.
>
> Yes that worked... any reason for this not to be the default (along with the

It already is, if if you (sudo) npm -g update (amber-cli) then amber
init should create app.build.js with requirejs included.

> path: entry)?
>
>
>
> -----
> Cheers,
> Sean
> --

--
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: Deployment

Sean P. DeNigris
Administrator
Herby Vojčík wrote
It already is, if if you (sudo) npm -g update (amber-cli) then amber
init should create app.build.js with requirejs included.
Uh oh! After upgrading (via Mac Installer) node to 0.10.29, and `sudo npm -g update amber-cli`:
1. `amber init` gives the old file structure (without local.amd.json)
2. so `amber config` complains "Error: No .amd.json-type file found"

`amber version` still reports "0.13.0-pre (NodeJS 0.10.29)"

Any idea what's going on?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Herby Vojčík
Oh yeah, the prerelease is not the latest, so it probably ca nnot be updated using update.

You need to manually sudo npm -g install amber-cli@~0.13.0 again. It hopefully updates existing one - if not, just uninstall the install.

Sean P. DeNigris wrote:

> Herby Vojčík wrote
>> It already is, if if you (sudo) npm -g update (amber-cli) then amber
>> init should create app.build.js with requirejs included.
>
> Uh oh! After upgrading (via Mac Installer) node to 0.10.29, and `sudo npm -g
> update amber-cli`:
> 1. `amber init` gives the old file structure (without local.amd.json)
> 2. so `amber config` complains "Error: No .amd.json-type file found"
>
> `amber version` still reports "0.13.0-pre (NodeJS 0.10.29)"
>
> Any idea what's going on?
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Deployment-tp4769977p4770431.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.
Reply | Threaded
Open this post in threaded view
|

Re: Deployment

Sean P. DeNigris
Administrator
Herby Vojčík wrote
manually sudo npm -g install amber-cli@~0.13.0 again
Okay, yes, now...
    <script type='text/javascript' src='bower_components/amber/support/requirejs/require.min.js'></script>... can be removed from index.html when using the all-in-1

Cool :)
Cheers,
Sean