Skip to content

Commit 389c154

Browse files
committed
fix(semantic-release): run npm install inside the dist folder
1 parent 9e2bc98 commit 389c154

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

semantic-release/dist/index.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semantic-release/dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semantic-release/src/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ interface Inputs {
4040
* @param packages List of packages to install
4141
*/
4242
async function runNpmInstall(packages: string[]) {
43-
info(`Installing packages in ${path.resolve(__dirname, "..")}`);
43+
// When the action is compiled with NCC this translates into the dist folder
44+
// This is important so that there are no conflicts with any dev tool we are using
45+
const installationPath = path.resolve(__dirname);
46+
info(`Installing packages in ${installationPath}`);
4447
const silentFlag = process.env.RUNNER_DEBUG === "1" ? "" : "--silent";
4548
const data = await getExecOutput(
4649
"npm",
4750
["install", ...packages, "--no-audit", silentFlag],
4851
{
49-
cwd: path.resolve(__dirname, ".."),
52+
cwd: path.resolve(installationPath),
5053
},
5154
);
5255
if (data.stderr !== "") {

semantic-release/test/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe("semantic-release", () => {
9797
"--silent",
9898
]
9999
`);
100-
expect(options).toHaveProperty("cwd", expect.any(String));
100+
expect(options).toHaveProperty("cwd", expect.stringContaining("/src"));
101101
expect(semanticReleaseMock).toHaveBeenCalledTimes(1);
102102
expect(semanticReleaseMock.mock.calls[0][0]).toMatchInlineSnapshot(`
103103
{

0 commit comments

Comments
 (0)