Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/utils/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const getBuildCommands = (buildDir: string, pushDir: string): Array<Comma
const pkgManager = Utils.useNpm(buildDir, getInput('PACKAGE_MANAGER')) ? 'npm' : 'yarn';
const runSubCommand = pkgManager === 'npm' ? ' run ' : ' ';
const runCommand = [pkgManager, runSubCommand].join('');
const hasInstallCommand = !!commands.filter(command => 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'));

Expand Down