Skip to content

Commit 474aaf7

Browse files
committed
remove debug statements
1 parent faa9e7c commit 474aaf7

File tree

1 file changed

+6
-45
lines changed
  • packages/amplify-codegen-e2e-tests/src/gen2-codegen-tests-base

1 file changed

+6
-45
lines changed

packages/amplify-codegen-e2e-tests/src/gen2-codegen-tests-base/commands.ts

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,18 @@ import { spawnSync } from 'child_process';
77
* Retrieve the path to the `npx` executable for interacting with the amplify gen2 cli.
88
* @returns the local `npx` executable path.
99
*/
10-
const getNpxPath = (): string => {
11-
console.log(`DEBUG: process.platform is: ${process.platform}`);
12-
if (process.platform === 'win32') {
13-
const scriptRunnerPath = getScriptRunnerPath();
14-
console.log(`DEBUG: getScriptRunnerPath() returned: ${scriptRunnerPath}`);
15-
const npxPath = scriptRunnerPath.replace('node.exe', 'npx.cmd');
16-
console.log(`DEBUG: Resolved npxPath for Windows: ${npxPath}`);
17-
return npxPath;
18-
} else {
19-
console.log(`DEBUG: Non-Windows platform; using 'npx'`);
20-
return 'npx';
21-
}
22-
};
10+
const getNpxPath = (): string => (process.platform === 'win32' ? getScriptRunnerPath().replace('node.exe', 'npx.cmd') : 'npx');
2311

2412
/**
2513
* Retrieve the path to the `ampx` executable for interacting with the amplify gen2 cli.
2614
* @param cwd current working directory
2715
* @returns the local `ampx` executable path
16+
*
17+
* Note:
18+
* Use shell: true to properly execute the .cmd file on Windows
2819
*/
29-
const getAmpxPath = (cwd: string): string => {
30-
// Retrieve the path to npx
31-
const npxPath = getNpxPath();
32-
console.log(`DEBUG: Resolved npx path: ${npxPath}`);
33-
34-
// Execute the command to find 'ampx'
35-
// Use shell: true to properly execute the .cmd file on Windows
36-
const spawnResult = spawnSync(npxPath, ['which', 'ampx'], { cwd, env: process.env, stdio: 'pipe', shell: true });
37-
38-
// Log the entire result of spawnSync for inspection
39-
console.log('DEBUG: spawnSync result:', spawnResult);
40-
41-
if (spawnResult.error) {
42-
console.error('DEBUG: spawnSync encountered an error:', spawnResult.error);
43-
}
44-
45-
// Log stderr if available
46-
if (spawnResult.stderr) {
47-
console.error('DEBUG: spawnSync stderr:', spawnResult.stderr.toString());
48-
}
49-
50-
// Ensure stdout exists before converting to string
51-
const stdout = spawnResult.stdout;
52-
if (!stdout) {
53-
console.error('DEBUG: No stdout received from spawnSync.');
54-
return '';
55-
}
56-
57-
const result = stdout.toString().trim();
58-
console.log(`DEBUG: Parsed output: "${result}"`);
59-
return result;
60-
};
20+
const getAmpxPath = (cwd: string): string =>
21+
spawnSync(getNpxPath(), ['which', 'ampx'], { cwd, env: process.env, stdio: 'pipe', shell: true }).stdout.toString().trim();
6122

6223
const codegenPackagesInGen2 = [
6324
'@aws-amplify/graphql-generator',

0 commit comments

Comments
 (0)