@altano/repository-tools 0.1.1 → 1.0.1

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # repository-tools
2
2
 
3
+ [![npm](https://badgen.net/npm/v/@altano/repository-tools)](https://www.npmjs.com/package/@altano/repository-tools) ![Typed with TypeScript](https://badgen.net/npm/types/@altano/repository-tools) ![ESM only](https://badgen.net/badge/module/esm%20only?icon=js)
4
+
3
5
  Misc tools for dealing with repositories of multiple version control systems
4
6
 
5
7
  ## Supported Version Control Systems
@@ -29,15 +31,11 @@ await findRoot("/my-git-repo/some/subdirectory"); // => "/my-git-repo"
29
31
 
30
32
  ## Importing
31
33
 
32
- This is a dual ESM/CJS package, and publishes both a top-level module with all exports, and sub-path exports. So feel free to import using any of the following:
33
-
34
- | Your package type | Using sub-path exports | Import to use |
35
- | ----------------- | ---------------------- | ----------------------------------------------------------------------- |
36
- | ESM | No | `import { findRoot } from "@altano/repository-tools";` |
37
- | ESM | Yes | `import { findRoot } from "@altano/repository-tools/findRoot.js";` |
38
- | CJS | No | `const { findRoot } = require("@altano/repository-tools")` |
39
- | CJS | Yes | `const { findRoot } = require("@altano/repository-tools/findSync.cjs")` |
34
+ NOTE: As of v1.0.0 this is an ESM-only module package. It can be imported as an ESM module from any Node.js version but if requiring this package from a CJS package, you must use Node.js v20.19.0+ or v22.12.0+. If you get a `ERR_REQUIRE_ESM` error when calling `require("@altano/repository-tools")` make sure you're on a new enough version of Node.js.
40
35
 
41
- ## Contributing
36
+ You may import all the tools, or import functions directly:
42
37
 
43
- This is a dual ESM/CJS package which is really hard to get right. Manually run `pnpm build && pnpm dlx @arethetypeswrong/cli --pack` before making any changes that would affect the build, packaging, or publishing.
38
+ | Using sub-path exports | Import to use |
39
+ | ---------------------- | ------------------------------------------------------------------ |
40
+ | No | `import { findRoot } from "@altano/repository-tools";` |
41
+ | Yes | `import { findRoot } from "@altano/repository-tools/findRoot.js";` |
package/dist/exec.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import { exec, execFile } from 'child_process';
2
- export { execFileSync, execSync } from 'child_process';
3
-
4
- declare const execAsync: typeof exec.__promisify__;
5
- declare const execFileAsync: typeof execFile.__promisify__;
6
-
7
- export { execAsync, execFileAsync };
1
+ import { exec, execFile } from "child_process";
2
+ export { execSync, execFileSync } from "child_process";
3
+ export declare const execAsync: typeof exec.__promisify__;
4
+ export declare const execFileAsync: typeof execFile.__promisify__;
5
+ //# sourceMappingURL=exec.d.ts.map
@@ -3,10 +3,9 @@
3
3
  *
4
4
  * @returns null if not found or the path of the repository root as a string
5
5
  */
6
- declare function findRoot(
6
+ export declare function findRoot(
7
7
  /**
8
8
  * The directory path of anything in a version-controlled repository
9
9
  */
10
10
  directory: string): Promise<string | null>;
11
-
12
- export { findRoot };
11
+ //# sourceMappingURL=findRoot.d.ts.map
@@ -3,10 +3,9 @@
3
3
  *
4
4
  * @returns null if not found or the path of the repository root as a string
5
5
  */
6
- declare function findRootSync(
6
+ export declare function findRootSync(
7
7
  /**
8
8
  * The directory path of anything in a version-controlled repository
9
9
  */
10
10
  directory: string): string | null;
11
-
12
- export { findRootSync };
11
+ //# sourceMappingURL=findRootSync.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { findRoot } from './findRoot.js';
2
- export { findRootSync } from './findRootSync.js';
1
+ export * from "./findRoot.js";
2
+ export * from "./findRootSync.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  type RepositoryCommand = "git" | "hg" | "sl" | "svn" | "svnadmin" | "svnrdump";
2
- declare function repositoryExec(cwd: string, command: RepositoryCommand, args: readonly string[]): Promise<string>;
3
- declare function repositoryExecSync(cwd: string, command: RepositoryCommand, args: readonly string[]): string;
4
- declare const createExecForDirectory: (cwd: string) => (command: RepositoryCommand, args: readonly string[]) => Promise<string>;
5
-
6
- export { createExecForDirectory, repositoryExec, repositoryExecSync };
2
+ export declare function repositoryExec(cwd: string, command: RepositoryCommand, args: readonly string[]): Promise<string>;
3
+ export declare function repositoryExecSync(cwd: string, command: RepositoryCommand, args: readonly string[]): string;
4
+ export declare const createExecForDirectory: (cwd: string) => ((command: RepositoryCommand, args: readonly string[]) => Promise<string>);
5
+ export {};
6
+ //# sourceMappingURL=repositoryCommand.d.ts.map
@@ -39,7 +39,7 @@ async function repositoryExec(cwd, command, args) {
39
39
  ...environment[command]
40
40
  }
41
41
  }).then(({ stdout, stderr }) => {
42
- return stderr ? Promise.reject(stderr.trim()) : stdout.trim();
42
+ return stderr ? Promise.reject(new Error(stderr.trim())) : stdout.trim();
43
43
  });
44
44
  }
45
45
  function repositoryExecSync(cwd, command, args) {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
- type RepositoryType = (typeof repositoryTypes)[number];
3
-
4
- export { type RepositoryType, repositoryTypes };
1
+ export declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
+ export type RepositoryType = (typeof repositoryTypes)[number];
3
+ //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,33 +1,7 @@
1
1
  {
2
2
  "name": "@altano/repository-tools",
3
- "version": "0.1.1",
3
+ "version": "1.0.1",
4
4
  "description": "Misc tools for dealing with repositories of multiple version control systems (git, svn, etc)",
5
- "main": "./dist/index.cjs",
6
- "module": "./dist/index.js",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
11
- },
12
- "./*": {
13
- "import": "./dist/*",
14
- "require": "./dist/*"
15
- }
16
- },
17
- "type": "module",
18
- "sideEffects": false,
19
- "files": [
20
- "dist/**/*.js",
21
- "dist/**/*.cjs",
22
- "dist/**/*.d.ts",
23
- "dist/**/*.d.cts"
24
- ],
25
- "repository": {
26
- "type": "git",
27
- "url": "https://github.com/altano/npm-packages",
28
- "directory": "packages/repository-tools"
29
- },
30
- "homepage": "https://github.com/altano/npm-packages/tree/main/packages/repository-tools",
31
5
  "keywords": [
32
6
  "repository",
33
7
  "root",
@@ -35,48 +9,69 @@
35
9
  "mercurial",
36
10
  "sapling"
37
11
  ],
12
+ "homepage": "https://github.com/altano/npm-packages/tree/main/packages/repository-tools",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/altano/npm-packages",
16
+ "directory": "packages/repository-tools"
17
+ },
18
+ "license": "ISC",
38
19
  "author": {
39
20
  "name": "Alan Norbauer",
40
21
  "email": "altano@gmail.com",
41
22
  "url": "https://alan.norbauer.com"
42
23
  },
43
- "license": "ISC",
24
+ "sideEffects": false,
25
+ "type": "module",
26
+ "exports": {
27
+ ".": "./dist/index.js",
28
+ "./*": "./dist/*"
29
+ },
30
+ "main": "./dist/index.js",
31
+ "module": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "files": [
34
+ "dist/**/*.js",
35
+ "dist/**/*.d.ts"
36
+ ],
44
37
  "devDependencies": {
45
- "@types/node": "^20.11.25",
46
- "@vitest/coverage-v8": "^1.4.0",
47
- "@vitest/expect": "^1.4.0",
48
- "@vitest/ui": "^1.3.1",
49
- "eslint": "^8.57.0",
38
+ "@arethetypeswrong/cli": "^0.17.4",
39
+ "@types/node": "^22.13.10",
40
+ "@vitest/coverage-v8": "^3.1.1",
41
+ "@vitest/expect": "^3.1.1",
42
+ "depcheck": "^1.4.7",
43
+ "eslint": "^9.23.0",
50
44
  "find-cache-dir": "^5.0.0",
51
45
  "memize": "^2.1.0",
52
- "npm-run-all": "^4.1.5",
53
- "prettier": "^3.2.5",
46
+ "prettier": "^3.5.3",
54
47
  "ts-assert-unreachable": "^0.0.9",
55
- "typescript": "^5.4.2",
56
- "vite": "^5.2.8",
57
- "vitest": "^1.4.0",
48
+ "typescript": "^5.8.2",
49
+ "vite": "^6.2.4",
50
+ "vitest": "^3.1.1",
51
+ "@altano/build-config": "0.0.0",
58
52
  "@altano/tsconfig": "0.0.0",
59
- "@altano/vitest-plugins": "0.1.1",
60
- "eslint-config-altano": "0.0.0"
53
+ "@altano/testing": "0.0.0"
61
54
  },
