pm-auto 1.0.6 → 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 (43) hide show
  1. package/config.json +45 -0
  2. package/dist/build_command.d.ts +6 -1
  3. package/dist/build_command.d.ts.map +1 -1
  4. package/dist/build_command.js +61 -22
  5. package/dist/build_command.js.map +1 -1
  6. package/dist/config_path.d.ts +1 -0
  7. package/dist/config_path.d.ts.map +1 -1
  8. package/dist/config_path.js +60 -2
  9. package/dist/config_path.js.map +1 -1
  10. package/dist/config_reader.d.ts +2 -12
  11. package/dist/config_reader.d.ts.map +1 -1
  12. package/dist/config_reader.js +72 -89
  13. package/dist/config_reader.js.map +1 -1
  14. package/dist/display.d.ts.map +1 -1
  15. package/dist/display.js +1 -0
  16. package/dist/display.js.map +1 -1
  17. package/dist/index.js +5 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/orchestrator.d.ts.map +1 -1
  20. package/dist/orchestrator.js +18 -28
  21. package/dist/orchestrator.js.map +1 -1
  22. package/dist/run_commands.d.ts +6 -0
  23. package/dist/run_commands.d.ts.map +1 -0
  24. package/dist/{install.js → run_commands.js} +4 -4
  25. package/dist/run_commands.js.map +1 -0
  26. package/dist/types/index.d.ts +8 -2
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/package.json +3 -1
  29. package/src/build_command.ts +73 -23
  30. package/src/config_path.ts +63 -2
  31. package/src/config_reader.ts +86 -107
  32. package/src/display.ts +1 -0
  33. package/src/index.ts +6 -9
  34. package/src/orchestrator.ts +21 -36
  35. package/src/{install.ts → run_commands.ts} +3 -3
  36. package/src/types/index.ts +12 -3
  37. package/tests/build_command.test.ts +239 -41
  38. package/tests/config_reader.test.ts +51 -92
  39. package/tests/{install.test.ts → run_command.test.ts} +23 -23
  40. package/dist/install.d.ts +0 -6
  41. package/dist/install.d.ts.map +0 -1
  42. package/dist/install.js.map +0 -1
  43. package/test.json +0 -87
@@ -1,49 +1,247 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { buildCommands, buildUninstallCommands } from "../src/build_command.js";
3
- import type { ConfigType } from "../src/types/index.js";
2
+ import {
3
+ buildInstallCommands,
4
+ buildUninstallCommands,
5
+ cleanCommand,
6
+ } from "../src/build_command.js";
7
+ import type { CommandResult, ConfigType } from "../src/types/index.js";
4
8
 
