pm-auto 1.0.5 → 1.0.7

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 (46) hide show
  1. package/README.md +6 -3
  2. package/config.json +45 -0
  3. package/dist/build_command.d.ts +6 -1
  4. package/dist/build_command.d.ts.map +1 -1
  5. package/dist/build_command.js +66 -13
  6. package/dist/build_command.js.map +1 -1
  7. package/dist/config_path.d.ts +1 -0
  8. package/dist/config_path.d.ts.map +1 -1
  9. package/dist/config_path.js +60 -2
  10. package/dist/config_path.js.map +1 -1
  11. package/dist/config_reader.d.ts +2 -12
  12. package/dist/config_reader.d.ts.map +1 -1
  13. package/dist/config_reader.js +76 -92
  14. package/dist/config_reader.js.map +1 -1
  15. package/dist/display.d.ts +5 -0
  16. package/dist/display.d.ts.map +1 -1
  17. package/dist/display.js +2 -1
  18. package/dist/display.js.map +1 -1
  19. package/dist/index.js +6 -7
  20. package/dist/index.js.map +1 -1
  21. package/dist/orchestrator.d.ts.map +1 -1
  22. package/dist/orchestrator.js +18 -28
  23. package/dist/orchestrator.js.map +1 -1
  24. package/dist/run_commands.d.ts +6 -0
  25. package/dist/run_commands.d.ts.map +1 -0
  26. package/dist/{install.js → run_commands.js} +10 -7
  27. package/dist/run_commands.js.map +1 -0
  28. package/dist/types/index.d.ts +8 -2
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/package.json +4 -2
  31. package/src/build_command.ts +78 -13
  32. package/src/config_path.ts +63 -2
  33. package/src/config_reader.ts +90 -110
  34. package/src/display.ts +2 -2
  35. package/src/index.ts +8 -13
  36. package/src/orchestrator.ts +21 -34
  37. package/src/{install.ts → run_commands.ts} +10 -6
  38. package/src/types/index.ts +12 -3
  39. package/tests/build_command.test.ts +240 -30
  40. package/tests/config_reader.test.ts +51 -92
  41. package/tests/display.test.ts +42 -34
  42. package/tests/{install.test.ts → run_command.test.ts} +23 -23
  43. package/dist/install.d.ts +0 -6
  44. package/dist/install.d.ts.map +0 -1
  45. package/dist/install.js.map +0 -1
  46. package/test.json +0 -87
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach } from "vitest";
2
2
  import { execa } from "execa";
3
- import { install } from "../src/install.js";
3
+ import { runCommands } from "../src/run_commands.js";
4
4
  import * as display from "../src/display.js";
5
5
  import type { CommandResult } from "../src/types/index.js";
6
6
 
@@ -8,7 +8,7 @@ import type { CommandResult } from "../src/types/index.js";
8
8
  vi.mock("execa");
9
9
  vi.mock("../src/display.js");
10
10
 
