@faable/faable 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,11 @@ import path__default from 'path';
3
3
  import { cmd } from '../../../../lib/cmd.js';
4
4
  import { log } from '../../../../log.js';
5
5
 
6
+ const getCurrentNodeVersion = async () => {
7
+ const out = await cmd(`node --version`);
8
+ const [_, version] = out.stdout.toString().trim().split("v");
9
+ return version;
10
+ };
6
11
  /**
7
12
  * Strategy to detect app name from package.json
8
13
  * @param api
@@ -17,7 +22,7 @@ const strategy_nodejs = async (workdir) => {
17
22
  throw new Error("Missing name in package.json");
18
23
  }
19
24
  // Use engines.node if found
20
- let runtime_version = "18.19.0";
25
+ let runtime_version = await getCurrentNodeVersion();
21
26
  if (engines?.node) {
22
27
  try {
23
28
  const check_cmd = `npm view node@"${engines.node}" version | tail -n 1 | cut -d "'" -f2`;
@@ -26,9 +31,12 @@ const strategy_nodejs = async (workdir) => {
26
31
  log.info(`Using node@${runtime_version} from engines in package.json (${engines.node})`);
27
32
  }
28
33
  catch (e) {
29
- throw new Error(`Node version is not valid (${engines.node})`);
34
+ log.info(`Node version defined in engines in package.json is not valid (${engines.node}), using current version ${runtime_version}`);
30
35
  }
31
36
  }
37
+ else {
38
+ log.info(`Node version ${runtime_version}`);
39
+ }
32
40
  return {
33
41
  app_name: name,
34
42
  runtime: {
package/dist/lib/cmd.js CHANGED
@@ -10,7 +10,7 @@ const cmd = async (cmd, config) => {
10
10
  stdio: enableOutput ? "inherit" : "pipe",
11
11
  timeout,
12
12
  cwd,
13
- env: config.env,
13
+ env: config?.env || {},
14
14
  });
15
15
  const out_data = [];
16
16
  child.stderr?.on("data", (data) => {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "yaml": "^2.8.2",
15
15
  "yargs": "^18.0.0"
16
16
  },
17
- "version": "1.5.6",
17
+ "version": "1.5.8",
18
18
  "bin": {
19
19
  "faable": "bin/faable.js"
20
20
  },