Skip to content

Commit

Permalink
fix(semantic-release): run npm install inside the dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Sep 12, 2024
1 parent 9e2bc98 commit 389c154
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions semantic-release/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion semantic-release/dist/index.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions semantic-release/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ interface Inputs {
* @param packages List of packages to install
*/
async function runNpmInstall(packages: string[]) {
info(`Installing packages in ${path.resolve(__dirname, "..")}`);
// When the action is compiled with NCC this translates into the dist folder
// This is important so that there are no conflicts with any dev tool we are using
const installationPath = path.resolve(__dirname);
info(`Installing packages in ${installationPath}`);
const silentFlag = process.env.RUNNER_DEBUG === "1" ? "" : "--silent";
const data = await getExecOutput(
"npm",
["install", ...packages, "--no-audit", silentFlag],
{
cwd: path.resolve(__dirname, ".."),
cwd: path.resolve(installationPath),
},
);
if (data.stderr !== "") {
Expand Down
2 changes: 1 addition & 1 deletion semantic-release/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("semantic-release", () => {
"--silent",
]
`);
expect(options).toHaveProperty("cwd", expect.any(String));
expect(options).toHaveProperty("cwd", expect.stringContaining("/src"));
expect(semanticReleaseMock).toHaveBeenCalledTimes(1);
expect(semanticReleaseMock.mock.calls[0][0]).toMatchInlineSnapshot(`
{
Expand Down

0 comments on commit 389c154

Please sign in to comment.