create-medusa-app 2.22.4 → 2.22.5

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/AGENTS.md +1 -1
  2. package/CHANGELOG.md +9 -0
  3. package/dist/index.js +0 -0
  4. package/package.json +4 -4
  5. package/src/utils/__tests__/prepare-project.test.ts +65 -0
  6. package/src/utils/__tests__/update-package-versions.test.ts +41 -0
  7. package/src/utils/prepare-project.ts +7 -0
  8. package/src/utils/project-creator/medusa-plugin-creator.ts +1 -0
  9. package/src/utils/update-package-versions.ts +7 -0
  10. package/dist/commands/create.js +0 -10
  11. package/dist/utils/claude-code-plugin.js +0 -76
  12. package/dist/utils/clone-repo.js +0 -77
  13. package/dist/utils/create-abort-controller.js +0 -11
  14. package/dist/utils/create-db.js +0 -188
  15. package/dist/utils/execute.js +0 -51
  16. package/dist/utils/facts.js +0 -87
  17. package/dist/utils/format-connection-string.js +0 -17
  18. package/dist/utils/get-current-os.js +0 -10
  19. package/dist/utils/log-message.js +0 -21
  20. package/dist/utils/logger.js +0 -8
  21. package/dist/utils/nextjs-utils.js +0 -55
  22. package/dist/utils/node-version.js +0 -15
  23. package/dist/utils/package-manager.js +0 -354
  24. package/dist/utils/postgres-client.js +0 -9
  25. package/dist/utils/prepare-project.js +0 -191
  26. package/dist/utils/process-manager.js +0 -50
  27. package/dist/utils/project-creator/creator.js +0 -46
  28. package/dist/utils/project-creator/index.js +0 -4
  29. package/dist/utils/project-creator/medusa-plugin-creator.js +0 -95
  30. package/dist/utils/project-creator/medusa-project-creator.js +0 -215
  31. package/dist/utils/project-creator/project-creator-factory.js +0 -83
  32. package/dist/utils/project-paths.js +0 -7
  33. package/dist/utils/start-medusa.js +0 -13
  34. package/dist/utils/update-package-versions.js +0 -29
package/AGENTS.md CHANGED
@@ -15,7 +15,7 @@ Options (from `src/index.ts`):
15
15
  - `[project-name]`: prompted if missing. Names containing `.` are rejected (MikroORM path resolution breaks).
16
16
  - `--plugin`: clone `medusajs/medusa-starter-plugin` and only install dependencies (no DB, no start).
17
17
  - `--repo-url <url>`: starter to clone (default `https://github.com/medusajs/dtc-starter`, branch `main`, `--depth 1`).
18
- - `--version <version>`: pin every `@medusajs/*` dependency to this version (except `@medusajs/ui`, which is versioned separately).
18
+ - `--version <version>`: pin every `@medusajs/*` entry in `dependencies`, `devDependencies`, and `peerDependencies` to this version (except `@medusajs/ui`, which is versioned separately). Also applies with `--plugin`.
19
19
  - `--skip-db`, `--db-url <url>`, `--no-migrations`, `--no-browser`, `--directory-path <path>`.
20
20
  - `--with-nextjs-starter`: keep and install `apps/storefront`; otherwise you're prompted, and a "no" deletes it.
21
21
  - `--use-npm` / `--use-yarn` / `--use-pnpm` (mutually exclusive), `--verbose`.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.22.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#17716](https://github.com/medusajs/medusa/pull/17716) [`d06808b`](https://github.com/medusajs/medusa/commit/d06808b468c55247b9a76fedde7dd864aec92eeb) Thanks [@medusa-os-bot](https://github.com/apps/medusa-os-bot)! - fix(create-medusa-app): apply --version to plugin dependencies and peer dependencies
8
+ - Updated dependencies []:
9
+ - @medusajs/deps@2.22.5
10
+ - @medusajs/telemetry@2.22.5
11
+
3
12
  ## 2.22.4
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-medusa-app",
3
- "version": "2.22.4",
3
+ "version": "2.22.5",
4
4
  "description": "Create a Medusa project using a single command.",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -14,8 +14,8 @@
14
14
  "test": "../../../node_modules/.bin/jest --passWithNoTests src"
15
15
  },
