@pragma-sh/junie-plugin 1.0.1 → 1.0.2
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/.junie-plugin/plugin.json +1 -1
- package/dist/install.mjs +2 -2
- package/package.json +1 -1
- package/scripts/install-local.ts +11 -9
package/dist/install.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
var JUNIE_HOME = process.env.JUNIE_HOME ?? join(homedir(), ".junie");
|
|
7
7
|
var CONFIG_PATH = join(JUNIE_HOME, "config.json");
|
|
8
|
-
var
|
|
8
|
+
var HOOK_SCRIPT_PATTERN = /junie-plugin[^/\\"]*[/\\]hooks[/\\]report\.sh/;
|
|
9
9
|
var root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
10
|
var template = readFileSync(join(root, "hooks", "hooks.json"), "utf8");
|
|
11
11
|
var ours = JSON.parse(template.replaceAll("${JUNIE_PLUGIN_ROOT}", root)).hooks;
|
|
@@ -53,7 +53,7 @@ function dropOwnEntries(existingHooks, pluginRoot) {
|
|
|
53
53
|
function isOwnEntry(entry, pluginRoot) {
|
|
54
54
|
return (entry.hooks ?? []).some((hook) => {
|
|
55
55
|
const command = hook.command ?? "";
|
|
56
|
-
return command.includes(pluginRoot) ||
|
|
56
|
+
return command.includes(pluginRoot) || HOOK_SCRIPT_PATTERN.test(command);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
function isPlainObject(value) {
|
package/package.json
CHANGED
package/scripts/install-local.ts
CHANGED
|
@@ -42,12 +42,14 @@ interface JunieConfig {
|
|
|
42
42
|
const JUNIE_HOME = process.env.JUNIE_HOME ?? join(homedir(), ".junie");
|
|
43
43
|
const CONFIG_PATH = join(JUNIE_HOME, "config.json");
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* Identifies this package's hook script in an installed command. The absolute
|
|
46
|
+
* plugin root changes per checkout (`packages/junie-plugin`, worktrees) and per
|
|
47
|
+
* Pragma-managed npm install (`-pragma-sh-junie-plugin-<version>-<uuid>`), so
|
|
48
|
+
* this matches the script under any directory named for the package: an
|
|
49
|
+
* upgrade replaces the previous install instead of stacking hooks that point
|
|
50
|
+
* at a directory Pragma has since deleted.
|
|
49
51
|
*/
|
|
50
|
-
const
|
|
52
|
+
const HOOK_SCRIPT_PATTERN = /junie-plugin[^/\\"]*[/\\]hooks[/\\]report\.sh/;
|
|
51
53
|
|
|
52
54
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
53
55
|
const template = readFileSync(join(root, "hooks", "hooks.json"), "utf8");
|
|
@@ -114,10 +116,10 @@ function dropOwnEntries(
|
|
|
114
116
|
function isOwnEntry(entry: JunieHookEntry, pluginRoot: string): boolean {
|
|
115
117
|
return (entry.hooks ?? []).some((hook) => {
|
|
116
118
|
const command = hook.command ?? "";
|
|
117
|
-
// The absolute root changes per checkout
|
|
118
|
-
// package's hook-script path: reinstalling from
|
|
119
|
-
// replace the previous install instead of stacking a second set
|
|
120
|
-
return command.includes(pluginRoot) ||
|
|
119
|
+
// The absolute root changes per checkout and per npm install, so also
|
|
120
|
+
// match the package's hook-script path: reinstalling from anywhere else
|
|
121
|
+
// must replace the previous install instead of stacking a second set.
|
|
122
|
+
return command.includes(pluginRoot) || HOOK_SCRIPT_PATTERN.test(command);
|
|
121
123
|
});
|
|
122
124
|
}
|
|
123
125
|
|