* Run changeset version command and capture output
()
| 71 | * Run changeset version command and capture output |
| 72 | */ |
| 73 | function runChangesetVersion() { |
| 74 | try { |
| 75 | // Set up git for testing |
| 76 | execSync("git init", { cwd: TEST_DIR, stdio: "ignore" }); |
| 77 | execSync('git config user.email "test@example.com"', { cwd: TEST_DIR, stdio: "ignore" }); |
| 78 | execSync('git config user.name "Test User"', { cwd: TEST_DIR, stdio: "ignore" }); |
| 79 | |
| 80 | // Run version command by requiring and calling main |
| 81 | // Need to set up process.argv properly: [node, scriptname, command, ...] |
| 82 | const output = execSync(`node -e "process.argv.splice(1, 0, 'changeset.js', 'version'); const {main} = require('${CHANGESET_SCRIPT}'); main().catch(console.error);"`, { |
| 83 | cwd: TEST_DIR, |
| 84 | encoding: "utf8", |
| 85 | env: { ...process.env, GH_AW_CURRENT_VERSION: "v0.1.0" }, |
| 86 | }); |
| 87 | return output; |
| 88 | } catch (error) { |
| 89 | return error.stdout || error.message; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Clean up test directory |