@deeeed/metamask-harness 0.25.0 → 0.25.1

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.25.1 - 2026-07-30
6
+
7
+ ### Fixed
8
+
9
+ - Source-checkout dependency readiness works under restrictive caller umasks and uses an isolated npm cache instead of inheriting a broken global cache.
10
+
5
11
  ## 0.25.0 - 2026-07-30
6
12
 
7
13
  ### Added
@@ -10,9 +10,9 @@
10
10
  # Env: FARMSLOT_ROOT / METAMASK_RUNNER_PROTOCOL_ROOT — optional local link target
11
11
  set -euo pipefail
12
12
 
13
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
14
  RUNNER_DIR="${1:-}"
14
15
  if [ -z "$RUNNER_DIR" ]; then
15
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
16
  RUNNER_DIR="$(cd "$SCRIPT_DIR/../.." && pwd -P)"
17
17
  fi
18
18
  RUNNER_DIR="$(cd "$RUNNER_DIR" && pwd -P)"
@@ -23,59 +23,8 @@ if [ -z "$PROTOCOL_ROOT" ] && [ -f "$RUNNER_DIR/.farmslot-root" ]; then
23
23
  fi
24
24
 
25
25
  deps_ready() {
26
- node --input-type=module - "$RUNNER_DIR" "$PROTOCOL_ROOT" <<'NODE'
27
- import fs from 'node:fs';
28
- import { createRequire } from 'node:module';
29
- import path from 'node:path';
30
- import { pathToFileURL } from 'node:url';
31
-
32
- const runnerDir = process.argv[2];
33
- const overrideRootInput = process.argv[3];
34
- const pkg = JSON.parse(fs.readFileSync(path.join(runnerDir, 'package.json'), 'utf8'));
35
- let dependencyVersionSatisfies;
36
- try {
37
- const requireFromRunner = createRequire(path.join(runnerDir, 'package.json'));
38
- const helperPath = requireFromRunner.resolve(
39
- '@farmslot/recipe-harness/runtime/deps-readiness',
40
- );
41
- ({ dependencyVersionSatisfies } = await import(pathToFileURL(helperPath).href));
42
- if (typeof dependencyVersionSatisfies !== 'function') process.exit(1);
43
- } catch {
44
- process.exit(1);
45
- }
46
- let overrideRoot = null;
47
- if (overrideRootInput) {
48
- try {
49
- overrideRoot = fs.realpathSync(overrideRootInput);
50
- } catch {
51
- overrideRoot = null;
52
- }
53
- }
54
- function isOverrideLink(packageDir) {
55
- if (!overrideRoot) return false;
56
- try {
57
- if (!fs.lstatSync(packageDir).isSymbolicLink()) return false;
58
- const resolved = fs.realpathSync(packageDir);
59
- const relative = path.relative(overrideRoot, resolved);
60
- return relative === '' || (
61
- relative !== '..' &&
62
- !relative.startsWith(`..${path.sep}`) &&
63
- !path.isAbsolute(relative)
64
- );
65
- } catch {
66
- return false;
67
- }
68
- }
69
- const invalid = Object.entries(pkg.dependencies ?? {}).filter(([name, request]) => {
70
- const packageDir = path.join(runnerDir, 'node_modules', ...name.split('/'));
71
- const installedPath = path.join(packageDir, 'package.json');
72
- if (!fs.existsSync(installedPath)) return true;
73
- if (isOverrideLink(packageDir)) return false;
74
- const installed = JSON.parse(fs.readFileSync(installedPath, 'utf8'));
75
- return !dependencyVersionSatisfies(installed.version, request);
76
- });
77
- process.exit(invalid.length === 0 ? 0 : 1);
78
- NODE
26
+ node "$SCRIPT_DIR/runner-deps-ready.mjs" \
27
+ "$RUNNER_DIR" "$PROTOCOL_ROOT"
79
28
  }
80
29
 
81
30
  # Library actions import @deeeed/metamask-harness by package name; a source checkout
@@ -127,7 +76,9 @@ fi
127
76
  echo "mm-harness: installing runner dependencies via npm in $RUNNER_DIR" >&2
128
77
  (
129
78
  cd "$RUNNER_DIR"
130
- npm install --ignore-scripts >&2
79
+ umask 022
80
+ npm_config_cache="${MM_HARNESS_NPM_CACHE:-${TMPDIR:-/tmp}/mm-harness-npm-cache-${UID:-$(id -u)}}" \
81
+ npm install --ignore-scripts >&2
131
82
  )
132
83
 
133
84
  # npm may replace the local protocol links with registry packages. Restore the
@@ -0,0 +1,64 @@
1
+ import fs from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import path from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+
6
+ const [runnerDir, overrideRootInput] = process.argv.slice(2);
7
+ const pkg = JSON.parse(
8
+ fs.readFileSync(path.join(runnerDir, 'package.json'), 'utf8'),
9
+ );
10
+
11
+ let dependencyVersionSatisfies;
12
+ try {
13
+ const requireFromRunner = createRequire(path.join(runnerDir, 'package.json'));
14
+ const helperPath = requireFromRunner.resolve(
15
+ '@farmslot/recipe-harness/runtime/deps-readiness',
16
+ );
17
+ ({ dependencyVersionSatisfies } = await import(pathToFileURL(helperPath).href));
18
+ if (typeof dependencyVersionSatisfies !== 'function') process.exit(1);
19
+ } catch {
20
+ process.exit(1);
21
+ }
22
+
23
+ let overrideRoot = null;
24
+ if (overrideRootInput) {
25
+ try {
26
+ overrideRoot = fs.realpathSync(overrideRootInput);
27
+ } catch {
28
+ overrideRoot = null;
29
+ }
30
+ }
31
+
32
+ function isOverrideLink(packageDir) {
33
+ if (!overrideRoot) return false;
34
+ try {
35
+ if (!fs.lstatSync(packageDir).isSymbolicLink()) return false;
36
+ const resolved = fs.realpathSync(packageDir);
37
+ const relative = path.relative(overrideRoot, resolved);
38
+ return (
39
+ relative === '' ||
40
+ (relative !== '..' &&
41
+ !relative.startsWith(`..${path.sep}`) &&
42
+ !path.isAbsolute(relative))
43
+ );
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+
49
+ const invalid = Object.entries(pkg.dependencies ?? {}).filter(
50
+ ([name, request]) => {
51
+ const packageDir = path.join(
52
+ runnerDir,
53
+ 'node_modules',
54
+ ...name.split('/'),
55
+ );
56
+ const installedPath = path.join(packageDir, 'package.json');
57
+ if (!fs.existsSync(installedPath)) return true;
58
+ if (isOverrideLink(packageDir)) return false;
59
+ const installed = JSON.parse(fs.readFileSync(installedPath, 'utf8'));
60
+ return !dependencyVersionSatisfies(installed.version, request);
61
+ },
62
+ );
63
+
64
+ process.exit(invalid.length === 0 ? 0 : 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"