bingo-systems 0.2.0

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 (144) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +13 -0
  3. package/lib/createOfflineFetchers.d.ts +2 -0
  4. package/lib/createOfflineFetchers.js +7 -0
  5. package/lib/createOfflineFetchers.js.map +1 -0
  6. package/lib/createOfflineFetchers.test.d.ts +1 -0
  7. package/lib/createOfflineFetchers.test.js +9 -0
  8. package/lib/createOfflineFetchers.test.js.map +1 -0
  9. package/lib/createReadingFileSystem.d.ts +3 -0
  10. package/lib/createReadingFileSystem.d.ts.map +1 -0
  11. package/lib/createReadingFileSystem.js +8 -0
  12. package/lib/createReadingFileSystem.js.map +1 -0
  13. package/lib/createSystemDisplay.d.ts +2 -0
  14. package/lib/createSystemDisplay.js +13 -0
  15. package/lib/createSystemDisplay.js.map +1 -0
  16. package/lib/createSystemFetchers copy.d.ts +6 -0
  17. package/lib/createSystemFetchers copy.js +11 -0
  18. package/lib/createSystemFetchers copy.js.map +1 -0
  19. package/lib/createSystemFetchers.d.ts +7 -0
  20. package/lib/createSystemFetchers.d.ts.map +1 -0
  21. package/lib/createSystemFetchers.js +11 -0
  22. package/lib/createSystemFetchers.js.map +1 -0
  23. package/lib/createSystemFetchersOffline copy.d.ts +2 -0
  24. package/lib/createSystemFetchersOffline copy.js +7 -0
  25. package/lib/createSystemFetchersOffline copy.js.map +1 -0
  26. package/lib/createSystemFetchersOffline.d.ts +3 -0
  27. package/lib/createSystemFetchersOffline.d.ts.map +1 -0
  28. package/lib/createSystemFetchersOffline.js +7 -0
  29. package/lib/createSystemFetchersOffline.js.map +1 -0
  30. package/lib/createSystemFetchersOffline.test.d.ts +2 -0
  31. package/lib/createSystemFetchersOffline.test.d.ts.map +1 -0
  32. package/lib/createSystemFetchersOffline.test.js +9 -0
  33. package/lib/createSystemFetchersOffline.test.js.map +1 -0
  34. package/lib/createSystemFetchersWithAuth.d.ts +4 -0
  35. package/lib/createSystemFetchersWithAuth.d.ts.map +1 -0
  36. package/lib/createSystemFetchersWithAuth.js +10 -0
  37. package/lib/createSystemFetchersWithAuth.js.map +1 -0
  38. package/lib/createSystemRunner.d.ts +3 -0
  39. package/lib/createSystemRunner.d.ts.map +1 -0
  40. package/lib/createSystemRunner.js +6 -0
  41. package/lib/createSystemRunner.js.map +1 -0
  42. package/lib/createWritingFileSystem.d.ts +8 -0
  43. package/lib/createWritingFileSystem.d.ts.map +1 -0
  44. package/lib/createWritingFileSystem.js +12 -0
  45. package/lib/createWritingFileSystem.js.map +1 -0
  46. package/lib/createWritingFileSystem.test.d.ts +2 -0
  47. package/lib/createWritingFileSystem.test.d.ts.map +1 -0
  48. package/lib/createWritingFileSystem.test.js +46 -0
  49. package/lib/createWritingFileSystem.test.js.map +1 -0
  50. package/lib/fetchers/createSystemFetchers.d.ts +7 -0
  51. package/lib/fetchers/createSystemFetchers.d.ts.map +1 -0
  52. package/lib/fetchers/createSystemFetchers.js +11 -0
  53. package/lib/fetchers/createSystemFetchers.js.map +1 -0
  54. package/lib/fetchers/createSystemFetchersOffline.d.ts +3 -0
  55. package/lib/fetchers/createSystemFetchersOffline.d.ts.map +1 -0
  56. package/lib/fetchers/createSystemFetchersOffline.js +7 -0
  57. package/lib/fetchers/createSystemFetchersOffline.js.map +1 -0
  58. package/lib/fetchers/createSystemFetchersOffline.test.d.ts +2 -0
  59. package/lib/fetchers/createSystemFetchersOffline.test.d.ts.map +1 -0
  60. package/lib/fetchers/createSystemFetchersOffline.test.js +9 -0
  61. package/lib/fetchers/createSystemFetchersOffline.test.js.map +1 -0
  62. package/lib/fetchers/createSystemFetchersWithAuth.d.ts +4 -0
  63. package/lib/fetchers/createSystemFetchersWithAuth.d.ts.map +1 -0
  64. package/lib/fetchers/createSystemFetchersWithAuth.js +10 -0
  65. package/lib/fetchers/createSystemFetchersWithAuth.js.map +1 -0
  66. package/lib/fetchers/fetchers.d.ts +6 -0
  67. package/lib/fetchers/fetchers.d.ts.map +1 -0
  68. package/lib/fetchers/fetchers.js +2 -0
  69. package/lib/fetchers/fetchers.js.map +1 -0
  70. package/lib/fetchers/types.d.ts +6 -0
  71. package/lib/fetchers/types.d.ts.map +1 -0
  72. package/lib/fetchers/types.js +2 -0
  73. package/lib/fetchers/types.js.map +1 -0
  74. package/lib/files/createReadingFileSystem.d.ts +3 -0
  75. package/lib/files/createReadingFileSystem.d.ts.map +1 -0
  76. package/lib/files/createReadingFileSystem.js +8 -0
  77. package/lib/files/createReadingFileSystem.js.map +1 -0
  78. package/lib/files/createWritingFileSystem.d.ts +8 -0
  79. package/lib/files/createWritingFileSystem.d.ts.map +1 -0
  80. package/lib/files/createWritingFileSystem.js +12 -0
  81. package/lib/files/createWritingFileSystem.js.map +1 -0
  82. package/lib/files/createWritingFileSystem.test.d.ts +2 -0
  83. package/lib/files/createWritingFileSystem.test.d.ts.map +1 -0
  84. package/lib/files/createWritingFileSystem.test.js +46 -0
  85. package/lib/files/createWritingFileSystem.test.js.map +1 -0
  86. package/lib/files/fs.d.ts +20 -0
  87. package/lib/files/fs.d.ts.map +1 -0
  88. package/lib/files/fs.js +2 -0
  89. package/lib/files/fs.js.map +1 -0
  90. package/lib/files/types.d.ts +20 -0
  91. package/lib/files/types.d.ts.map +1 -0
  92. package/lib/files/types.js +2 -0
  93. package/lib/files/types.js.map +1 -0
  94. package/lib/fs/createReadingFileSystem.d.ts +3 -0
  95. package/lib/fs/createReadingFileSystem.d.ts.map +1 -0
  96. package/lib/fs/createReadingFileSystem.js +8 -0
  97. package/lib/fs/createReadingFileSystem.js.map +1 -0
  98. package/lib/index.d.ts +11 -0
  99. package/lib/index.d.ts.map +1 -0
  100. package/lib/index.js +11 -0
  101. package/lib/index.js.map +1 -0
  102. package/lib/runner/createSystemRunner.d.ts +3 -0
  103. package/lib/runner/createSystemRunner.d.ts.map +1 -0
  104. package/lib/runner/createSystemRunner.js +6 -0
  105. package/lib/runner/createSystemRunner.js.map +1 -0
  106. package/lib/runner/createSystemRunner.test.d.ts +2 -0
  107. package/lib/runner/createSystemRunner.test.d.ts.map +1 -0
  108. package/lib/runner/createSystemRunner.test.js +31 -0
  109. package/lib/runner/createSystemRunner.test.js.map +1 -0
  110. package/lib/runner/createWritingFileSystem.test.d.ts +2 -0
  111. package/lib/runner/createWritingFileSystem.test.d.ts.map +1 -0
  112. package/lib/runner/createWritingFileSystem.test.js +46 -0
  113. package/lib/runner/createWritingFileSystem.test.js.map +1 -0
  114. package/lib/runner/runner.d.ts +3 -0
  115. package/lib/runner/runner.d.ts.map +1 -0
  116. package/lib/runner/runner.js +2 -0
  117. package/lib/runner/runner.js.map +1 -0
  118. package/lib/runners/runner.d.ts +3 -0
  119. package/lib/runners/runner.d.ts.map +1 -0
  120. package/lib/runners/runner.js +2 -0
  121. package/lib/runners/runner.js.map +1 -0
  122. package/lib/system.d.ts +1 -0
  123. package/lib/system.js +2 -0
  124. package/lib/system.js.map +1 -0
  125. package/lib/types/fetchers.d.ts +6 -0
  126. package/lib/types/fetchers.d.ts.map +1 -0
  127. package/lib/types/fetchers.js +2 -0
  128. package/lib/types/fetchers.js.map +1 -0
  129. package/lib/types/fs.d.ts +20 -0
  130. package/lib/types/fs.d.ts.map +1 -0
  131. package/lib/types/fs.js +2 -0
  132. package/lib/types/fs.js.map +1 -0
  133. package/lib/types/runner.d.ts +3 -0
  134. package/lib/types/runner.d.ts.map +1 -0
  135. package/lib/types/runner.js +2 -0
  136. package/lib/types/runner.js.map +1 -0
  137. package/lib/types/system.d.ts +9 -0
  138. package/lib/types/system.d.ts.map +1 -0
  139. package/lib/types/system.js +2 -0
  140. package/lib/types/system.js.map +1 -0
  141. package/lib/types.d.ts +40 -0
  142. package/lib/types.js +2 -0
  143. package/lib/types.js.map +1 -0
  144. package/package.json +38 -0
