diff --git a/src/utils/misc.test.ts b/src/utils/misc.test.ts index a98fb98a..38c1d819 100644 --- a/src/utils/misc.test.ts +++ b/src/utils/misc.test.ts @@ -478,7 +478,7 @@ describe('getBuildCommands', () => { ]); }); - it('should get build commands 10', () => { + it('should get build commands 12', () => { process.env.INPUT_PACKAGE_MANAGER = 'yarn'; process.env.INPUT_DELETE_NODE_MODULES = 'true'; process.env.INPUT_BUILD_COMMAND = 'tsc && yarn ncc build lib/main.js && rm -rf lib'; @@ -491,6 +491,16 @@ describe('getBuildCommands', () => { ...clean(buildDir1), ]); }); + + it('should get build commands 13', () => { + process.env.INPUT_PACKAGE_MANAGER = 'npm'; + process.env.INPUT_BUILD_COMMAND = 'npm ci && npm run package'; + expect(getBuildCommands(buildDir7, pushDir)).toEqual([ + 'npm ci', + 'npm run package', + ...clean(buildDir7), + ]); + }); }); describe('detectBuildCommands', () => { diff --git a/src/utils/misc.ts b/src/utils/misc.ts index f6ec6597..1f8ae8f6 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -98,7 +98,7 @@ export const getBuildCommands = (buildDir: string, pushDir: string): Array command.includes(`${runCommand}install`)).length; + const hasInstallCommand = commands.some(command => command.includes(`${pkgManager} install`) || command.includes('npm ci')); const buildCommands = detectBuildCommands(buildDir, runCommand, commands); const deleteNodeModules = Utils.getBoolValue(getInput('DELETE_NODE_MODULES'));