AlaSQL / alasql

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
http://alasql.org
MIT License
7.02k stars 654 forks source link

Fix(utils.isNode) Incompatibility of utils.isNode Function with signal-exit #1889 #1901

Closed vishal6557 closed 6 months ago

vishal6557 commented 6 months ago

Fix #1889

Thank you for the time you are putting into AlaSQL!

mathiasrw commented 6 months ago

Love it. Thanks!

Warfront1 commented 6 months ago

Nice job @vishal6557 and @mathiasrw. 👍

My tests are now passing. Dockerfile:

FROM node:16
WORKDIR /test
RUN npm init -y
ARG ALASQL_VERSION=4.2.7
RUN npm install alasql@$ALASQL_VERSION signal-exit@3.0.7
# Create the Node.js script inline
RUN echo "const onExit = require('signal-exit');\n\
onExit(() => console.log('exit'));\n\
const alasql = require('alasql');\n\
const utils = alasql.utils;\n\
console.log('The current value of utils.isNode is: ', utils.isNode);\n\
" > utilsNodeCheck.js
# Run the Node.js script
CMD ["node", "utilsNodeCheck.js"]

CMD:

docker build --build-arg ALASQL_VERSION=4.2.7 -t my-image:4.2.7 . && docker run my-image:4.2.7

Output: The current value of utils.isNode is: false

CMD:

docker build --build-arg ALASQL_VERSION=4.3.2 -t my-image:4.3.2 . && docker run my-image:4.3.2

Output: The current value of utils.isNode is: true

Thank you both.