@@ -0,0 +1,46 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { createWritingFileSystem } from "./createWritingFileSystem.js";
3
+ const mockMkdir = vi.fn();
4
+ const mockWriteFile = vi.fn();
5
+ vi.mock("node:fs/promises", () => ({
6
+ get mkdir() {
7
+ return mockMkdir;
8
+ },
9
+ get writeFile() {
10
+ return mockWriteFile;
11
+ },
12
+ }));
13
+ const contents = "abc123";
14
+ const directoryPath = "path/to/file";
15
+ const filePath = "path/to/file";
16
+ describe("createWritingFileSystem", () => {
17
+ describe("writeDirectory", () => {
18
+ it("writes with recursive: true", async () => {
19
+ const system = createWritingFileSystem();
20
+ await system.writeDirectory(directoryPath);
21
+ expect(mockMkdir).toHaveBeenCalledWith(directoryPath, {
22
+ recursive: true,
23
+ });
24
+ });
25
+ });
26
+ describe("writeFile", () => {
27
+ it("writes without mode when options does not exist", async () => {
28
+ const system = createWritingFileSystem();
29
+ await system.writeFile(filePath, contents);
30
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, undefined);
31
+ });
32
+ it("writes without mode when options.executable is false", async () => {
33
+ const system = createWritingFileSystem();
34
+ await system.writeFile(filePath, contents, { executable: false });
35
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, undefined);
36
+ });
37
+ it("writes with mode 0x755 when options.executable is true", async () => {
38
+ const system = createWritingFileSystem();
39
+ await system.writeFile(filePath, contents, { executable: true });
40
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, {
41
+ mode: 0x755,
42
+ });
43
+ });
44
+ });
45
+ });
46
+ //# sourceMappingURL=createWritingFileSystem.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWritingFileSystem.test.js","sourceRoot":"","sources":["../../src/files/createWritingFileSystem.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAC1B,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE9B,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC;IAClC,IAAI,KAAK;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,SAAS;QACZ,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC,CAAC,CAAC;AAEJ,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAC1B,MAAM,aAAa,GAAG,cAAc,CAAC;AACrC,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEhC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAE3C,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,aAAa,EAAE;gBACrD,SAAS,EAAE,IAAI;aACf,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;YAChE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAE3C,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;YAElE,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;YACvE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YAEjE,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBAC9D,IAAI,EAAE,KAAK;aACX,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ export interface DirectoryChild {
2
+ name: string;
3
+ type: "directory" | "file";
4
+ }
5
+ export type ReadDirectory = (filePath: string) => Promise<string[]>;
6
+ export type ReadFile = (filePath: string) => Promise<string>;
7
+ export interface ReadingFileSystem {
8
+ readDirectory: ReadDirectory;
9
+ readFile: ReadFile;
10
+ }
11
+ export type WriteDirectory = (directoryPath: string) => Promise<void>;
12
+ export type WriteFile = (filePath: string, contents: string, options?: WriteFileOptions) => Promise<void>;
13
+ export interface WriteFileOptions {
14
+ executable?: boolean;
15
+ }
16
+ export interface WritingFileSystem extends ReadingFileSystem {
17
+ writeDirectory: WriteDirectory;
18
+ writeFile: WriteFile;
19
+ }
20
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/files/fs.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAEpE,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC3D,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/files/fs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ export interface DirectoryChild {
2
+ name: string;
3
+ type: "directory" | "file";
4
+ }
5
+ export type ReadDirectory = (filePath: string) => Promise<string[]>;
6
+ export type ReadFile = (filePath: string) => Promise<string>;
7
+ export interface ReadingFileSystem {
8
+ readDirectory: ReadDirectory;
9
+ readFile: ReadFile;
10
+ }
11
+ export type WriteDirectory = (directoryPath: string) => Promise<void>;
12
+ export type WriteFile = (filePath: string, contents: string, options?: WriteFileOptions) => Promise<void>;
13
+ export interface WriteFileOptions {
14
+ executable?: boolean;
15
+ }
16
+ export interface WritingFileSystem extends ReadingFileSystem {
17
+ writeDirectory: WriteDirectory;
18
+ writeFile: WriteFile;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/files/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAEpE,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC3D,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/files/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ReadingFileSystem } from "../types/fs.js";
2
+ export declare function createReadingFileSystem(): ReadingFileSystem;
3
+ //# sourceMappingURL=createReadingFileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createReadingFileSystem.d.ts","sourceRoot":"","sources":["../../src/fs/createReadingFileSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,wBAAgB,uBAAuB,IAAI,iBAAiB,CAM3D"}
@@ -0,0 +1,8 @@
1
+ import * as fs from "node:fs/promises";
2
+ export function createReadingFileSystem() {
3
+ return {
4
+ readDirectory: async (filePath) => await fs.readdir(filePath),
5
+ readFile: async (filePath) => (await fs.readFile(filePath)).toString(),
6
+ };
7
+ }
8
+ //# sourceMappingURL=createReadingFileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createReadingFileSystem.js","sourceRoot":"","sources":["../../src/fs/createReadingFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIvC,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,aAAa,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;QACrE,QAAQ,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,CACpC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC;AACH,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from "./fetchers/createSystemFetchers.js";
2
+ export * from "./fetchers/createSystemFetchersOffline.js";
3
+ export * from "./fetchers/createSystemFetchersWithAuth.js";
4
+ export * from "./fetchers/types.js";
5
+ export * from "./files/createReadingFileSystem.js";
6
+ export * from "./files/createWritingFileSystem.js";
7
+ export * from "./files/types.js";
8
+ export * from "./runner/createSystemRunner.js";
9
+ export * from "./runner/runner.js";
10
+ export * from "./types/system.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export * from "./fetchers/createSystemFetchers.js";
2
+ export * from "./fetchers/createSystemFetchersOffline.js";
3
+ export * from "./fetchers/createSystemFetchersWithAuth.js";
4
+ export * from "./fetchers/types.js";
5
+ export * from "./files/createReadingFileSystem.js";
6
+ export * from "./files/createWritingFileSystem.js";
7
+ export * from "./files/types.js";
8
+ export * from "./runner/createSystemRunner.js";
9
+ export * from "./runner/runner.js";
10
+ export * from "./types/system.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SystemRunner } from "./runner.js";
2
+ export declare function createSystemRunner(directory?: string): SystemRunner;
3
+ //# sourceMappingURL=createSystemRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSystemRunner.d.ts","sourceRoot":"","sources":["../../src/runner/createSystemRunner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAgB,kBAAkB,CAAC,SAAS,SAAM,GAAG,YAAY,CAIhE"}
@@ -0,0 +1,6 @@
1
+ import { execa, parseCommandString } from "execa";
2
+ export function createSystemRunner(directory = ".") {
3
+ const executor = execa({ cwd: directory, reject: false });
4
+ return (command) => executor `${parseCommandString(command)}`;
5
+ }
6
+ //# sourceMappingURL=createSystemRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSystemRunner.js","sourceRoot":"","sources":["../../src/runner/createSystemRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAIlD,MAAM,UAAU,kBAAkB,CAAC,SAAS,GAAG,GAAG;IACjD,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE1D,OAAO,CAAC,OAAe,EAAE,EAAE,CAAC,QAAQ,CAAA,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createSystemRunner.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSystemRunner.test.d.ts","sourceRoot":"","sources":["../../src/runner/createSystemRunner.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { createSystemRunner } from "./createSystemRunner.js";
3
+ const mockExecutor = vi.fn();
4
+ const mockExeca = vi.fn().mockReturnValue(mockExecutor);
5
+ vi.mock("execa", async () => ({
6
+ ...(await vi.importActual("execa")),
7
+ get execa() {
8
+ return mockExeca;
9
+ },
10
+ }));
11
+ describe("createSystemRunner", () => {
12
+ it("executes the command from a custom directory when provided", async () => {
13
+ const cwd = "path/to/repo";
14
+ const runner = createSystemRunner(cwd);
15
+ await runner("abc");
16
+ expect(mockExeca.mock.calls).toEqual([[{ cwd, reject: false }]]);
17
+ expect(mockExecutor.mock.calls).toEqual([[["", ""], ["abc"]]]);
18
+ });
19
+ it("executes the command as a parsed command string when it includes spaces", async () => {
20
+ const runner = createSystemRunner();
21
+ await runner("a bc d");
22
+ expect(mockExeca.mock.calls).toEqual([[{ cwd: ".", reject: false }]]);
23
+ expect(mockExecutor.mock.calls).toEqual([
24
+ [
25
+ ["", ""],
26
+ ["a", "bc", "d"],
27
+ ],
28
+ ]);
29
+ });
30
+ });
31
+ //# sourceMappingURL=createSystemRunner.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSystemRunner.test.js","sourceRoot":"","sources":["../../src/runner/createSystemRunner.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAC7B,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AAExD,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7B,GAAG,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;CACD,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,GAAG,GAAG,cAAc,CAAC;QAC3B,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QAEpC,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEvB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACvC;gBACC,CAAC,EAAE,EAAE,EAAE,CAAC;gBACR,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC;aAChB;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createWritingFileSystem.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWritingFileSystem.test.d.ts","sourceRoot":"","sources":["../../src/runner/createWritingFileSystem.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { createWritingFileSystem } from "./createWritingFileSystem.js";
3
+ const mockMkdir = vi.fn();
4
+ const mockWriteFile = vi.fn();
5
+ vi.mock("node:fs/promises", () => ({
6
+ get mkdir() {
7
+ return mockMkdir;
8
+ },
9
+ get writeFile() {
10
+ return mockWriteFile;
11
+ },
12
+ }));
13
+ const contents = "abc123";
14
+ const directoryPath = "path/to/file";
15
+ const filePath = "path/to/file";
16
+ describe("createWritingFileSystem", () => {
17
+ describe("writeDirectory", () => {
18
+ it("writes with recursive: true", async () => {
19
+ const system = createWritingFileSystem();
20
+ await system.writeDirectory(directoryPath);
21
+ expect(mockMkdir).toHaveBeenCalledWith(directoryPath, {
22
+ recursive: true,
23
+ });
24
+ });
25
+ });
26
+ describe("writeFile", () => {
27
+ it("writes without mode when options does not exist", async () => {
28
+ const system = createWritingFileSystem();
29
+ await system.writeFile(filePath, contents);
30
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, undefined);
31
+ });
32
+ it("writes without mode when options.executable is false", async () => {
33
+ const system = createWritingFileSystem();
34
+ await system.writeFile(filePath, contents, { executable: false });
35
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, undefined);
36
+ });
37
+ it("writes with mode 0x755 when options.executable is true", async () => {
38
+ const system = createWritingFileSystem();
39
+ await system.writeFile(filePath, contents, { executable: true });
40
+ expect(mockWriteFile).toHaveBeenCalledWith(filePath, contents, {
41
+ mode: 0x755,
42
+ });
43
+ });
44
+ });
45
+ });
46
+ //# sourceMappingURL=createWritingFileSystem.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWritingFileSystem.test.js","sourceRoot":"","sources":["../../src/runner/createWritingFileSystem.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAC1B,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE9B,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC;IAClC,IAAI,KAAK;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,SAAS;QACZ,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC,CAAC,CAAC;AAEJ,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAC1B,MAAM,aAAa,GAAG,cAAc,CAAC;AACrC,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEhC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YAE3C,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,aAAa,EAAE;gBACrD,SAAS,EAAE,IAAI;aACf,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;YAChE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAE3C,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;YAElE,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;YACvE,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;YAEzC,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;YAEjE,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE;gBAC9D,IAAI,EAAE,KAAK;aACX,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ExecaError, Result } from "execa";
2
+ export type SystemRunner = (command: string) => Promise<ExecaError | Result>;
3
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner/runner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ExecaError, Result } from "execa";
2
+ export type SystemRunner = (command: string) => Promise<ExecaError | Result>;
3
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runners/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runners/runner.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
package/lib/system.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { Octokit } from "octokit";
2
+ export interface SystemFetchers {
3
+ fetch: typeof fetch;
4
+ octokit: Octokit;
5
+ }
6
+ //# sourceMappingURL=fetchers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchers.d.ts","sourceRoot":"","sources":["../../src/types/fetchers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fetchers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchers.js","sourceRoot":"","sources":["../../src/types/fetchers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ export interface DirectoryChild {
2
+ name: string;
3
+ type: "directory" | "file";
4
+ }
5
+ export type ReadDirectory = (filePath: string) => Promise<string[]>;
6
+ export type ReadFile = (filePath: string) => Promise<string>;
7
+ export interface ReadingFileSystem {
8
+ readDirectory: ReadDirectory;
9
+ readFile: ReadFile;
10
+ }
11
+ export type WriteDirectory = (directoryPath: string) => Promise<void>;
12
+ export type WriteFile = (filePath: string, contents: string, options?: WriteFileOptions) => Promise<void>;
13
+ export interface WriteFileOptions {
14
+ executable?: boolean;
15
+ }
16
+ export interface WritingFileSystem extends ReadingFileSystem {
17
+ writeDirectory: WriteDirectory;
18
+ writeFile: WriteFile;
19
+ }
20
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/types/fs.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAEpE,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC3D,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/types/fs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ExecaError, Result } from "execa";
2
+ export type SystemRunner = (command: string) => Promise<ExecaError | Result>;
3
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/types/runner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { SystemFetchers } from "../fetchers/types.js";
2
+ import { WritingFileSystem } from "../files/types.js";
3
+ import { SystemRunner } from "../runner/runner.js";
4
+ export interface BingoSystem {
5
+ fetchers: SystemFetchers;
6
+ fs: WritingFileSystem;
7
+ runner: SystemRunner;
8
+ }
9
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/types/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,EAAE,EAAE,iBAAiB,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/types/system.ts"],"names":[],"mappings":""}
package/lib/types.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { ExecaError, Result } from "execa";
2
+ import { Octokit } from "octokit";
3
+ export interface DirectoryChild {
4
+ name: string;
5
+ type: "directory" | "file";
6
+ }
7
+ export interface NativeSystem {
8
+ fetchers: SystemFetchers;
9
+ fs: WritingFileSystem;
10
+ runner: SystemRunner;
11
+ }
12
+ export type ReadDirectory = (filePath: string) => Promise<string[]>;
13
+ export type ReadFile = (filePath: string) => Promise<string>;
14
+ export interface ReadingFileSystem {
15
+ readDirectory: ReadDirectory;
16
+ readFile: ReadFile;
17
+ }
18
+ export interface SystemDisplay {
19
+ item(group: string, id: string, item: Partial<SystemDisplayItem>): void;
20
+ log(message: string): void;
21
+ }
22
+ export interface SystemDisplayItem {
23
+ end?: number;
24
+ error?: unknown;
25
+ start?: number;
26
+ }
27
+ export interface SystemFetchers {
28
+ fetch: typeof fetch;
29
+ octokit: Octokit;
30
+ }
31
+ export type SystemRunner = (command: string) => Promise<ExecaError | Result>;
32
+ export type WriteDirectory = (directoryPath: string) => Promise<void>;
33
+ export type WriteFile = (filePath: string, contents: string, options?: WriteFileOptions) => Promise<void>;
34
+ export interface WriteFileOptions {
35
+ executable?: boolean;
36
+ }
37
+ export interface WritingFileSystem extends ReadingFileSystem {
38
+ writeDirectory: WriteDirectory;
39
+ writeFile: WriteFile;
40
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "bingo-systems",
3
+ "version": "0.2.0",
4
+ "description": "File, network, and shell wrapper APIs used by Bingo. 🧰",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/JoshuaKGoldberg/bingo",
8
+ "directory": "packages/bingo-systems"
9
+ },
10
+ "license": "MIT",
11
+ "author": {
12
+ "name": "Josh Goldberg ✨",
13
+ "email": "npm@joshuakgoldberg.com"
14
+ },
15
+ "type": "module",
16
+ "main": "./lib/index.js",
17
+ "files": [
18
+ "lib/",
19
+ "package.json",
20
+ "LICENSE.md",
21
+ "README.md"
22
+ ],
23
+ "dependencies": {
24
+ "execa": "^9.5.2",
25
+ "get-github-auth-token": "^0.1.1",
26
+ "octokit": "^4.1.2",
27
+ "bingo-fs": "^0.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "22.13.4"
31
+ },
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc"
37
+ }
38
+ }