A forward-compatability library for nu.
⚠️ This is currently a experiment to check how well this can work
The experiment might get abandoned at any point.
Its currently a "better than nothing", but well not much more.
with numng
Add the following linkin to your projects numng.json
:
{
"linkin": {
"nulibs/nine": {"name": "jan9103/nine", "version": "~0.95"}
},
"registry": [
{"source_uri": "https://github.com/Jan9103/numng_repo", "package_format": "numng", "path_offset": "repo"}
]
}
or
"linkin": {
"nulibs/nine": {"name": "nine", "source_uri": "https://github.com/jan9103/nine.nu", "git_ref": "nu0.95"}
}
And replace 0.95
with the oldest nushell version you want to support
Afterwards use
it at the top of each script of your project using relative paths from the script to nine (example: use ../nulibs/nine *
)
It might be possible to package this for nupm, but since each script and library might use a diffrent version issues might arise.
Manually copying the files in might work at first, but you will have to constantly update it manually for each project on each device.
- some things are impossible to emulate using a library (example: since
0.96
continue
no longer works withineach
) - sometimes it isn't worth the work since noone (shouldve) used the old feature (example: since
0.96
"foo"bar
is no longer a valid string) - overriding other libraries (including
std
) is not reliable - i wont keep supporting versions forever. depending on the changes the support-duration might vary.
- anything polars
- broken by nu0.96: do not use
continue
withineach
- broken by nu0.97: add quotes to strings within assignments (
let
,mut
,$foo =
) (const foo = bar
->const foo = "bar"
) - broken by nu0.98: tee is somehow diffrent
branch-name / from nu-version | up to nu-version | code |
---|---|---|
nu0.95 |
0.100 |
code |
nu0.96 |
0.100 |
code |
nu0.97 |
0.100 |
code |
nu0.98 |
0.100 |
code |
nu0.99 |
0.100 |
code |
nu0.100 |
0.100 |
code |
Q: Why?
A: Nushell has still not reached version 1.0 and regularly renames or removes features.
I have a lot of scripts, all of which have to work with the latest nu version (on my desktop), stable (on my server), and a little outdated (on my laptop).
Additionally updating all scripts (especially while keeping backward-compatability) the day a new update comes out is tedious.
The solution: Revert the changes from new versions using a library allowing scripts for old version to keep working.
Q: Why not backward-compatability?
A: Adding all the new features is way more work than undoing renames (i hope) and the lazy script updating part only works this way around.