5
- describe("buildCommand", () => {
6
- const mockConfig: ConfigType[] = [
9
+ describe("cleanCommand", () => {
10
+ it("should return a string of a command stripped of its flags", () => {
11
+ const commands = [
12
+ "lodash@latest",
13
+ "@react-three/fiber",
14
+ "@three/types -D",
15
+ "three --force",
16
+ ];
17
+ const results = [];
18
+ for (const command of commands) {
19
+ results.push(cleanCommand(command));
20
+ }
21
+ expect(results).toEqual([
22
+ "lodash",
23
+ "@react-three/fiber",
24
+ "@three/types",
25
+ "three",
26
+ ]);
27
+ });
28
+ });
29
+
30
+ const mockConfigs: Record<string, ConfigType[]> = {
31
+ pnpm: [
7
32
  {
8
- name: "vite",
33
+ presetName: "vite",
9
34
  packageManager: "pnpm",
10
35
  packages: [
11
- { command: "vite@latest", interactive: true },
12
- { command: "gsap@latest", interactive: false },
13
- { command: "react-dom@latest --save-dev", interactive: false },
14
- { command: "lodash --save-dev", interactive: false },
15
- { command: "typescript@latest --save-dev", interactive: false },
36
+ { command: "vite", interactive: true, version: "latest", flags: ["."] },
37
+ { command: "gsap", interactive: false, version: "latest" },
38
+ {
39
+ command: "react-dom",
40
+ interactive: false,
41
+ version: "latest",
42
+ dev: true,
43
+ flags: ["--legacy-peer-deps"],
44
+ },
45
+ {
46
+ command: "@react-three/fiber",
47
+ interactive: false,
48
+ version: "1.0.0",
49
+ dev: true,
50
+ },
51
+ {
52
+ command: "typescript",
53
+ interactive: false,
54
+ version: "latest",
55
+ dev: true,
56
+ },
16
57
  { command: "clsx", interactive: false },
17
- { command: "shadcn", interactive: true },
18
- ],
19
- },
20
- ];
21
- it("builds an installation command", () => {
22
- const command = buildCommands(mockConfig);
23
- expect(command).toEqual([
24
- {
25
- name: "vite",
26
- interactive: ["pnpm dlx vite@latest", "pnpm dlx shadcn"],
27
- nonInteractive: [
28
- "pnpm add react-dom@latest --save-dev",
29
- "pnpm add lodash --save-dev",
30
- "pnpm add typescript@latest --save-dev",
31
- "pnpm add gsap@latest clsx",
32
- ],
33
- },
34
- ]);
35
- });
58
+ { command: "shadcn", interactive: true, version: "latest" },
59
+ ],
60
+ },
61
+ ],
62
+ yarn: [
63
+ {
64
+ presetName: "vite",
65
+ packageManager: "yarn",
66
+ packages: [
67
+ { command: "vite", interactive: true, version: "latest", flags: ["."] },
68
+ { command: "gsap", interactive: false, version: "latest" },
69
+ {
70
+ command: "react-dom",
71
+ interactive: false,
72
+ version: "latest",
73
+ dev: true,
74
+ flags: ["--peer-deps"],
75
+ },
76
+ {
77
+ command: "@react-three/fiber",
78
+ interactive: false,
79
+ version: "1.0.0",
80
+ dev: true,
81
+ },
82
+ {
83
+ command: "typescript",
84
+ interactive: false,
85
+ version: "latest",
86
+ dev: true,
87
+ },
88
+ { command: "clsx", interactive: false },
89
+ { command: "shadcn", interactive: true, version: "latest" },
90
+ ],
91
+ },
92
+ ],
93
+ npm: [
94
+ {
95
+ presetName: "vite",
96
+ packageManager: "npm",
97
+ packages: [
98
+ { command: "vite", interactive: true, version: "latest", flags: ["."] },
99
+ { command: "gsap", interactive: false, version: "latest" },
100
+ {
101
+ command: "react-dom",
102
+ interactive: false,
103
+ version: "latest",
104
+ dev: true,
105
+ flags: ["--legacy-peer-deps"],
106
+ },
107
+ {
108
+ command: "@react-three/fiber",
109
+ interactive: false,
110
+ version: "1.0.0",
111
+ dev: true,
112
+ },
113
+ {
114
+ command: "typescript",
115
+ interactive: false,
116
+ version: "latest",
117
+ dev: true,
118
+ },
119
+ { command: "clsx", interactive: false },
120
+ { command: "shadcn", interactive: true, version: "latest" },
121
+ ],
122
+ },
123
+ ],
124
+ bun: [
125
+ {
126
+ presetName: "vite",
127
+ packageManager: "bun",
128
+ packages: [
129
+ { command: "vite", interactive: true, version: "latest", flags: ["."] },
130
+ { command: "gsap", interactive: false, version: "latest" },
131
+ {
132
+ command: "react-dom",
133
+ interactive: false,
134
+ version: "latest",
135
+ dev: true,
136
+ flags: ["--peer-deps"],
137
+ },
138
+ {
139
+ command: "@react-three/fiber",
140
+ interactive: false,
141
+ version: "1.0.0",
142
+ dev: true,
143
+ },
144
+ {
145
+ command: "typescript",
146
+ interactive: false,
147
+ version: "latest",
148
+ dev: true,
149
+ },
150
+ { command: "clsx", interactive: false },
151
+ { command: "shadcn", interactive: true, version: "latest" },
152
+ ],
153
+ },
154
+ ],
155
+ };
36
156
 
37
- it("builds an uninstallation command", () => {
38
- const command = buildUninstallCommands(mockConfig);
39
- expect(command).toEqual([
40
- {
41
- name: "vite",
42
- interactive: [],
43
- nonInteractive: [
44
- "pnpm remove gsap@latest react-dom@latest lodash typescript@latest clsx",
45
- ],
46
- },
47
- ]);
48
- });
157
+ const expectedInstall: Record<string, CommandResult[]> = {
158
+ pnpm: [
159
+ {
160
+ presetName: "vite",
161
+ interactive: ["pnpm dlx vite@latest .", "pnpm dlx shadcn@latest"],
162
+ nonInteractive: [
163
+ "pnpm add gsap@latest react-dom@latest -D --legacy-peer-deps @react-three/fiber@1.0.0 -D typescript@latest -D clsx",
164
+ ],
165
+ },
166
+ ],
167
+ yarn: [
168
+ {
169
+ presetName: "vite",
170
+ interactive: ["yarn dlx vite@latest .", "yarn dlx shadcn@latest"],
171
+ nonInteractive: [
172
+ "yarn add gsap@latest react-dom@latest -D --peer-deps @react-three/fiber@1.0.0 -D typescript@latest -D clsx",
173
+ ],
174
+ },
175
+ ],
176
+ npm: [
177
+ {
178
+ presetName: "vite",
179
+ interactive: ["npx vite@latest .", "npx shadcn@latest"],
180
+ nonInteractive: [
181
+ "npm install gsap@latest react-dom@latest -D --legacy-peer-deps @react-three/fiber@1.0.0 -D typescript@latest -D clsx",
182
+ ],
183
+ },
184
+ ],
185
+ bun: [
186
+ {
187
+ presetName: "vite",
188
+ interactive: ["bunx vite@latest .", "bunx shadcn@latest"],
189
+ nonInteractive: [
190
+ "bun add gsap@latest react-dom@latest -d --peer-deps @react-three/fiber@1.0.0 -d typescript@latest -d clsx",
191
+ ],
192
+ },
193
+ ],
194
+ };
195
+
196
+ const expectedUninstall: Record<string, CommandResult[]> = {
197
+ pnpm: [
198
+ {
199
+ presetName: "vite",
200
+ interactive: [],
201
+ nonInteractive: [
202
+ "pnpm remove gsap react-dom @react-three/fiber typescript clsx",
203
+ ],
204
+ },
205
+ ],
206
+ yarn: [
207
+ {
208
+ presetName: "vite",
209
+ interactive: [],
210
+ nonInteractive: [
211
+ "yarn remove gsap react-dom @react-three/fiber typescript clsx",
212
+ ],
213
+ },
214
+ ],
215
+ npm: [
216
+ {
217
+ presetName: "vite",
218
+ interactive: [],
219
+ nonInteractive: [
220
+ "npm uninstall gsap react-dom @react-three/fiber typescript clsx",
221
+ ],
222
+ },
223
+ ],
224
+ bun: [
225
+ {
226
+ presetName: "vite",
227
+ interactive: [],
228
+ nonInteractive: [
229
+ "bun remove gsap react-dom @react-three/fiber typescript clsx",
230
+ ],
231
+ },
232
+ ],
233
+ };
234
+
235
+ describe("buildCommand", () => {
236
+ for (const pm of Object.keys(mockConfigs)) {
237
+ it(`builds ${pm} installation command`, () => {
238
+ const command = buildInstallCommands(mockConfigs[pm]);
239
+ expect(command).toEqual(expectedInstall[pm]);
240
+ });
241
+
242
+ it(`builds ${pm} uninstallation command`, () => {
243
+ const command = buildUninstallCommands(mockConfigs[pm]);
244
+ expect(command).toEqual(expectedUninstall[pm]);
245
+ });
246
+ }
49
247
  });
@@ -1,11 +1,9 @@
1
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
2
  import fs from "fs/promises";
3
- import * as fsd from "fs";
4
- import * as path from "path";
5
3
  import { display } from "../src/display.js";
6
- import { detectPackageManager, getConfigObject } from "../src/config_reader.js";
4
+ import { getConfigObject } from "../src/config_reader.js";
7
5
  import { getConfigPath } from "../src/config_path.js";
8
- import type { CommandResult, ConfigType } from "../src/types/index.js";
6
+ import type { ConfigType } from "../src/types/index.js";
9
7
  import * as clack from "@clack/prompts";
10
8
 
11
9
  vi.mock("fs/promises");
@@ -15,55 +13,25 @@ vi.mock("../src/display.js");
15
13
  vi.mock("@clack/prompts");
16
14
  vi.mock("../src/config_path.js");
17
15
 
18
- describe("detect package manager", () => {
19
- beforeEach(() => {
20
- vi.resetAllMocks();
21
- });
22
- it("should detects pnpm from lock file", () => {
23
- vi.mocked(fsd.existsSync).mockImplementation((filePath) =>
24
- filePath.toString().includes("pnpm-lock.yaml"),
25
- );
26
- const result = detectPackageManager("/test/path");
27
-
28
- expect(result).toBe("pnpm");
29
- });
30
- it("should detects yarn from lock file", () => {
31
- vi.mocked(fsd.existsSync).mockImplementation((filePath) =>
32
- filePath.toString().includes("yarn.lock"),
33
- );
34
- const result = detectPackageManager("/test/path");
35
-
36
- expect(result).toBe("yarn");
37
- });
38
- it("should detects npm from lock file", () => {
39
- vi.mocked(fsd.existsSync).mockImplementation((filePath) =>
40
- filePath.toString().includes("package-lock.json"),
41
- );
42
- const result = detectPackageManager("/test/path");
43
-
44
- expect(result).toBe("npm");
45
- });
46
- it("should display error message when no lock file found", () => {
47
- vi.mocked(fsd.existsSync).mockImplementation(() => false);
48
- const result = detectPackageManager("/test/path");
49
-
50
- expect(display).toHaveBeenCalledWith(
51
- expect.stringContaining("No Lock File Found"),
52
- "error",
53
- );
54
- expect(result).toBeUndefined();
55
- });
56
- });
57
-
58
16
  describe("get Config Object", () => {
59
- const mockConfig = {
17
+ const mockConfig: Record<string, ConfigType> = {
60
18
  react: {
61
- name: "react",
62
- packages: [{ command: "npm install react", interactive: false }],
19
+ presetName: "react",
20
+ packageManager: "pnpm",
21
+ packages: [
22
+ {
23
+ command: "npm install react",
24
+ interactive: false,
25
+ flags: ["--peers-deps"],
26
+ },
27
+ ],
63
28
  },
64
29
  vue: {
65
- name: "vue",
66
- packages: [{ command: "npm install vue", interactive: false }],
30
+ presetName: "vue",
31
+ packageManager: "npm",
32
+ packages: [
33
+ { command: "npm install vue", interactive: false, version: "latest" },
34
+ ],
67
35
  },
68
36
  };
69
37
 
@@ -79,41 +47,61 @@ describe("get Config Object", () => {
79
47
 
80
48
  expect(config).toEqual([
81
49
  {
82
- name: "react",
83
- packages: [{ command: "npm install react", interactive: false }],
50
+ presetName: "react",
51
+ packageManager: "pnpm",
52
+ packages: [
53
+ {
54
+ command: "npm install react",
55
+ interactive: false,
56
+ flags: ["--peers-deps"],
57
+ },
58
+ ],
84
59
  },
85
60
  {
86
- name: "vue",
87
- packages: [{ command: "npm install vue", interactive: false }],
61
+ presetName: "vue",
62
+ packageManager: "npm",
63
+ packages: [
64
+ { command: "npm install vue", interactive: false, version: "latest" },
65
+ ],
88
66
  },
89
- ]);
67
+ ] as ConfigType[]);
90
68
  expect(display).toHaveBeenCalledWith(
91
69
  expect.stringContaining("Package 'next' not found in config"),
92
70
  "warning",
93
71
  );
94
72
  });
95
73
 
74
+ it("should display an error on invalid config file format", async () => {
75
+ vi.mocked(getConfigPath).mockReturnValue("/mock/config.json");
76
+ vi.mocked(fs.readFile).mockResolvedValue(JSON.stringify({ name: "help" }));
77
+
78
+ await getConfigObject(["react"], {});
79
+ expect(display).toHaveBeenCalledWith(
80
+ expect.stringContaining("Invalid config file format"),
81
+ "error",
82
+ );
83
+ });
84
+
96
85
  // it("should display an error on readFile error", async () => {
97
- // vi.mocked(getConfigPath).mockReturnValue("/path/to/test");
98
- // vi.mocked(fs.readFile).mockRejectedValue(new Error("File not found"));
99
- // await getConfigObject([], {});
86
+ // vi.mocked(getConfigPath).mockReturnValue("/");
87
+ // vi.mocked(fs.readFile).mockRejectedValue("File not found");
88
+ // await getConfigObject(["react"], {});
100
89
  // expect(display).toHaveBeenCalledWith(
101
- // expect.stringContaining("Try updating the config file"),
90
+ // expect.stringContaining("Try updating the config file path"),
102
91
  // "error",
103
92
  // );
104
93
  // });
105
- //
106
94
 
107
- it("adds command with addCommand option", async () => {
95
+ it("adds flags with addFlags option", async () => {
108
96
  vi.mocked(getConfigPath).mockReturnValue("/mock/config.json");
109
97
  vi.mocked(fs.readFile).mockResolvedValue(JSON.stringify(mockConfig));
110
98
 
111
99
  const result = (await getConfigObject(["react"], {
112
- addCommand: "--save-dev",
100
+ addFlags: "--force",
113
101
  })) as ConfigType[];
114
102
 
115
- if (result[0]?.packages[0]?.command) {
116
- expect(result[0].packages[0].command).toContain("--save-dev");
103
+ if (result[0]?.packages[0]?.flags) {
104
+ expect(result[0].packages[0].flags).toContain("--force");
117
105
  }
118
106
  });
119
107
 
@@ -147,33 +135,4 @@ describe("get Config Object", () => {
147
135
 
148
136
  mockExit.mockRestore();
149
137
  });
150
-
151
- it("generates command for package.json install", async () => {
152
- vi.mocked(fsd.existsSync).mockImplementation((filePath) =>
153
- filePath.toString().includes("package-lock.json"),
154
- );
155
-
156
- const result = await getConfigObject([], { pkgJson: true });
157
-
158
- expect(result).toEqual([
159
- {
160
- name: "package.json",
161
- interactive: [],
162
- nonInteractive: ["npm install"],
163
- },
164
- ]);
165
- });
166
-
167
- it("uses correct package manager for package.json", async () => {
168
- vi.mocked(fsd.existsSync).mockImplementation((filePath) =>
169
- filePath.toString().includes("pnpm-lock.yaml"),
170
- );
171
-
172
- const result = (await getConfigObject([], {
173
- pkgJson: true,
174
- })) as CommandResult[];
175
- if (result[0]) {
176
- expect(result[0].nonInteractive[0]).toBe("pnpm install");
177
- }
178
- });
179
138
  });
@@ -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;AA0BtD;;GAEG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,iBAuBtD"}
@@ -1 +0,0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