On 6. 8. 2021 15:36, Richard Ronteltap wrote:
> Ah, I missed that button!
> But pressing it does not give any reaction or error message.
> Tried is on my dev env and on the official site.
> How is it supposed to work?
> The use case is that I want to fileIn my *.st souce files, in a fresh
> new Amber project.
You are telling me _how_ you want to do it, I asked _what_ you want to
From what you tell me, you want to reuse some existing Amber sources
from existing project in a new project. That is not done via file in.
There's easier way. Is that your case? If yes, read on. If not, I
actually don't know why fileIn button does not work; from what I see in
code, it actually imports .st format (of the Amber flavor; so maybe a
preamble need hand-update if you copied non-Amber Smalltalk code).
Instruction for reuse of existing Amber code follows.
Do not get intimidated that the instructions seems long; they are
(IMNSHO) simple, I just wanted to outline it so there isn't any error
during the process (feel free to backup before doing anything).
You can _actually_ reuse the files from existing project (if they have
.js as well). Firstly, you can make it into library (but that's another
story) and simply add it as npm dependency. In the case you just want to
to copy sources over, just copy the src old old project into, say, src2
in new project. Then, add new namespace (eg. "old") pointing to "src2"
into local.amd.json. Then, run `grunt devel`, which should detect the
change and include new namespace into config.js. Then, load your project
and and add 'old/NameOfOldPackage' (and other packages if there were
more packages) into your imports: section in your main app package. Then
commit and reload; and the the old package(s) is loaded.
It's up to you if keep it in src2 with namespace "old" (awkward), or
move it over to yout main src, which you can do two ways: either change
namespace of old packages to the one of your new app, thereby including
new packages into you main namespace; or change the namespace to
completely new one (you can have more namespaces in your project). In
both cases, commit (Amber can ask you for a path, suggesting src IIRC,
if you chose new namespace). Then (!IMPORANT!) fix your import: section
to point at packages saved in new namespaces. Commit. In case you chose
the new namespace, add it to local.amd.json and run `grunt devel`.
Reload. Packages should be loaded from new position in your src/. You
can remove src2/ as well as namespace pointing at src2/ from you
local.amd.json. Run `grunt devel` to regenerate config.js. Reload.
P.S.: Whenever you add an .st/.js pair into your project (that is, you
add a package), you should also update Gruntfile.js so it contains it
and recompiles it when `grunt` is run; this is used in `npm run init`
functionality; should you need to recompile completely; for example
after breaking Amber update. Keep Gruntfile.js in sync with your src/.
P.P.S.: If it's piece of reusable code, I would suggest to make it a
library instead. An app itself _is_ a reusable library, technically, but
actual library would need a bit of a cleanup (and, ideally, publishing
in npm). Then, reusing the code is as easy as "npm install the_lib
--save", running `grunt devel` which finds it in node_modules and uses
its local.amd.json to generate a paths line in condig.js, reload, and
then adding the import: section with 'lib_namespace/LibPackage'. That
presumes the library has unique enough namespace so it won't collision
with your app or another lib in the future.
P.P.P.S.: There's still `amberc` which compiles (amber-variant) of .st
file directly from cli; if you just want to move one file into your
project, that may be the easiest way (but again, add import: section to
your main package so it is actually loaded).
> 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 amber-lang+...@googlegroups.com
> To view this discussion on the web visit