@altano/repository-tools 0.0.4 → 0.1.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 +15 -0
- package/dist/exec.cjs +38 -0
- package/dist/exec.d.cts +7 -0
- package/dist/exec.d.ts +7 -6
- package/dist/findRoot.cjs +69 -0
- package/dist/findRoot.d.cts +12 -0
- package/dist/findRoot.d.ts +3 -2
- package/dist/findRootSync.cjs +69 -0
- package/dist/findRootSync.d.cts +12 -0
- package/dist/findRootSync.d.ts +3 -2
- package/dist/index.cjs +24 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -3
- package/dist/repositoryCommand.cjs +87 -0
- package/dist/repositoryCommand.d.cts +6 -0
- package/dist/repositoryCommand.d.ts +5 -5
- package/dist/types.cjs +33 -0
- package/dist/types.d.cts +4 -0
- package/dist/types.d.ts +4 -3
- package/package.json +20 -8
package/README.md
CHANGED
|
@@ -26,3 +26,18 @@ Example:
|
|
|
26
26
|
```ts
|
|
27
27
|
await findRoot("/my-git-repo/some/subdirectory"); // => "/my-git-repo"
|
|
28
28
|
```
|
|
29
|
+
|
|
30
|
+
## Importing
|
|
31
|
+
|
|
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")` |
|
|
40
|
+
|
|
41
|
+
## Contributing
|
|
42
|
+
|
|
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.
|
package/dist/exec.cjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
ADDED
package/dist/exec.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 };
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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 };
|
package/dist/findRoot.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @returns null if not found or the path of the repository root as a string
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
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
|
-
|
|
11
|
+
|
|
12
|
+
export { findRoot };
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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/findRootSync.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @returns null if not found or the path of the repository root as a string
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
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
|
-
|
|
11
|
+
|
|
12
|
+
export { findRootSync };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { findRoot } from './findRoot.js';
|
|
2
|
+
export { findRootSync } from './findRootSync.js';
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type RepositoryCommand = "git" | "hg" | "sl" | "svn" | "svnadmin" | "svnrdump";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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
ADDED
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
|
|
2
|
+
type RepositoryType = (typeof repositoryTypes)[number];
|
|
3
|
+
|
|
4
|
+
export { type RepositoryType, repositoryTypes };
|
package/package.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/repository-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Misc tools for dealing with repositories of multiple version control systems (git, svn, etc)",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
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
|
+
},
|
|
7
17
|
"type": "module",
|
|
8
18
|
"sideEffects": false,
|
|
9
19
|
"files": [
|
|
10
20
|
"dist/**/*.js",
|
|
11
|
-
"dist/**/*.
|
|
21
|
+
"dist/**/*.cjs",
|
|
22
|
+
"dist/**/*.d.ts",
|
|
23
|
+
"dist/**/*.d.cts"
|
|
12
24
|
],
|
|
13
25
|
"repository": {
|
|
14
26
|
"type": "git",
|
|
@@ -51,8 +63,7 @@
|
|
|
51
63
|
"access": "public"
|
|
52
64
|
},
|
|
53
65
|
"scripts": {
|
|
54
|
-
"build": "tsup --config build-config/tsup.config.node.ts",
|
|
55
|
-
"build:types": "tsc --project tsconfig.declarations.json",
|
|
66
|
+
"build": "tsup --config build-config/tsup.config.node-hybrid.ts",
|
|
56
67
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
57
68
|
"dev": "pnpm run build --watch",
|
|
58
69
|
"format": "prettier --check src",
|
|
@@ -61,10 +72,11 @@
|
|
|
61
72
|
"lint:fix": "TIMING=1 pnpm lint --fix",
|
|
62
73
|
"lint:timing": "TIMING=1 pnpm lint",
|
|
63
74
|
"test:build": "./tests/scripts/createRepositoryBundles.ts",
|
|
64
|
-
"test:unit": "run-s test:unit:run
|
|
75
|
+
"test:unit": "run-s test:unit:run",
|
|
65
76
|
"test:unit:benchmark": "vitest --run bench",
|
|
66
77
|
"test:unit:run": "vitest --run",
|
|
67
78
|
"test:unit:watch": "vitest",
|
|
68
|
-
"typecheck": "tsc --noEmit"
|
|
79
|
+
"typecheck:src": "tsc --noEmit",
|
|
80
|
+
"typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
|
|
69
81
|
}
|
|
70
82
|
}
|