62
55
  "publishConfig": {
63
56
  "access": "public"
64
57
  },
65
58
  "scripts": {
66
- "build": "tsup --config build-config/tsup.config.node-hybrid.ts",
59
+ "build": "tsup --config build-config/tsup.config.node.ts",
60
+ "build:types": "tsc --project tsconfig.declarations.json",
61
+ "check:exports": "attw --pack . --profile esm-only",
62
+ "check:types:src": "tsc --noEmit",
63
+ "check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
64
+ "check:unused-dependencies": "depcheck",
67
65
  "clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
68
66
  "dev": "pnpm run build --watch",
69
67
  "format": "prettier --check src",
70
68
  "format:fix": "prettier --write src",
71
- "lint": "eslint package.json src/**/*.ts*",
69
+ "lint": "eslint",
72
70
  "lint:fix": "TIMING=1 pnpm lint --fix",
73
71
  "lint:timing": "TIMING=1 pnpm lint",
74
72
  "test:build": "./tests/scripts/createRepositoryBundles.ts",
75
- "test:unit": "run-s test:unit:run",
73
+ "test:unit": "vitest --run",
76
74
  "test:unit:benchmark": "vitest --run bench",
77
- "test:unit:run": "vitest --run",
78
- "test:unit:watch": "vitest",
79
- "typecheck:src": "tsc --noEmit",
80
- "typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
75
+ "test:unit:watch": "vitest"
81
76
  }
82
77
  }
package/dist/exec.cjs DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var exec_exports = {};
20
- __export(exec_exports, {
21
- execAsync: () => execAsync,
22
- execFileAsync: () => execFileAsync,
23
- execFileSync: () => import_child_process2.execFileSync,
24
- execSync: () => import_child_process2.execSync
25
- });
26
- module.exports = __toCommonJS(exec_exports);
27
- var import_child_process = require("child_process");
28
- var import_node_util = require("node:util");
29
- var import_child_process2 = require("child_process");
30
- const execAsync = (0, import_node_util.promisify)(import_child_process.exec);
31
- const execFileAsync = (0, import_node_util.promisify)(import_child_process.execFile);
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- execAsync,
35
- execFileAsync,
36
- execFileSync,
37
- execSync
38
- });
package/dist/exec.d.cts DELETED
@@ -1,7 +0,0 @@
1
- import { exec, execFile } from 'child_process';
2
- export { execFileSync, execSync } from 'child_process';
3
-
4
- declare const execAsync: typeof exec.__promisify__;
5
- declare const execFileAsync: typeof execFile.__promisify__;
6
-
7
- export { execAsync, execFileAsync };
package/dist/findRoot.cjs DELETED
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var findRoot_exports = {};
20
- __export(findRoot_exports, {
21
- findRoot: () => findRoot
22
- });
23
- module.exports = __toCommonJS(findRoot_exports);
24
- var import_repositoryCommand = require("./repositoryCommand.cjs");
25
- async function findGitRoot(directory) {
26
- return (0, import_repositoryCommand.repositoryExec)(directory, "git", [
27
- "rev-parse",
28
- "--quiet",
29
- "--show-toplevel"
30
- ]);
31
- }
32
- async function findSaplingRoot(directory) {
33
- return (0, import_repositoryCommand.repositoryExec)(directory, "sl", ["--quiet", "root"]);
34
- }
35
- async function findMercurialRoot(directory) {
36
- return (0, import_repositoryCommand.repositoryExec)(directory, "hg", ["--quiet", "root"]);
37
- }
38
- async function findSubversionRoot(directory) {
39
- return (0, import_repositoryCommand.repositoryExec)(directory, "svn", ["info", "--show-item", "wc-root"]);
40
- }
41
- const findMethods = [
42
- findGitRoot,
43
- // most used and fastest check
44
- findSubversionRoot,
45
- // next highest market share
46
- findSaplingRoot,
47
- // much smaller market share, but much faster
48
- findMercurialRoot
49
- // slow af
50
- ];
51
- async function findRoot(directory) {
52
- for (const method of findMethods) {
53
- try {
54
- const result = await method(directory);
55
- if (result != null && result !== "") {
56
- return result;
57
- }
58
- } catch (e) {
59
- if (e instanceof Error && "code" in e && e.code === "ENOTDIR") {
60
- throw new Error(`Given path isn't a directory: ${directory}`);
61
- }
62
- }
63
- }
64
- return null;
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- findRoot
69
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Find the root path of the repository containing the given directory.
3
- *
4
- * @returns null if not found or the path of the repository root as a string
5
- */
6
- declare function findRoot(
7
- /**
8
- * The directory path of anything in a version-controlled repository
9
- */
10
- directory: string): Promise<string | null>;
11
-
12
- export { findRoot };
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var findRootSync_exports = {};
20
- __export(findRootSync_exports, {
21
- findRootSync: () => findRootSync
22
- });
23
- module.exports = __toCommonJS(findRootSync_exports);
24
- var import_repositoryCommand = require("./repositoryCommand.cjs");
25
- function findGitRoot(cwd) {
26
- return (0, import_repositoryCommand.repositoryExecSync)(cwd, "git", [
27
- "rev-parse",
28
- "--quiet",
29
- "--show-toplevel"
30
- ]);
31
- }
32
- function findSaplingRoot(cwd) {
33
- return (0, import_repositoryCommand.repositoryExecSync)(cwd, "sl", ["--quiet", "root"]);
34
- }
35
- function findMercurialRoot(cwd) {
36
- return (0, import_repositoryCommand.repositoryExecSync)(cwd, "hg", ["--quiet", "root"]);
37
- }
38
- function findSubversionRoot(cwd) {
39
- return (0, import_repositoryCommand.repositoryExecSync)(cwd, "svn", ["info", "--show-item", "wc-root"]);
40
- }
41
- const findMethods = [
42
- findGitRoot,
43
- // most used and fastest check
44
- findSubversionRoot,
45
- // next highest market share
46
- findSaplingRoot,
47
- // much smaller market share, but much faster
48
- findMercurialRoot
49
- // slow af
50
- ];
51
- function findRootSync(directory) {
52
- for (const method of findMethods) {
53
- try {
54
- const result = method(directory);
55
- if (result != null && result !== "") {
56
- return result;
57
- }
58
- } catch (e) {
59
- if (e instanceof Error && "code" in e && e.code === "ENOTDIR") {
60
- throw new Error(`Given path isn't a directory: ${directory}`);
61
- }
62
- }
63
- }
64
- return null;
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- findRootSync
69
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Find the root path of the repository containing the given directory.
3
- *
4
- * @returns null if not found or the path of the repository root as a string
5
- */
6
- declare function findRootSync(
7
- /**
8
- * The directory path of anything in a version-controlled repository
9
- */
10
- directory: string): string | null;
11
-
12
- export { findRootSync };
package/dist/index.cjs DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var src_exports = {};
17
- module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./findRoot.cjs"), module.exports);
19
- __reExport(src_exports, require("./findRootSync.cjs"), module.exports);
20
- // Annotate the CommonJS export names for ESM import in node:
21
- 0 && (module.exports = {
22
- ...require("./findRoot.cjs"),
23
- ...require("./findRootSync.cjs")
24
- });
package/dist/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export { findRoot } from './findRoot.cjs';
2
- export { findRootSync } from './findRootSync.cjs';
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var repositoryCommand_exports = {};
20
- __export(repositoryCommand_exports, {
21
- createExecForDirectory: () => createExecForDirectory,
22
- repositoryExec: () => repositoryExec,
23
- repositoryExecSync: () => repositoryExecSync
24
- });
25
- module.exports = __toCommonJS(repositoryCommand_exports);
26
- var import_exec = require("./exec.cjs");
27
- const environment = {
28
- git: {
29
- // non-interactive
30
- GIT_TERMINAL_PROMPT: "0",
31
- // don't use global config
32
- GIT_CONFIG_GLOBAL: "/dev/null",
33
- GIT_CONFIG_SYSTEM: "/dev/null",
34
- // user config
35
- GIT_COMMITTER_NAME: "alan",
36
- GIT_COMMITTER_EMAIL: "alan@example.com",
37
- GIT_AUTHOR_NAME: "alan",
38
- GIT_AUTHOR_EMAIL: "alan@example.com"
39
- },
40
- hg: {
41
- // don't use global config
42
- HGRCPATH: "/dev/null",
43
- // don't use global config
44
- HGUSER: "alan",
45
- EMAIL: "alan@example.com"
46
- },
47
- sl: {
48
- // don't use global config
49
- HGRCPATH: "/dev/null",
50
- // don't use global config
51
- HGUSER: "alan",
52
- EMAIL: "alan@example.com"
53
- },
54
- svn: {},
55
- svnadmin: {},
56
- svnrdump: {}
57
- };
58
- async function repositoryExec(cwd, command, args) {
59
- return (0, import_exec.execFileAsync)(command, args, {
60
- cwd,
61
- encoding: "utf8",
62
- env: {
63
- ...process.env,
64
- ...environment[command]
65
- }
66
- }).then(({ stdout, stderr }) => {
67
- return stderr ? Promise.reject(stderr.trim()) : stdout.trim();
68
- });
69
- }
70
- function repositoryExecSync(cwd, command, args) {
71
- const result = (0, import_exec.execFileSync)(command, args, {
72
- cwd,
73
- encoding: "utf8",
74
- env: {
75
- ...process.env,
76
- ...environment[command]
77
- }
78
- }).trim();
79
- return result;
80
- }
81
- const createExecForDirectory = (cwd) => repositoryExec.bind(null, cwd);
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
84
- createExecForDirectory,
85
- repositoryExec,
86
- repositoryExecSync
87
- });
@@ -1,6 +0,0 @@
1
- type RepositoryCommand = "git" | "hg" | "sl" | "svn" | "svnadmin" | "svnrdump";
2
- declare function repositoryExec(cwd: string, command: RepositoryCommand, args: readonly string[]): Promise<string>;
3
- declare function repositoryExecSync(cwd: string, command: RepositoryCommand, args: readonly string[]): string;
4
- declare const createExecForDirectory: (cwd: string) => (command: RepositoryCommand, args: readonly string[]) => Promise<string>;
5
-
6
- export { createExecForDirectory, repositoryExec, repositoryExecSync };
package/dist/types.cjs DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var types_exports = {};
20
- __export(types_exports, {
21
- repositoryTypes: () => repositoryTypes
22
- });
23
- module.exports = __toCommonJS(types_exports);
24
- const repositoryTypes = [
25
- "git",
26
- "mercurial",
27
- "sapling",
28
- "subversion"
29
- ];
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- repositoryTypes
33
- });
package/dist/types.d.cts DELETED
@@ -1,4 +0,0 @@
1
- declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
- type RepositoryType = (typeof repositoryTypes)[number];
3
-
4
- export { type RepositoryType, repositoryTypes };