hsync-cli 1.1.6 → 1.1.8

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/dist/bin.js +22 -7
  2. package/package.json +4 -1
package/dist/bin.js CHANGED
@@ -68316,10 +68316,12 @@ class LocalScanner {
68316
68316
  excludePatterns;
68317
68317
  respectGitignore;
68318
68318
  ignoreRules;
68319
+ includeBases;
68319
68320
  constructor(localPath, filePatterns, excludePatterns, respectGitignore = false) {
68320
68321
  this.localPath = localPath;
68321
68322
  this.filePatterns = filePatterns || [];
68322
68323
  this.excludePatterns = excludePatterns || [];
68324
+ this.includeBases = this.filePatterns.map((p) => import_micromatch.default.scan(p).base);
68323
68325
  this.respectGitignore = respectGitignore;
68324
68326
  this.ignoreRules = respectGitignore ? [{ base: "", glob: "**/.git", negate: false, dirOnly: true }] : [];
68325
68327
  }
@@ -68355,7 +68357,15 @@ class LocalScanner {
68355
68357
  return results;
68356
68358
  }
68357
68359
  async walk(dirPath, results) {
68358
- const entries = await fs2.readdir(dirPath, { withFileTypes: true });
68360
+ let entries;
68361
+ try {
68362
+ entries = await fs2.readdir(dirPath, { withFileTypes: true });
68363
+ } catch (err) {
68364
+ if (err.code !== "EACCES" && err.code !== "EPERM")
68365
+ throw err;
68366
+ console.warn(`[LocalScanner] Skipping unreadable folder: ${dirPath}`);
68367
+ return;
68368
+ }
68359
68369
  if (this.respectGitignore && entries.some((e) => e.isFile() && e.name === ".gitignore")) {
68360
68370
  this.ignoreRules.push(...parseGitignore(await fs2.readFile(path3.join(dirPath, ".gitignore"), "utf8"), path3.relative(this.localPath, dirPath).split(path3.sep).join("/")));
68361
68371
  }
@@ -68363,7 +68373,11 @@ class LocalScanner {
68363
68373
  const fullPath = path3.join(dirPath, entry.name);
68364
68374
  const relativePath = path3.relative(this.localPath, fullPath);
68365
68375
  if (entry.isDirectory()) {
68366
- if (!matchesRules(this.ignoreRules, relativePath.split(path3.sep).join("/"), true)) {
68376
+ const dir = relativePath.split(path3.sep).join("/");
68377
+ if (this.includeBases.length > 0 && !this.includeBases.some((b) => b === "" || b === dir || b.startsWith(dir + "/") || dir.startsWith(b + "/"))) {
68378
+ continue;
68379
+ }
68380
+ if (!matchesRules(this.ignoreRules, dir, true)) {
68367
68381
  await this.walk(fullPath, results);
68368
68382
  }
68369
68383
  continue;
@@ -69076,7 +69090,7 @@ async function configureAutostart(enable) {
69076
69090
  await fs5.mkdir(autostartDir, { recursive: true });
69077
69091
  const content = `[Desktop Entry]
69078
69092
  Type=Application
69079
- Exec=hsync sync start --daemon
69093
+ Exec=bash -ic "hsync sync start --daemon"
69080
69094
  Hidden=false
69081
69095
  NoDisplay=false
69082
69096
  X-GNOME-Autostart-enabled=true
@@ -69084,7 +69098,6 @@ Name=hsync Autostart Daemon
69084
69098
  Comment=Start hsync background synchronization daemon on login
69085
69099
  `;
69086
69100
  await fs5.writeFile(desktopFile, content, "utf8");
69087
- await fs5.chmod(desktopFile, 493);
69088
69101
  console.log(source_default.green("✔ Autostart successfully enabled!"));
69089
69102
  console.log(`Created autostart entry: ${desktopFile}`);
69090
69103
  } else {
@@ -71010,7 +71023,7 @@ async function configureAutostart2(enable) {
71010
71023
  await fs7.mkdir(autostartDir, { recursive: true });
71011
71024
  const content = `[Desktop Entry]
71012
71025
  Type=Application
71013
- Exec=hsync sync start --daemon
71026
+ Exec=bash -ic "hsync sync start --daemon"
71014
71027
  Hidden=false
71015
71028
  NoDisplay=false
71016
71029
  X-GNOME-Autostart-enabled=true
@@ -71018,7 +71031,6 @@ Name=hsync Autostart Daemon
71018
71031
  Comment=Start hsync background synchronization daemon on login
71019
71032
  `;
71020
71033
  await fs7.writeFile(desktopFile, content, "utf8");
71021
- await fs7.chmod(desktopFile, 493);
71022
71034
  console.log(source_default.green("✔ Autostart successfully enabled!"));
71023
71035
  console.log(`Created autostart entry: ${desktopFile}`);
71024
71036
  } else {
@@ -71504,7 +71516,7 @@ Press Ctrl+C to stop the server...
71504
71516
  // package.json
71505
71517
  var package_default = {
71506
71518
  name: "hsync-cli",
71507
- version: "1.1.6",
71519
+ version: "1.1.8",
71508
71520
  description: "hsync CLI for file sync operations",
71509
71521
  bin: {
71510
71522
  hsync: "./dist/bin.js"
@@ -71514,6 +71526,9 @@ var package_default = {
71514
71526
  "dist/web"
71515
71527
  ],
71516
71528
  main: "./src/index.ts",
71529
+ engines: {
71530
+ bun: ">=1.0"
71531
+ },
71517
71532
  scripts: {
71518
71533
  dev: "bun --watch src/index.ts",
71519
71534
  build: `bun build src/index.ts --compile --define "process.env.DEFAULT_SERVER_URL='https://hsync-backend.giftsh.in'" --outfile dist/hsync`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsync-cli",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "hsync CLI for file sync operations",
5
5
  "bin": {
6
6
  "hsync": "./dist/bin.js"
@@ -10,6 +10,9 @@
10
10
  "dist/web"
11
11
  ],
12
12
  "main": "./src/index.ts",
13
+ "engines": {
14
+ "bun": ">=1.0"
15
+ },
13
16
  "scripts": {
14
17
  "dev": "bun --watch src/index.ts",
15
18
  "build": "bun build src/index.ts --compile --define \"process.env.DEFAULT_SERVER_URL='https://hsync-backend.giftsh.in'\" --outfile dist/hsync",