16
16
  "dependencies": {
17
- "@medusajs/deps": "2.22.4",
18
- "@medusajs/telemetry": "2.22.4",
17
+ "@medusajs/deps": "2.22.5",
18
+ "@medusajs/telemetry": "2.22.5",
19
19
  "boxen": "^9.0.0",
20
20
  "chalk": "^6.0.1",
21
21
  "commander": "^15.0.0",
@@ -45,4 +45,4 @@
45
45
  "access": "public"
46
46
  },
47
47
  "gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
48
- }
48
+ }
@@ -0,0 +1,65 @@
1
+ import fs from "fs"
2
+ import os from "os"
3
+ import path from "path"
4
+ import prepareProject from "../prepare-project"
5
+
6
+ jest.mock("../facts", () => ({
7
+ displayFactBox: jest.fn().mockReturnValue(null),
8
+ }))
9
+
10
+ describe("prepareProject", () => {
11
+ describe("plugin", () => {
12
+ let directory: string
13
+
14
+ beforeEach(() => {
15
+ directory = fs.mkdtempSync(path.join(os.tmpdir(), "cma-plugin-"))
16
+ fs.writeFileSync(
17
+ path.join(directory, "package.json"),
18
+ JSON.stringify({
19
+ name: "starter",
20
+ devDependencies: {
21
+ "@medusajs/medusa": "2.0.0",
22
+ "@medusajs/ui": "4.0.0",
23
+ },
24
+ peerDependencies: {
25
+ "@medusajs/framework": "2.0.0",
26
+ },
27
+ })
28
+ )
29
+ })
30
+
31
+ afterEach(() => {
32
+ fs.rmSync(directory, { recursive: true, force: true })
33
+ })
34
+
35
+ it("should update the plugin's @medusajs package versions when a version is passed", async () => {
36
+ const packageManager = {
37
+ getPackageManagerString: jest.fn().mockResolvedValue(undefined),
38
+ installDependencies: jest.fn().mockResolvedValue(undefined),
39
+ }
40
+
41
+ await prepareProject({
42
+ isPlugin: true,
43
+ directory,
44
+ projectName: "my-plugin",
45
+ spinner: {} as any,
46
+ processManager: {} as any,
47
+ packageManager: packageManager as any,
48
+ version: "2.5.0",
49
+ })
50
+
51
+ const packageJson = JSON.parse(
52
+ fs.readFileSync(path.join(directory, "package.json"), "utf-8")
53
+ )
54
+
55
+ expect(packageJson.name).toBe("my-plugin")
56
+ expect(packageJson.devDependencies).toEqual({
57
+ "@medusajs/medusa": "2.5.0",
58
+ "@medusajs/ui": "4.0.0",
59
+ })
60
+ expect(packageJson.peerDependencies).toEqual({
61
+ "@medusajs/framework": "2.5.0",
62
+ })
63
+ })
64
+ })
65
+ })
@@ -0,0 +1,41 @@
1
+ import { updatePackageVersions } from "../update-package-versions"
2
+
3
+ describe("updatePackageVersions", () => {
4
+ it("should update @medusajs dependencies, devDependencies, and peerDependencies except @medusajs/ui", () => {
5
+ const packageJson = {
6
+ dependencies: {
7
+ "@medusajs/medusa": "2.0.0",
8
+ "@medusajs/ui": "4.0.0",
9
+ lodash: "4.0.0",
10
+ },
11
+ devDependencies: {
12
+ "@medusajs/cli": "2.0.0",
13
+ typescript: "5.0.0",
14
+ },
15
+ peerDependencies: {
16
+ "@medusajs/framework": "2.0.0",
17
+ "@medusajs/ui": "4.0.0",
18
+ react: "18.0.0",
19
+ },
20
+ }
21
+
22
+ const result = updatePackageVersions(packageJson, "2.5.0")
23
+
24
+ expect(result).toEqual({
25
+ dependencies: {
26
+ "@medusajs/medusa": "2.5.0",
27
+ "@medusajs/ui": "4.0.0",
28
+ lodash: "4.0.0",
29
+ },
30
+ devDependencies: {
31
+ "@medusajs/cli": "2.5.0",
32
+ typescript: "5.0.0",
33
+ },
34
+ peerDependencies: {
35
+ "@medusajs/framework": "2.5.0",
36
+ "@medusajs/ui": "4.0.0",
37
+ react: "18.0.0",
38
+ },
39
+ })
40
+ })
41
+ })
@@ -30,6 +30,7 @@ type PreparePluginOptions = {
30
30
  abortController?: AbortController
31
31
  verbose?: boolean
32
32
  packageManager: PackageManager
33
+ version?: string
33
34
  }
