Skip to content

Commit

Permalink
fix(app-builder): replace composer require with update
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Nov 20, 2024
1 parent 6a5cf1e commit f2fd451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const upgradeComposerPackage = async (context: PdkBuilderUpgradeContext):
const oldVersions = await getComposerPackageVersion(context);

if (!args.dryRun) {
await executeCommand(context, config.composerCommand, ['require', packageName]);
await executeCommand(context, config.composerCommand, ['update', packageName]);
}

return {
Expand Down
8 changes: 4 additions & 4 deletions apps/app-builder/src/commands/upgrade/upgrade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {type UpgradeCommandArgs} from './upgrade.types';

describe('command: upgrade', () => {
const composerShowSpy = vi.fn(() => '{"name":"myparcelnl/pdk","source":{"url":""},"versions":["1.0.0"]}');
const composerRequireSpy = vi.fn(() => '');
const composerUpdateSpy = vi.fn(() => '');
const yarnInfoSpy = vi.fn(() => '{}');
const yarnUpgradeSpy = vi.fn(() => '');

const spyMap = {
'composer show': composerShowSpy,
'composer require': composerRequireSpy,
'composer update': composerUpdateSpy,
'yarn info': yarnInfoSpy,
'yarn up': yarnUpgradeSpy,
};
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('command: upgrade', () => {
await upgrade(context);

expect(composerShowSpy).toHaveBeenCalledWith('composer', ['show', '--format=json', MYPARCEL_PDK_PACKAGIST_NAME]);
expect(composerRequireSpy).toHaveBeenCalledWith('composer', ['require', MYPARCEL_PDK_PACKAGIST_NAME]);
expect(composerUpdateSpy).toHaveBeenCalledWith('composer', ['update', MYPARCEL_PDK_PACKAGIST_NAME]);

expect(yarnInfoSpy).not.toHaveBeenCalled();
expect(yarnUpgradeSpy).not.toHaveBeenCalled();
Expand All @@ -87,7 +87,7 @@ describe('command: upgrade', () => {

expect(yarnInfoSpy).toHaveBeenCalledWith('yarn', ['info', '--all', '--name-only', '--json']);
expect(yarnUpgradeSpy).toHaveBeenCalledWith('yarn', ['up', '-R', packageName]);
expect(composerRequireSpy).not.toHaveBeenCalled();
expect(composerUpdateSpy).not.toHaveBeenCalled();
expect(composerShowSpy).not.toHaveBeenCalled();
});
});

0 comments on commit f2fd451

Please sign in to comment.