paperdave / various

Various libraries and applications related to TypeScript. Everything is contained in a monorepo to improve productivity and reduce boilerplate.
MIT License
31 stars 3 forks source link

logger: nullish coalescing operator (`??`) isn't available in Node 12 #27

Closed BergerAPI closed 2 years ago

BergerAPI commented 2 years ago

What package(s) does this bug target?

@paperdave/logger

Describe the bug and how to reproduce it.

Running in an Ubuntu-Docker-Container and after installing npm and nodejs, I tried to install my own package, which uses @paperdave/logger, globally and encountered, that apt install Node v12.22.9 by default. The nullish coalescing operator (??) exists since Node 14 and therefore causes an error.

You can reproduce this by running following commands:

docker run -i --rm -t ubuntu /bin/bash

# In Container
apt update
apt install nodejs
apt install npm

# Installing my package globally
npm i -g dokument

# Running my package
dokument

This causes an error which is caused by @paperdave/logger image

paperdave commented 2 years ago

node v12 hit end of life (security updates included) a few months ago. node 14 does have nullish coalescing, but also node 16 is the current LTS (Ubuntu is pretty bad at keeping a LTS version of node in its repositories).

I don't really have much against fixing it since as you shown it was a simple tsconfig change, but aren't you able to just use a different docker container as I'm sure there's dozens of containers that include node (I don't know much about docker), or install node using this apr repository (scroll down to Ubuntu and node 16).

tell me if upgrading to node 14 presents more problems and if it does I can continue support on node 12 a little more, but I would rather not.

BergerAPI commented 2 years ago

I can verify that it works fine with Node LTS. Though I'd still like support for Node 12, because APT automatically installs it, and I want kind-of plug-and-play with my tool.

Referring to your Docker-mention: I didn't want to use any predefined node image - pure Ubuntu. Just to see whether it would work (can't test it on my pc since my main os is arch atm)

image