34
35
 
35
36
  type PrepareProjectOptions = {
@@ -76,6 +77,7 @@ async function preparePlugin({
76
77
  abortController,
77
78
  verbose = false,
78
79
  packageManager,
80
+ version,
79
81
  }: PreparePluginOptions) {
80
82
  // initialize execution options
81
83
  const execOptions = {
@@ -105,6 +107,11 @@ async function preparePlugin({
105
107
  packageJson.packageManager = packageManagerString
106
108
  }
107
109
 
110
+ // Update medusa dependencies versions
111
+ if (version) {
112
+ updatePackageVersions(packageJson, version)
113
+ }
114
+
108
115
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
109
116
 
110
117
  factBoxOptions.interval = displayFactBox({
@@ -75,6 +75,7 @@ export class PluginProjectCreator
75
75
  abortController: this.abortController,
76
76
  verbose: this.options.verbose,
77
77
  packageManager: this.packageManager,
78
+ version: this.options.version,
78
79
  })
79
80
  }
80
81
 
@@ -24,6 +24,13 @@ export function updatePackageVersions(
24
24
  }
25
25
  }
26
26
  }
27
+ if (packageJson.peerDependencies) {
28
+ for (const dependency of Object.keys(packageJson.peerDependencies)) {
29
+ if (shouldUpdateVersion(dependency)) {
30
+ packageJson.peerDependencies[dependency] = version
31
+ }
32
+ }
33
+ }
27
34
 
28
35
  if (applyChanges && typeof packageJsonOrPath === "string") {
29
36
  writeFileSync(packageJsonOrPath, JSON.stringify(packageJson, null, 2))
@@ -1,10 +0,0 @@
1
- import { ProjectCreatorFactory, } from "../utils/project-creator/index.js";
2
- /**
3
- * Command handler to create a Medusa project or plugin
4
- */
5
- export default async (args, options) => {
6
- const projectCreator = await ProjectCreatorFactory.create(args, options);
7
- await projectCreator.create({
8
- verbose: options.verbose,
9
- });
10
- };
@@ -1,76 +0,0 @@
1
- import { spawnSync } from "child_process";
2
- import fs from "fs";
3
- import os from "os";
4
- import path from "path";
5
- import inquirer from "inquirer";
6
- import logMessage from "./log-message.js";
7
- import pkg from '@medusajs/telemetry';
8
- const { Store, track } = pkg;
9
- const CLAUDE_DIR = path.join(os.homedir(), ".claude");
10
- const INSTALLED_PLUGINS_FILE = path.join(CLAUDE_DIR, "plugins", "installed_plugins.json");
11
- const PLUGIN_ID = "medusa-dev@medusa";
12
- const CONFIG_KEY = "claude-code-plugin.prompted";
13
- function isClaudeCodePresent() {
14
- return !!process.env.CLAUDE_CODE || fs.existsSync(CLAUDE_DIR);
15
- }
16
- function isNonInteractive() {
17
- return process.env.CI === "true" || !process.stdout.isTTY;
18
- }
19
- function isPluginInstalled() {
20
- if (!fs.existsSync(INSTALLED_PLUGINS_FILE)) {
21
- return false;
22
- }
23
- try {
24
- const data = JSON.parse(fs.readFileSync(INSTALLED_PLUGINS_FILE, "utf-8"));
25
- return !!data?.plugins?.[PLUGIN_ID];
26
- }
27
- catch {
28
- return false;
29
- }
30
- }
31
- function runInstall() {
32
- try {
33
- const marketplace = spawnSync("claude", ["plugin", "marketplace", "add", "medusajs/medusa-agent-skills"], { stdio: "inherit" });
34
- if (marketplace.error) {
35
- return false;
36
- }
37
- const install = spawnSync("claude", ["plugin", "install", PLUGIN_ID], {
38
- stdio: "inherit",
39
- });
40
- return !install.error;
41
- }
42
- catch {
43
- return false;
44
- }
45
- }
46
- export async function promptClaudeCodePlugin() {
47
- if (isNonInteractive() || !isClaudeCodePresent() || isPluginInstalled()) {
48
- return;
49
- }
50
- const configStore = new Store();
51
- console.log(configStore.config_.path);
52
- if (configStore.getConfig(CONFIG_KEY)) {
53
- return;
54
- }
55
- configStore.setConfig(CONFIG_KEY, true);
56
- const { install } = await inquirer.prompt([
57
- {
58
- type: "confirm",
59
- name: "install",
60
- message: "Working with Medusa is easier with the Medusa Plugin for Claude Code. Would you like to install it?",
61
- default: true,
62
- },
63
- ]);
64
- track("CMA_CLAUDE_CODE_PLUGIN_PROMPT", {
65
- install,
66
- });
67
- if (!install) {
68
- return;
69
- }
70
- const success = runInstall();
71
- if (!success) {
72
- logMessage({
73
- message: `Could not auto-install. To install manually, open Claude Code in your project and run:\n\n /plugin marketplace add medusajs/medusa-agent-skills\n`,
74
- });
75
- }
76
- }
@@ -1,77 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { isAbortError } from "./create-abort-controller.js";
4
- import execute from "./execute.js";
5
- import logMessage from "./log-message.js";
6
- import { execFileSync } from "child_process";
7
- const DEFAULT_REPO = "https://github.com/medusajs/dtc-starter";
8
- const DEFAULT_PLUGIN_REPO = "https://github.com/medusajs/medusa-starter-plugin";
9
- const BRANCH = "main";
10
- const PLUGIN_BRANCH = "main";
11
- export default async function cloneRepo({ directoryName = "", repoUrl, abortController, verbose = false, isPlugin = false, }) {
12
- const defaultRepo = isPlugin ? DEFAULT_PLUGIN_REPO : DEFAULT_REPO;
13
- const branch = isPlugin ? PLUGIN_BRANCH : BRANCH;
14
- await execute([
15
- `git clone ${repoUrl || defaultRepo} -b ${branch} ${directoryName} --depth 1`,
16
- {
17
- signal: abortController?.signal,
18
- },
19
- ], { verbose });
20
- }
21
- export async function runCloneRepo({ projectName, repoUrl, abortController, spinner, verbose = false, isPlugin = false, }) {
22
- try {
23
- await cloneRepo({
24
- directoryName: projectName,
25
- repoUrl,
26
- abortController,
27
- verbose,
28
- isPlugin,
29
- });
30
- deleteGitDirectory(projectName);
31
- }
32
- catch (e) {
33
- if (isAbortError(e)) {
34
- process.exit();
35
- }
36
- spinner.stop();
37
- logMessage({
38
- message: `An error occurred while setting up your project: ${e}`,
39
- type: "error",
40
- });
41
- }
42
- }
43
- function deleteGitDirectory(projectDirectory) {
44
- try {
45
- fs.rmSync(path.join(projectDirectory, ".git"), {
46
- recursive: true,
47
- force: true,
48
- });
49
- }
50
- catch (error) {
51
- deleteWithCommand(projectDirectory, ".git");
52
- }
53
- try {
54
- fs.rmSync(path.join(projectDirectory, ".github"), {
55
- recursive: true,
56
- force: true,
57
- });
58
- }
59
- catch (error) {
60
- deleteWithCommand(projectDirectory, ".github");
61
- }
62
- }
63
- /**
64
- * Useful for deleting directories when fs methods fail (e.g., with Yarn v3)
65
- */
66
- function deleteWithCommand(projectDirectory, dirName) {
67
- const dirPath = path.normalize(path.join(projectDirectory, dirName));
68
- if (!fs.existsSync(dirPath)) {
69
- return;
70
- }
71
- if (process.platform === "win32") {
72
- execFileSync("cmd", ["/c", "rmdir", "/s", "/q", dirPath]);
73
- }
74
- else {
75
- execFileSync("rm", ["-rf", dirPath]);
76
- }
77
- }
@@ -1,11 +0,0 @@
1
- export default (processManager) => {
2
- const abortController = new AbortController();
3
- processManager.onTerminated(() => abortController.abort());
4
- return abortController;
5
- };
6
- export const isAbortError = (e) => e !== null && typeof e === "object" && "code" in e && e.code === "ABORT_ERR";
7
- export const getAbortError = () => {
8
- return {
9
- code: "ABORT_ERR",
10
- };
11
- };
@@ -1,188 +0,0 @@
1
- import { EOL } from "os";
2
- import postgresClient, { DEFAULT_HOST, DEFAULT_PORT, } from "./postgres-client.js";
3
- import inquirer from "inquirer";
4
- import logMessage from "./log-message.js";
5
- import formatConnectionString from "./format-connection-string.js";
6
- import terminalLink from "terminal-link";
7
- export default async function createDb({ client, db }) {
8
- await client.query(`CREATE DATABASE "${db}"`);
9
- }
10
- async function doesDbExist(client, dbName) {
11
- const result = await client.query(`SELECT datname FROM pg_catalog.pg_database WHERE datname='${dbName}';`);
12
- return !!result.rowCount;
13
- }
14
- export async function runCreateDb({ client, dbName, spinner, }) {
15
- let newClient = client;
16
- try {
17
- // create postgres database
18
- await createDb({
19
- client,
20
- db: dbName,
21
- });
22
- // create a new connection with database selected
23
- await client.end();
24
- newClient = await postgresClient({
25
- user: client.user,
26
- password: client.password,
27
- database: dbName,
28
- });
29
- }
30
- catch (e) {
31
- spinner.stop();
32
- logMessage({
33
- message: `An error occurred while trying to create your database: ${e}`,
34
- type: "error",
35
- });
36
- }
37
- return newClient;
38
- }
39
- /**
40
- * Connects to the server's `postgres` maintenance database, falling back to the
41
- * connection's default database (which Postgres resolves to the username).
42
- */
43
- async function connectToMaintenanceDb(connection) {
44
- try {
45
- return await postgresClient({
46
- ...connection,
47
- database: "postgres",
48
- });
49
- }
50
- catch (e) {
51
- return await postgresClient(connection);
52
- }
53
- }
54
- async function getForDbName({ dbName, verbose = false, }) {
55
- let client;
56
- let postgresUsername = "postgres";
57
- let postgresPassword = "";
58
- const defaultConnectionOptions = {
59
- host: DEFAULT_HOST,
60
- port: DEFAULT_PORT,
61
- };
62
- try {
63
- client = await postgresClient({
64
- user: postgresUsername,
65
- password: postgresPassword,
66
- ...defaultConnectionOptions,
67
- });
68
- }
69
- catch (e) {
70
- if (verbose) {
71
- logMessage({
72
- message: `The following error occurred when connecting to the database: ${e}`,
73
- type: "verbose",
74
- });
75
- }
76
- logMessage({
77
- message: `${EOL}Couldn't connect to PostgreSQL with the default credentials (user "postgres" without a password).${EOL}Medusa needs to connect to your PostgreSQL server to create the database of your project, so please enter your PostgreSQL credentials below.${EOL}`,
78
- });
79
- // ask for the user's postgres credentials
80
- const answers = await inquirer.prompt([
81
- {
82
- type: "input",
83
- name: "postgresUsername",
84
- message: "Enter your Postgres username",
85
- default: "postgres",
86
- validate: (input) => {
87
- return typeof input === "string" && input.length > 0;
88
- },
89
- },
90
- {
91
- type: "password",
92
- name: "postgresPassword",
93
- message: "Enter your Postgres password",
94
- },
95
- {
96
- type: "input",
97
- name: "newDbName",
98
- message: "Enter the name of the database to create for your Medusa project",
99
- default: dbName,
100
- validate: (input) => {
101
- return typeof input === "string" && input.length > 0;
102
- },
103
- },
104
- ]);
105
- postgresUsername = answers.postgresUsername;
106
- postgresPassword = answers.postgresPassword;
107
- dbName = answers.newDbName;
108
- try {
109
- client = await connectToMaintenanceDb({
110
- user: postgresUsername,
111
- password: postgresPassword,
112
- ...defaultConnectionOptions,
113
- });
114
- }
115
- catch (e) {
116
- logMessage({
117
- message: `Couldn't connect to PostgreSQL because of the following error: ${e}.${EOL}${EOL}Make sure you have PostgreSQL installed and the credentials you provided are correct.${EOL}${EOL}If you keep running into this issue despite having PostgreSQL installed, please check out our ${terminalLink("troubleshooting guides", "https://docs.medusajs.com/resources/troubleshooting/database-errors")}.`,
118
- type: "error",
119
- });
120
- }
121
- }
122
- // check if database exists
123
- if (await doesDbExist(client, dbName)) {
124
- const { newDbName } = await inquirer.prompt([
125
- {
126
- type: "input",
127
- name: "newDbName",
128
- message: `A database already exists with the name ${dbName}, please enter a name for the database:`,
129
- default: dbName,
130
- validate: (input) => {
131
- return (typeof input === "string" && input.length > 0 && input !== dbName);
132
- },
133
- },
134
- ]);
135
- dbName = newDbName;
136
- }
137
- // format connection string
138
- const dbConnectionString = formatConnectionString({
139
- user: postgresUsername,
140
- password: postgresPassword,
141
- host: client.host,
142
- db: dbName,
143
- });
144
- return {
145
- client,
146
- dbConnectionString,
147
- dbName,
148
- };
149
- }
150
- async function getForDbUrl({ dbUrl, verbose = false, }) {
151
- let client;
152
- try {
153
- client = await postgresClient({
154
- connectionString: dbUrl,
155
- });
156
- }
157
- catch (e) {
158
- if (verbose) {
159
- logMessage({
160
- message: `The following error occurred when connecting to the database: ${e}`,
161
- type: "verbose",
162
- });
163
- }
164
- logMessage({
165
- message: `Couldn't connect to PostgreSQL using the database URL you passed. Make sure it's correct and try again.`,
166
- type: "error",
167
- });
168
- }
169
- return {
170
- client,
171
- dbConnectionString: dbUrl,
172
- };
173
- }
174
- export async function getDbClientAndCredentials({ dbName = "", dbUrl = "", verbose = false, }) {
175
- // Check the db-url first, because the dbName is always defined in MedusaProjectCreator->create()->initializeProject()->setupDatabase()
176
- if (dbUrl) {
177
- return await getForDbUrl({
178
- dbUrl,
179
- verbose,
180
- });
181
- }
182
- else {
183
- return await getForDbName({
184
- dbName,
185
- verbose,
186
- });
187
- }
188
- }
@@ -1,51 +0,0 @@
1
- import { exec, spawnSync } from "child_process";
2
- import util from "util";
3
- import { getAbortError } from "./create-abort-controller.js";
4
- const promiseExec = util.promisify(exec);
5
- const execute = async (command, { verbose = false, needOutput = false }) => {
6
- if (verbose) {
7
- const [commandStr, options] = command;
8
- const childProcess = spawnSync(commandStr, {
9
- ...options,
10
- shell: true,
11
- stdio: needOutput
12
- ? "pipe"
13
- : [process.stdin, process.stdout, process.stderr],
14
- env: {
15
- ...process.env,
16
- ...(options.env || {}),
17
- },
18
- });
19
- if (childProcess.error || childProcess.status !== 0) {
20
- throw (childProcess.error ||
21
- childProcess.stderr?.toString() ||
22
- `${commandStr} failed with status ${childProcess.status}`);
23
- }
24
- if (childProcess.signal &&
25
- ["SIGINT", "SIGTERM"].includes(childProcess.signal)) {
26
- throw getAbortError();
27
- }
28
- if (needOutput) {
29
- console.log(childProcess.stdout?.toString() || childProcess.stderr?.toString());
30
- }
31
- return {
32
- stdout: childProcess.stdout?.toString() || "",
33
- stderr: childProcess.stderr?.toString() || "",
34
- };
35
- }
36
- else {
37
- const [commandStr, options] = command;
38
- const childProcess = await promiseExec(commandStr, {
39
- ...options,
40
- env: {
41
- ...process.env,
42
- ...(options?.env || {}),
43
- },
44
- });
45
- return {
46
- stdout: childProcess.stdout,
47
- stderr: childProcess.stderr,
48
- };
49
- }
50
- };
51
- export default execute;