ocx-cursor 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/install.mjs +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocx-cursor",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "OpenCodex companion service for Cursor custom models",
5
5
  "keywords": [
6
6
  "opencodex",
package/src/install.mjs CHANGED
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { access, chmod, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
4
4
  import { tmpdir } from "node:os";
5
- import { dirname, join, resolve } from "node:path";
5
+ import { dirname, join, relative, resolve, sep } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import {
8
8
  cliLinkFile,
@@ -98,13 +98,18 @@ export async function prepareInstallSecret() {
98
98
  };
99
99
  }
100
100
 
101
+ export function shouldCopyPackagePath(source, packageRoot = sourcePackageRoot) {
102
+ const segments = relative(packageRoot, source).split(sep);
103
+ return !segments.includes("node_modules") && !segments.includes(".git");
104
+ }
105
+
101
106
  async function copyPackage() {
102
107
  if (resolve(sourcePackageRoot) === resolve(installedPackageRoot)) return;
103
108
  const temporary = `${installedPackageRoot}.tmp-${process.pid}`;
104
109
  await rm(temporary, { recursive: true, force: true });
105
110
  await cp(sourcePackageRoot, temporary, {
106
111
  recursive: true,
107
- filter: (source) => !source.includes("/node_modules/") && !source.includes("/.git/"),
112
+ filter: (source) => shouldCopyPackagePath(source),
108
113
  });
109
114
  await rm(installedPackageRoot, { recursive: true, force: true });
110
115
  await rename(temporary, installedPackageRoot);