-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create and use Amber 0.14.1 libraries? #20
Comments
|
In teresting, people asks me this every now and then. I'll try publishing a package and see (I don't have clear what gets saved by bower, if the package only or more) Thanks for the step by step description! |
Sebastian Sastre notifications@github.comnapísal/a:
It is good to realize there is nothing like "saved by bower" thing out there, because of different models of npm and bower. In npm, you push any version you want to publish to npm registry, from disk, and it the stores and serves it. With bower, you must register git url, and bower then uses this git repo when installing, so it pulls the files. To publish a version, you must create a tag in the registered repo. And as for what bower pulls - everything except what is listed in ignore section of bower.json. |
So we have two ways of doing it! that's great! Wiki pages or protips in codewall explaining by example one each way of doing it would be really handy Volunteers? |
Sebastian Sastre notifications@github.comnapísal/a:
??? What is 'it' and what two ways are you talking about? |
Two ways to publish Amber libraries:
|
Oh. No, that was a misunderstanding. I mentioned npm only as an example of push model (which is what people probably see as default) to contrast it with bower model. In no way did (and do) I endorse using npm as a way to publish amber libraries. 99% of Amber projects, including libraries, is browser-based, and there just nothing else makes sense except bower. Of course, technically you can use any other channels, but it's IMO just not relevant to mention them. Sebastian Sastre notifications@github.comnapísal/a:
|
Good point. So bower it is. Here is a friendly how to |
Well, too much unneeded information there, as no |
As a summary so far: Instructions from Herby above copied and adapted for the case that you start a fresh amber 0.13 project possibly then copying Smalltalk code from an earlier project with fileIn in the legacy browser workspace)
@Herby Is this correct? |
No, the "which already has its own .amd.json file, you do not need to create it as with common libraries" was about use, not about creation. Of course you must create .amd.json files just as with any other app - local.amd.json for your own mappings (prepopulated by amber init) and foo.amd.json for every external library (unless it is nice enough to have .amd.json files itself). |
Overall, I'd say there is no magic in creating libraries at all. They are identical to any other project (except they will likely never run What is magic is use of libraries, and only those which do not have .amd.json files of their own (which Amber libraries have), so only external libraries. For those you need to create .amd.json file with mappings. All in all, every component must have mappings in some .amd.json file. If it is nice, it has its own local.amd.json file with its own mappings. If it does not (is an external library, for example jQuery), its holder should supply .amd.json file for it. So that, ultimately, every component has its piece of config defined. So, to use nice library means only to install it via bower and regenerate config. To use non-nice library involves the additional step of defining its mappings. Nothing really hard, when you see into the abstraction. |
OK, let me this later by converting amber-examples/trysmalltalk to an Amber 0.13 library which can be loaded through bower. |
The wiki page on Amber-Config has a basic paragraph about Amber libraries. A follow up question:
How do I create an Amber library 0.13 style which then can be loaded with
bower
?For example
amber init
?The text was updated successfully, but these errors were encountered: