@pipelab/plugin-nvpatch 1.0.0-beta.1 → 1.0.0-beta.4

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,12 +1,15 @@
1
1
  {
2
2
  "name": "@pipelab/plugin-nvpatch",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.4",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/CynToolkit/pipelab.git",
8
8
  "directory": "plugins/plugin-nvpatch"
9
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "type": "module",
11
14
  "main": "./dist/index.cjs",
12
15
  "module": "./dist/index.mjs",
@@ -17,12 +20,12 @@
17
20
  "dependencies": {
18
21
  "@types/node": "^24.12.2",
19
22
  "execa": "9.4.1",
20
- "@pipelab/plugin-core": "1.0.0-beta.1"
23
+ "@pipelab/plugin-core": "1.0.0-beta.4"
21
24
  },
22
25
  "devDependencies": {
23
26
  "tsdown": "0.21.2",
24
27
  "typescript": "5.9.3",
25
- "@pipelab/tsconfig": "1.0.0-beta.0"
28
+ "@pipelab/tsconfig": "1.0.0-beta.2"
26
29
  },
27
30
  "scripts": {
28
31
  "format": "oxfmt .",
package/CHANGELOG.md DELETED
@@ -1,18 +0,0 @@
1
- # @pipelab/plugin-nvpatch
2
-
3
- ## 1.0.0-beta.1
4
-
5
- ### Patch Changes
6
-
7
- - @pipelab/plugin-core@1.0.0-beta.1
8
-
9
- ## 1.0.0-beta.0
10
-
11
- ### Major Changes
12
-
13
- - e1befbf: initial release
14
-
15
- ### Patch Changes
16
-
17
- - Updated dependencies [e1befbf]
18
- - @pipelab/plugin-core@1.0.0-beta.0
package/src/ensure.ts DELETED
@@ -1,31 +0,0 @@
1
- import { join } from "node:path";
2
- import { mkdir, access } from "node:fs/promises";
3
- import { constants } from "node:fs";
4
- import { execa } from "execa";
5
-
6
- /**
7
- * Installs NVPatch if not already present.
8
- * @param thirdpartyDir The directory where third-party tools are stored.
9
- * @returns A Promise that resolves to the path of the nvpatch executable.
10
- */
11
- export const ensureNVPatch = async (thirdpartyDir: string) => {
12
- const nvpatchDir = join(thirdpartyDir, "nvpatch");
13
- const isWindows = process.platform === "win32";
14
- const executableName = isWindows ? "nvpatch.exe" : "nvpatch";
15
- const finalPath = join(nvpatchDir, executableName);
16
-
17
- try {
18
- await access(finalPath, constants.X_OK);
19
- return finalPath;
20
- } catch (e) {
21
- console.log(`NVPatch not found at ${finalPath}, installing...`);
22
- }
23
-
24
- await mkdir(nvpatchDir, { recursive: true });
25
-
26
- console.log(`Installing nvpatch via dotnet tool to ${nvpatchDir}...`);
27
- // This assumes 'dotnet' is available in the system PATH.
28
- await execa("dotnet", ["tool", "install", "--tool-path", nvpatchDir, "Topten.nvpatch"]);
29
-
30
- return finalPath;
31
- };
package/src/index.ts DELETED
@@ -1,20 +0,0 @@
1
- import { NVPatch, NVPatchRunner } from "./nvpatch";
2
-
3
- import { createNodeDefinition } from "@pipelab/plugin-core";
4
-
5
- export default createNodeDefinition({
6
- description: "NVPatch",
7
- name: "NVPatch",
8
- id: "nv-patch",
9
- icon: {
10
- type: "icon",
11
- icon: "mdi-wrench",
12
- },
13
- nodes: [
14
- // make and package
15
- {
16
- node: NVPatch,
17
- runner: NVPatchRunner,
18
- },
19
- ],
20
- });
package/src/nvpatch.ts DELETED
@@ -1,87 +0,0 @@
1
- import { execa } from "execa";
2
- import semver from "semver";
3
- import {
4
- createAction,
5
- createActionRunner,
6
- createPathParam,
7
- runWithLiveLogs,
8
- } from "@pipelab/plugin-core";
9
- import { ensureNVPatch } from "./ensure.js";
10
-
11
- export const ID = "nvpatch";
12
-
13
- export const NVPatch = createAction({
14
- id: ID,
15
- name: "Patch binary",
16
- description: "",
17
- icon: "",
18
- displayString: "`Patch binary ${fmt.param(params['input'], 'primary')}`",
19
- meta: {},
20
- params: {
21
- input: createPathParam("", {
22
- required: true,
23
- label: "File to patch",
24
- control: {
25
- type: "path",
26
- options: {
27
- properties: ["openFile"],
28
- },
29
- },
30
- }),
31
- },
32
- outputs: {},
33
- });
34
-
35
- export const NVPatchRunner = createActionRunner<typeof NVPatch>(
36
- async ({ log, inputs, paths, abortSignal, cwd }) => {
37
- const checkDotnetVersion = async (command: string) => {
38
- try {
39
- const { stdout } = await execa(command, ["--version"]);
40
- const version = stdout.trim();
41
- log(`.NET version found: ${version}`);
42
- if (semver.lt(semver.coerce(version) || "0.0.0", "8.0.0")) {
43
- throw new Error(`.NET version 8 or higher is required. Found version ${version}.`);
44
- }
45
- } catch (e: unknown) {
46
- if (e instanceof Error && e.message?.includes(".NET version 8 or higher is required")) {
47
- throw e;
48
- }
49
- throw new Error(
50
- `.NET runtime not found (command: "${command}"). Please ensure .NET 8 or higher is installed.`,
51
- );
52
- }
53
- };
54
-
55
- // run
56
-
57
- log("Ensuring nvpatch is installed...");
58
- const { thirdparty } = paths;
59
- const nvpatchCommand = await ensureNVPatch(thirdparty);
60
-
61
- // Detect platform and set up platform-specific configuration
62
- const isMacOS = process.platform === "darwin";
63
-
64
- if (isMacOS) {
65
- // macOS: Use arch -x86_64 with dotnet runtime if needed,
66
- // but let's try the direct command first as ensureNVPatch should provide a working shim
67
- log("Using nvpatch from", nvpatchCommand);
68
-
69
- // Still need to check dotnet as it's a dependency of the tool
70
- await checkDotnetVersion("dotnet");
71
- } else {
72
- log("Using nvpatch from", nvpatchCommand);
73
- // ensure dotnet runtime is installed
74
- await checkDotnetVersion("dotnet");
75
- }
76
-
77
- await runWithLiveLogs(
78
- nvpatchCommand,
79
- ["--enable", inputs["input"]],
80
- {
81
- cancelSignal: abortSignal,
82
- },
83
- log,
84
- );
85
- log("nvpatch done");
86
- },
87
- );
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "@pipelab/tsconfig/vue.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src"]
8
- }
package/tsdown.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["esm", "cjs"],
6
- dts: true,
7
- clean: true,
8
- loader: {
9
- ".webp": "dataurl",
10
- ".png": "dataurl",
11
- ".jpg": "dataurl",
12
- ".jpeg": "dataurl",
13
- ".svg": "dataurl",
14
- },
15
- });