Skip to content
Snippets Groups Projects
Unverified Commit 29f323e7 authored by Stefan Hall's avatar Stefan Hall Committed by GitHub
Browse files

Validates minimum node version to 18.12.0 for @actual-app/api npm package (#1980)

parent c4626048
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// eslint-disable-next-line import/extensions // eslint-disable-next-line import/extensions
import * as bundle from './app/bundle.api.js'; import * as bundle from './app/bundle.api.js';
import * as injected from './injected'; import * as injected from './injected';
import { validateNodeVersion } from './validateNodeVersion';
let actualApp; let actualApp;
export const internal = bundle.lib; export const internal = bundle.lib;
...@@ -18,6 +19,8 @@ export async function init(config = {}) { ...@@ -18,6 +19,8 @@ export async function init(config = {}) {
return; return;
} }
validateNodeVersion();
global.fetch = (...args) => global.fetch = (...args) =>
import('node-fetch').then(({ default: fetch }) => fetch(...args)); import('node-fetch').then(({ default: fetch }) => fetch(...args));
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
}, },
"dependencies": { "dependencies": {
"better-sqlite3": "^9.1.1", "better-sqlite3": "^9.1.1",
"compare-versions": "^6.1.0",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
......
import { satisfies } from 'compare-versions';
import * as packageJson from './package.json';
export function validateNodeVersion() {
if (process?.versions?.node) {
const nodeVersion = process?.versions?.node;
const minimumNodeVersion = packageJson.engines.node;
if (!satisfies(nodeVersion, minimumNodeVersion)) {
throw new Error(
`@actual-app/api requires a node version ${minimumNodeVersion}. Found that you are using: ${nodeVersion}. Please upgrade to a higher version`,
);
}
}
}
---
category: Enhancements
authors: [Marethyu1]
---
Validates minimum node version to 18.12.0 for @actual-app/api npm package
...@@ -25,6 +25,7 @@ __metadata: ...@@ -25,6 +25,7 @@ __metadata:
dependencies: dependencies:
"@types/uuid": "npm:^9.0.2" "@types/uuid": "npm:^9.0.2"
better-sqlite3: "npm:^9.1.1" better-sqlite3: "npm:^9.1.1"
compare-versions: "npm:^6.1.0"
node-fetch: "npm:^3.3.2" node-fetch: "npm:^3.3.2"
typescript: "npm:^5.0.2" typescript: "npm:^5.0.2"
uuid: "npm:^9.0.0" uuid: "npm:^9.0.0"
...@@ -7169,6 +7170,13 @@ __metadata: ...@@ -7169,6 +7170,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"compare-versions@npm:^6.1.0":
version: 6.1.0
resolution: "compare-versions@npm:6.1.0"
checksum: 20f349e7f8ad784704c68265f4e660e2abbe2c3d5c75793184fccb85f0c5c0263260e01fdd4488376f6b74b0f069e16c9684463f7316b075716fb1581eb36b77
languageName: node
linkType: hard
"compressible@npm:~2.0.16": "compressible@npm:~2.0.16":
version: 2.0.18 version: 2.0.18
resolution: "compressible@npm:2.0.18" resolution: "compressible@npm:2.0.18"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment