@altano/repository-tools 0.1.0 → 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.
Files changed (34) hide show
  1. package/README.md +15 -0
  2. package/dist/exec.d.cts +7 -0
  3. package/dist/exec.d.ts +7 -0
  4. package/dist/{cjs/findRoot.js → findRoot.cjs} +1 -1
  5. package/dist/{cjs/findRoot.d.ts → findRoot.d.cts} +3 -2
  6. package/dist/{esm/findRoot.d.ts → findRoot.d.ts} +3 -2
  7. package/dist/{cjs/findRootSync.js → findRootSync.cjs} +1 -1
  8. package/dist/{esm/findRootSync.d.ts → findRootSync.d.cts} +3 -2
  9. package/dist/{cjs/findRootSync.d.ts → findRootSync.d.ts} +3 -2
  10. package/dist/{cjs/index.js → index.cjs} +4 -4
  11. package/dist/index.d.cts +2 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/{cjs/repositoryCommand.js → repositoryCommand.cjs} +1 -1
  14. package/dist/repositoryCommand.d.cts +6 -0
  15. package/dist/repositoryCommand.d.ts +6 -0
  16. package/dist/types.d.cts +4 -0
  17. package/dist/types.d.ts +4 -0
  18. package/package.json +10 -10
  19. package/dist/cjs/exec.d.ts +0 -6
  20. package/dist/cjs/index.d.ts +0 -3
  21. package/dist/cjs/repositoryCommand.d.ts +0 -6
  22. package/dist/cjs/types.d.ts +0 -3
  23. package/dist/esm/exec.d.ts +0 -6
  24. package/dist/esm/index.d.ts +0 -3
  25. package/dist/esm/repositoryCommand.d.ts +0 -6
  26. package/dist/esm/types.d.ts +0 -3
  27. /package/dist/{cjs/exec.js → exec.cjs} +0 -0
  28. /package/dist/{esm/exec.js → exec.js} +0 -0
  29. /package/dist/{esm/findRoot.js → findRoot.js} +0 -0
  30. /package/dist/{esm/findRootSync.js → findRootSync.js} +0 -0
  31. /package/dist/{esm/index.js → index.js} +0 -0
  32. /package/dist/{esm/repositoryCommand.js → repositoryCommand.js} +0 -0
  33. /package/dist/{cjs/types.js → types.cjs} +0 -0
  34. /package/dist/{esm/types.js → types.js} +0 -0
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.
@@ -0,0 +1,7 @@
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/exec.d.ts ADDED
@@ -0,0 +1,7 @@
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 };
@@ -21,7 +21,7 @@ __export(findRoot_exports, {
21
21
  findRoot: () => findRoot
22
22
  });
23
23
  module.exports = __toCommonJS(findRoot_exports);
24
- var import_repositoryCommand = require("./repositoryCommand.js");
24
+ var import_repositoryCommand = require("./repositoryCommand.cjs");
25
25
  async function findGitRoot(directory) {
26
26
  return (0, import_repositoryCommand.repositoryExec)(directory, "git", [
27
27
  "rev-parse",
@@ -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
- export declare function findRoot(
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
- //# sourceMappingURL=findRoot.d.ts.map
11
+
12
+ export { findRoot };
@@ -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
- export declare function findRoot(
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
- //# sourceMappingURL=findRoot.d.ts.map
11
+
12
+ export { findRoot };
@@ -21,7 +21,7 @@ __export(findRootSync_exports, {
21
21
  findRootSync: () => findRootSync
22
22
  });
23
23
  module.exports = __toCommonJS(findRootSync_exports);
24
- var import_repositoryCommand = require("./repositoryCommand.js");
24
+ var import_repositoryCommand = require("./repositoryCommand.cjs");
25
25
  function findGitRoot(cwd) {
26
26
  return (0, import_repositoryCommand.repositoryExecSync)(cwd, "git", [
27
27
  "rev-parse",
@@ -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
- export declare function findRootSync(
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
- //# sourceMappingURL=findRootSync.d.ts.map
11
+
12
+ export { findRootSync };
@@ -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
- export declare function findRootSync(
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
- //# sourceMappingURL=findRootSync.d.ts.map
11
+
12
+ export { findRootSync };
@@ -15,10 +15,10 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var src_exports = {};
17
17
  module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./findRoot.js"), module.exports);
19
- __reExport(src_exports, require("./findRootSync.js"), module.exports);
18
+ __reExport(src_exports, require("./findRoot.cjs"), module.exports);
19
+ __reExport(src_exports, require("./findRootSync.cjs"), module.exports);
20
20
  // Annotate the CommonJS export names for ESM import in node:
21
21
  0 && (module.exports = {
22
- ...require("./findRoot.js"),
23
- ...require("./findRootSync.js")
22
+ ...require("./findRoot.cjs"),
23
+ ...require("./findRootSync.cjs")
24
24
  });
@@ -0,0 +1,2 @@
1
+ export { findRoot } from './findRoot.cjs';
2
+ export { findRootSync } from './findRootSync.cjs';
@@ -0,0 +1,2 @@
1
+ export { findRoot } from './findRoot.js';
2
+ export { findRootSync } from './findRootSync.js';
@@ -23,7 +23,7 @@ __export(repositoryCommand_exports, {
23
23
  repositoryExecSync: () => repositoryExecSync
24
24
  });
25
25
  module.exports = __toCommonJS(repositoryCommand_exports);
26
- var import_exec = require("./exec.js");
26
+ var import_exec = require("./exec.cjs");
27
27
  const environment = {
28
28
  git: {
29
29
  // non-interactive
@@ -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 };
@@ -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 };
@@ -0,0 +1,4 @@
1
+ declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
+ type RepositoryType = (typeof repositoryTypes)[number];
3
+
4
+ export { type RepositoryType, repositoryTypes };
@@ -0,0 +1,4 @@
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,24 +1,26 @@
1
1
  {
2
2
  "name": "@altano/repository-tools",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Misc tools for dealing with repositories of multiple version control systems (git, svn, etc)",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.js",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./dist/esm/index.js",
10
- "require": "./dist/cjs/index.js"
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.cjs"
11
11
  },
12
12
  "./*": {
13
- "import": "./dist/esm/*.js",
14
- "require": "./dist/cjs/*.js"
13
+ "import": "./dist/*",
14
+ "require": "./dist/*"
15
15
  }
16
16
  },
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "files": [
20
20
  "dist/**/*.js",
21
- "dist/**/*.d.ts"
21
+ "dist/**/*.cjs",
22
+ "dist/**/*.d.ts",
23
+ "dist/**/*.d.cts"
22
24
  ],
23
25
  "repository": {
24
26
  "type": "git",
@@ -62,8 +64,6 @@
62
64
  },
63
65
  "scripts": {
64
66
  "build": "tsup --config build-config/tsup.config.node-hybrid.ts",
65
- "build:types:cjs": "tsc --project tsconfig.declarations-cjs.json",
66
- "build:types:esm": "tsc --project tsconfig.declarations-esm.json",
67
67
  "clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
68
68
  "dev": "pnpm run build --watch",
69
69
  "format": "prettier --check src",
@@ -1,6 +0,0 @@
1
- /// <reference types="node" />
2
- import { exec, execFile } from "child_process";
3
- export { execSync, execFileSync } from "child_process";
4
- export declare const execAsync: typeof exec.__promisify__;
5
- export declare const execFileAsync: typeof execFile.__promisify__;
6
- //# sourceMappingURL=exec.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from "./findRoot.js";
2
- export * from "./findRootSync.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- type RepositoryCommand = "git" | "hg" | "sl" | "svn" | "svnadmin" | "svnrdump";
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
@@ -1,3 +0,0 @@
1
- export declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
- export type RepositoryType = (typeof repositoryTypes)[number];
3
- //# sourceMappingURL=types.d.ts.map
@@ -1,6 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { exec, execFile } from "child_process";
3
- export { execSync, execFileSync } from "child_process";
4
- export declare const execAsync: typeof exec.__promisify__;
5
- export declare const execFileAsync: typeof execFile.__promisify__;
6
- //# sourceMappingURL=exec.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from "./findRoot.js";
2
- export * from "./findRootSync.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- type RepositoryCommand = "git" | "hg" | "sl" | "svn" | "svnadmin" | "svnrdump";
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
@@ -1,3 +0,0 @@
1
- export declare const repositoryTypes: readonly ["git", "mercurial", "sapling", "subversion"];
2
- export type RepositoryType = (typeof repositoryTypes)[number];
3
- //# sourceMappingURL=types.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes