Amber icon indicating copy to clipboard operation
Amber copied to clipboard

[Feature] Amber Updater

Open brumik opened this issue 1 year ago • 8 comments

Make so that Amber can update itself.

brumik avatar Jun 02 '24 09:06 brumik

I was thinking of two possible ways to do it:

CLI command option:

amber --check-version

Current version: 1.0.0
Latest version: 1.2.0

Run amber --update to get the latest version

Manual command option:

amber ---check-version

Current version: 1.0.0
Latest version: 1.2.0

To update amber run:

curl -s "https://raw.githubusercontent.com/Ph0enixKM/AmberNative/master/setup/update.sh" | /usr/bin/env bash

brumik avatar Jun 02 '24 09:06 brumik

shouldn't this kind of thing be done via the system's package manager?

b1ek avatar Jun 02 '24 10:06 b1ek

I expect so if you installed it from one. Currently we have a script that is the "recommended" (or for most systems only) way to do it. So as I understood the task from the project we want something like this.

brumik avatar Jun 03 '24 07:06 brumik

Well this is a good question. When Amber was first created I was not focusing on maintaining packages. Now since there are propositions to maintain Amber via Homebrew tap or AUR packages - this could be unnecessary.

However... I still think that Amber should at least inform the user about new updates in some way and it should instruct them on how to update it.

I think that this issue should at least cover the ability to check the latest version. If do something like --check-version it should fetch the latest version available.

Ph0enixKM avatar Jun 03 '24 13:06 Ph0enixKM

inform the user about new updates

when would be the right time to do this, though? sending an HTTP request somewhere each compilation seems very unnecessary and time consuming. also the users might not like the excessive telemetry

i cant really think of a language/compiler/interpreter that informs the user about a new update tbh

b1ek avatar Jun 03 '24 13:06 b1ek

I think that creating brew tap, PPA repository etc. Would be of higher priority right now. We should discuss that more on GH Discussions

Ph0enixKM avatar Jun 03 '24 14:06 Ph0enixKM

when would be the right time to do this, though? sending an HTTP request somewhere each compilation seems very unnecessary and time consuming. also the users might not like the excessive telemetry

@b1ek This could happen when user checks the compiler version. Although I'm not sure if people would be against that. We can always just leave the --check-version or --latest to get the latest version by itself. Not necessarily try to hide or sneak some telemetry behind the scenes.

Ph0enixKM avatar Jun 03 '24 15:06 Ph0enixKM

Personally, I think it makes more sense for package managers to do that job. And for non-system installations, a tool like Amethyst would satisfy that need :^)


Old Content

To expand on this, since amber is such a volatile language, it'd probably be better to have a tool similar to nodejs' corepack. To automatically download the appropriate version for each project, so we don't have to rewrite all our scripts whenever Amber does breaking changes.

If Amber maintained multiple binaries and could automatically switch between them, it would be epic.

-- Edit:

I can't find a link to this, but someone mentioned having amber be a wrapper for amberc, kinda like how build tools wrap around the actual compiler.

Doing it that way, would mean the wrapper (amber) has full control of what compiler (amberc) is used. So we won't have to mess with symbolic links and such.

--

And since a package manager would be added at some point, having a project configuration file (like Cargo.toml) that defines what amber version is targeted, won't be out of place.

Heck, we could even define a range of amber versions, so it can decide if it should download a specific version or not.

Update:

I am working on this, in pure amber, and will name it "amethyst" :^)

ArjixWasTaken avatar Apr 10 '25 10:04 ArjixWasTaken