Skip to content
Permalink
Browse files
fix(restore-util): properly support long and short platform names (#880)
* fix(GH-878): Fix platform restoration from package.json

* fix(restore-util): support long and short platform names

i.e. both <PLATFORM> and cordova-<PLATFORM>

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
  • Loading branch information
breautek and raphinesse committed Sep 26, 2021
1 parent 33ce4fe commit 2093004dc4ebcaba0c3b9bcf9c1cb5df427a5e90
Showing 2 changed files with 17 additions and 1 deletion.
@@ -212,6 +212,22 @@ describe('cordova/restore-util', () => {
});
});

it('Test#007 : should find platform spec', () => {
setPkgJson('cordova.platforms', ['android']);
setPkgJson('devDependencies', {
'cordova-android': '1.0.0'
});

return restore.installPlatformsFromConfigXML(['android'], {}).then(() => {
expect(cordovaPlatform.add).toHaveBeenCalledWith(
jasmine.anything(),
jasmine.anything(),
['android@1.0.0'],
jasmine.anything()
);
});
});

it('Test#016 : should restore platforms & plugins and create a missing package.json', () => {
getCfg()
.addEngine(testPlatform)
@@ -108,7 +108,7 @@ function installPlatformsFromConfigXML (platforms, opts) {

const platformInfo = platformIDs.map(plID => ({
name: plID,
spec: specs[plID]
spec: specs[`cordova-${plID}`] || specs[plID]
}));

let platformName = '';

0 comments on commit 2093004

Please sign in to comment.