11
- describe("install", () => {
11
+ describe("runCommands", () => {
12
12
  beforeEach(() => {
13
13
  vi.clearAllMocks();
14
14
  });
@@ -16,7 +16,7 @@ describe("install", () => {
16
16
  it("runs interactive commands with inherit stdio", async () => {
17
17
  const commands: CommandResult[] = [
18
18
  {
19
- name: "test",
19
+ presetName: "test",
20
20
  interactive: ["npm init"],
21
21
  nonInteractive: [],
22
22
  },
@@ -24,7 +24,7 @@ describe("install", () => {
24
24
 
25
25
  vi.mocked(execa).mockResolvedValue({} as any);
26
26
 
27
- await install(commands);
27
+ await runCommands(commands);
28
28
 
29
29
  expect(execa).toHaveBeenCalledWith("npm", ["init"], { stdio: "inherit" });
30
30
  expect(display.display).toHaveBeenCalledWith(expect.any(String), "info");
@@ -33,18 +33,18 @@ describe("install", () => {
33
33
  it("runs non-interactive commands with loading display", async () => {
34
34
  const commands: CommandResult[] = [
35
35
  {
36
- name: "test",
36
+ presetName: "test",
37
37
  interactive: [],
38
- nonInteractive: ["npm install react"],
38
+ nonInteractive: ["npm install react -D"],
39
39
  },
40
40
  ];
41
41
 
42
42
  vi.mocked(execa).mockResolvedValue({} as any);
43
43
 
44
- await install(commands);
44
+ await runCommands(commands);
45
45
 
46
46
  expect(display.display).toHaveBeenCalledWith(expect.any(String), "loading");
47
- expect(execa).toHaveBeenCalledWith("npm", ["install", "react"], {
47
+ expect(execa).toHaveBeenCalledWith("npm", ["install", "react", "-D"], {
48
48
  stdio: "inherit",
49
49
  });
50
50
  });
@@ -52,7 +52,7 @@ describe("install", () => {
52
52
  it("runs interactive commands before non-interactive", async () => {
53
53
  const commands: CommandResult[] = [
54
54
  {
55
- name: "test",
55
+ presetName: "test",
56
56
  interactive: ["npm init"],
57
57
  nonInteractive: ["npm install"],
58
58
  },
@@ -60,7 +60,7 @@ describe("install", () => {
60
60
 
61
61
  vi.mocked(execa).mockResolvedValue({} as any);
62
62
 
63
- await install(commands);
63
+ await runCommands(commands);
64
64
 
65
65
  // Check interactive was called first
66
66
  expect(execa).toHaveBeenNthCalledWith(1, "npm", ["init"], {
@@ -74,7 +74,7 @@ describe("install", () => {
74
74
  it("handles multiple interactive commands sequentially", async () => {
75
75
  const commands: CommandResult[] = [
76
76
  {
77
- name: "test",
77
+ presetName: "test",
78
78
  interactive: ["npm init", "npx create-app"],
79
79
  nonInteractive: [],
80
80
  },
@@ -82,7 +82,7 @@ describe("install", () => {
82
82
 
83
83
  vi.mocked(execa).mockResolvedValue({} as any);
84
84
 
85
- await install(commands);
85
+ await runCommands(commands);
86
86
 
87
87
  expect(execa).toHaveBeenCalledTimes(2);
88
88
  expect(execa).toHaveBeenNthCalledWith(1, "npm", ["init"], {
@@ -96,7 +96,7 @@ describe("install", () => {
96
96
  it("handles command execution errors with stdout", async () => {
97
97
  const commands: CommandResult[] = [
98
98
  {
99
- name: "test",
99
+ presetName: "test",
100
100
  interactive: [],
101
101
  nonInteractive: ["npm install"],
102
102
  },
@@ -108,7 +108,7 @@ describe("install", () => {
108
108
 
109
109
  vi.mocked(execa).mockRejectedValue(error);
110
110
 
111
- await install(commands);
111
+ await runCommands(commands);
112
112
 
113
113
  expect(display.display).toHaveBeenCalledWith("stdout output", "");
114
114
  expect(display.display).toHaveBeenCalledWith("stderr output", "error");
@@ -121,7 +121,7 @@ describe("install", () => {
121
121
  it("handles command execution errors without stdout/stderr", async () => {
122
122
  const commands: CommandResult[] = [
123
123
  {
124
- name: "test",
124
+ presetName: "test",
125
125
  interactive: [],
126
126
  nonInteractive: ["npm install"],
127
127
  },
@@ -129,7 +129,7 @@ describe("install", () => {
129
129
 
130
130
  vi.mocked(execa).mockRejectedValue(new Error("Command failed"));
131
131
 
132
- await install(commands);
132
+ await runCommands(commands);
133
133
 
134
134
  expect(display.display).toHaveBeenCalledWith(
135
135
  expect.stringContaining("Command failed"),
@@ -140,12 +140,12 @@ describe("install", () => {
140
140
  it("processes multiple CommandResult items in sequence", async () => {
141
141
  const commands: CommandResult[] = [
142
142
  {
143
- name: "react",
143
+ presetName: "react",
144
144
  interactive: [],
145
145
  nonInteractive: ["npm install react"],
146
146
  },
147
147
  {
148
- name: "vue",
148
+ presetName: "vue",
149
149
  interactive: [],
150
150
  nonInteractive: ["npm install vue"],
151
151
  },
@@ -153,7 +153,7 @@ describe("install", () => {
153
153
 
154
154
  vi.mocked(execa).mockResolvedValue({} as any);
155
155
 
156
- await install(commands);
156
+ await runCommands(commands);
157
157
 
158
158
  expect(execa).toHaveBeenCalledTimes(2);
159
159
  expect(execa).toHaveBeenCalledWith("npm", ["install", "react"], {
@@ -167,13 +167,13 @@ describe("install", () => {
167
167
  it("handles empty command arrays", async () => {
168
168
  const commands: CommandResult[] = [
169
169
  {
170
- name: "test",
170
+ presetName: "test",
171
171
  interactive: [],
172
172
  nonInteractive: [],
173
173
  },
174
174
  ];
175
175
 
176
- await install(commands);
176
+ await runCommands(commands);
177
177
 
178
178
  expect(execa).not.toHaveBeenCalled();
179
179
  });
@@ -181,7 +181,7 @@ describe("install", () => {
181
181
  it("splits command string correctly with multiple args", async () => {
182
182
  const commands: CommandResult[] = [
183
183
  {
184
- name: "test",
184
+ presetName: "test",
185
185
  interactive: [],
186
186
  nonInteractive: ["npm install react --save-dev"],
187
187
  },
@@ -189,7 +189,7 @@ describe("install", () => {
189
189
 
190
190
  vi.mocked(execa).mockResolvedValue({} as any);
191
191
 
192
- await install(commands);
192
+ await runCommands(commands);
193
193
 
194
194
  expect(execa).toHaveBeenCalledWith(
195
195
  "npm",
package/dist/install.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { CommandResult } from "./types/index.js";
2
- /**
3
- * Install all commands
4
- */
5
- export declare function install(commands: CommandResult[]): Promise<void>;
6
- //# sourceMappingURL=install.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAwBtD;;GAEG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,iBAqBtD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,cAAuB,KAAK;IACrE,IAAI,CAAC;QACH,MAAM,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAElD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,KAAK,CAAC,WAAqB,EAAE,IAAI,EAAE;gBACvC,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC,WAAqB,EAAE,IAAI,EAAE;gBACvC,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,4CAA4C;QAC5C,IAAI,KAAK,CAAC,MAAM;YAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM;YAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,CAAC,WAAW,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,QAAyB;IACrD,IAAI,CAAC;QACH,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,oDAAoD;YACpD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxB,KAAK,MAAM,kBAAkB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;oBACrD,OAAO,CAAC,gCAAgC,kBAAkB,EAAE,EAAE,MAAM,CAAC,CAAC;oBACtE,MAAM,UAAU,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;YAED,2BAA2B;YAC3B,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtC,yCAAyC;gBACzC,OAAO,CAAC,oBAAoB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;gBACpE,MAAM,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAW,EAAE,KAAK,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
package/test.json DELETED
@@ -1,87 +0,0 @@
1
- {
2
- "sample": {
3
- "name": "sample",
4
- "description": "",
5
- "packageManager": "npm",
6
- "packages": [
7
- {
8
- "command": "gsap",
9
- "interactive": false
10
- }
11
- ]
12
- },
13
-
14
- "vite": {
15
- "name": "vite",
16
- "description": "Vite configuration",
17
- "packageManager": "npm",
18
- "packages": [
19
- {
20
- "command": "create-vite@latest my-app",
21
- "interactive": true
22
- }
23
- ]
24
- },
25
-
26
- "next": {
27
- "name": "next",
28
- "description": "Next.js configuration",
29
- "packageManager": "pnpm",
30
- "packages": [
31
- {
32
- "command": "three --save-dev",
33
- "interactive": false
34
- },
35
- {
36
- "command": "@react-three/drei",
37
- "interactive": false
38
- },
39
- {
40
- "command": "framer-motion",
41
- "interactive": false
42
- },
43
- {
44
- "command": "create-next-app@latest my-app",
45
- "interactive": true
46
- }
47
- ]
48
- },
49
- "test": {
50
- "name": "test",
51
- "description": "Test configuration",
52
- "packageManager": "npm",
53
- "packages": [
54
- {
55
- "command": "three",
56
- "interactive": false
57
- },
58
- {
59
- "command": "gsap",
60
- "interactive": false
61
- },
62
- {
63
- "command": "@react-three/fiber",
64
- "interactive": false
65
- }
66
- ]
67
- },
68
- "test2": {
69
- "name": "test2",
70
- "description": "Test2 configuration",
71
- "packageManager": "npm",
72
- "packages": [
73
- {
74
- "command": "@react-three/drei",
75
- "interactive": false
76
- },
77
- {
78
- "command": "framer-motion",
79
- "interactive": false
80
- },
81
- {
82
- "command": "@react-three/postprocessing",
83
- "interactive": false
84
- }
85
- ]
86
- }
87
- }