Skip to content
Snippets Groups Projects
Unverified Commit 67eb76d4 authored by Martin Herndl's avatar Martin Herndl Committed by GitHub
Browse files

feat(composer): support composer platform package constraint (#13186)

parent 1f1c86a4
No related merge requests found
...@@ -27,6 +27,18 @@ describe('manager/composer/utils', () => { ...@@ -27,6 +27,18 @@ describe('manager/composer/utils', () => {
).toEqual({ composer: '1.1.0' }); ).toEqual({ composer: '1.1.0' });
}); });
it('returns from composer platform require', () => {
expect(
extractContraints({ require: { php: '^8.1', composer: '2.2.0' } }, {})
).toEqual({ php: '^8.1', composer: '2.2.0' });
});
it('returns from composer platform require-dev', () => {
expect(
extractContraints({ 'require-dev': { composer: '^2.2' } }, {})
).toEqual({ composer: '^2.2' });
});
it('returns from composer-runtime-api', () => { it('returns from composer-runtime-api', () => {
expect( expect(
extractContraints({ require: { 'composer-runtime-api': '^1.1.0' } }, {}) extractContraints({ require: { 'composer-runtime-api': '^1.1.0' } }, {})
......
...@@ -71,6 +71,12 @@ export function extractContraints( ...@@ -71,6 +71,12 @@ export function extractContraints(
} else if (composerJson['require-dev']?.['composer/composer']) { } else if (composerJson['require-dev']?.['composer/composer']) {
res.composer = composerJson['require-dev']?.['composer/composer']; res.composer = composerJson['require-dev']?.['composer/composer'];
} }
// composer platform package
else if (composerJson.require?.['composer']) {
res.composer = composerJson.require?.['composer'];
} else if (composerJson['require-dev']?.['composer']) {
res.composer = composerJson['require-dev']?.['composer'];
}
// check last used composer version // check last used composer version
else if (lockParsed?.['plugin-api-version']) { else if (lockParsed?.['plugin-api-version']) {
const major = api.getMajor(lockParsed?.['plugin-api-version']); const major = api.getMajor(lockParsed?.['plugin-api-version']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment