@jira-deploy/core 1.0.9 → 1.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jira-deploy/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "repository": {
package/tools/jabber.js CHANGED
@@ -5,8 +5,16 @@
5
5
  import {execFile} from 'child_process';
6
6
  import fs from 'fs';
7
7
  import path from 'path';
8
+ import {fileURLToPath} from 'url';
8
9
  import {error, ok} from './helpers.js';
9
10
 
11
+ const packageScriptPath = path.resolve(
12
+ path.dirname(fileURLToPath(import.meta.url)),
13
+ '..',
14
+ 'scripts',
15
+ 'jabber_notify.py',
16
+ );
17
+
10
18
  function realpathOrNull(filePath) {
11
19
  try {
12
20
  return fs.realpathSync(filePath);
@@ -30,6 +38,7 @@ export function resolveJabberNotifyScriptPath({
30
38
 
31
39
  const resolvedExecPath = realpathOrNull(execPath);
32
40
  const candidates = [
41
+ packageScriptPath,
33
42
  ...unique([resolvedExecPath, execPath]).map((candidate) =>
34
43
  path.resolve(path.dirname(candidate), 'scripts/jabber_notify.py')
35
44
  ),
@@ -2,11 +2,19 @@ import test from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import {mkdtempSync, mkdirSync, writeFileSync} from 'node:fs';
4
4
  import {tmpdir} from 'node:os';
5
- import {join} from 'node:path';
5
+ import {dirname, join} from 'node:path';
6
+ import {fileURLToPath} from 'node:url';
6
7
 
7
8
  import {resolveJabberNotifyScriptPath} from './jabber.js';
8
9
 
9
- test('resolveJabberNotifyScriptPath ignores empty env and prefers packaged script beside binary', () => {
10
+ const corePackageScriptPath = join(
11
+ dirname(fileURLToPath(import.meta.url)),
12
+ '..',
13
+ 'scripts',
14
+ 'jabber_notify.py',
15
+ );
16
+
17
+ test('resolveJabberNotifyScriptPath ignores empty env and prefers script shipped with core package', () => {
10
18
  const root = mkdtempSync(join(tmpdir(), 'ares-jabber-'));
11
19
  const binDir = join(root, 'app');
12
20
  const scriptPath = join(binDir, 'scripts', 'jabber_notify.py');
@@ -19,7 +27,7 @@ test('resolveJabberNotifyScriptPath ignores empty env and prefers packaged scrip
19
27
  execPath: join(binDir, 'ares'),
20
28
  cwd: join(root, 'work'),
21
29
  }),
22
- scriptPath,
30
+ corePackageScriptPath,
23
31
  );
24
32
  });
25
33
 
@@ -33,3 +41,14 @@ test('resolveJabberNotifyScriptPath keeps explicit env override', () => {
33
41
  '/custom/jabber_notify.py',
34
42
  );
35
43
  });
44
+
45
+ test('resolveJabberNotifyScriptPath falls back to script shipped with core package', () => {
46
+ assert.equal(
47
+ resolveJabberNotifyScriptPath({
48
+ env: {JABBER_NOTIFY_SCRIPT: ''},
49
+ execPath: '/opt/node/bin/node',
50
+ cwd: '/tmp/not-the-repo',
51
+ }),
52
+ corePackageScriptPath,
53
+ );
54
+ });