Skip to content

Commit

Permalink
chore(android): bump ti.playservices to 16.1.3 (#10867)
Browse files Browse the repository at this point in the history
* chore(android): bump ti.playservices to 16.1.3

* fix: fix download method and cleanup modules-integrity

* chore(android): update ti.playservices hash
  • Loading branch information
garymathews committed May 1, 2019
1 parent c4a01b3 commit bdc0cc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Utils.generateSSRIHashFromURL = async function (url) {

const downloadPath = cachedDownloadPath(url);
await fs.remove(downloadPath);
const file = await promisify(download)(url, downloadPath);
const file = await download(url, downloadPath);
return ssri.fromStream(fs.createReadStream(file));
};

Expand Down
43 changes: 19 additions & 24 deletions build/scons-modules-integrity.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const modulesPath = path.join(__dirname, '../support/module/packaged/modules.jso

/**
* Re-generates a new integrity value for a given module's url property
* @param {object} modObj the module object from modules.json
* @param {string} modName the name of the module
* @param {object} moduleObject the module object from modules.json
* @param {string} moduleName the name of the module
* @returns {Promise<object>}
*/
async function handleModule(modObj, modName) {
const hash = await utils.generateSSRIHashFromURL(modObj.url);
const obj = {};
modObj.integrity = hash.toString();
obj[modName] = modObj;
return obj;
async function handleModule(moduleObject, moduleName) {
const hash = await utils.generateSSRIHashFromURL(moduleObject.url);
moduleObject.integrity = hash.toString();
return {
[moduleName]: moduleObject
};
}

/**
Expand All @@ -26,18 +26,14 @@ async function handleModule(modObj, modName) {
* @returns {Promise<object>}
*/
async function handlePlatform(modules, platform) {
const platformModuleNames = Object.keys(modules[platform]);
// for each entry in platformModuleNames, handleModule
const modifiedModules = await Promise.all(platformModuleNames.map(modName => {
const modObj = modules[platform][modName];
return handleModule(modObj, modName);
}));
const moduleNames = Object.keys(modules[platform]);

let updatedModules = await Promise.all(moduleNames.map(name => handleModule(modules[platform][name], name)));

// Merge the modules array into a single object
const merged = Object.assign({}, ...modifiedModules);
const platformObj = {};
platformObj[platform] = merged;
return platformObj;
return {
[platform]: Object.assign({}, ...updatedModules)
};
}

async function main() {
Expand All @@ -47,17 +43,16 @@ async function main() {
}

const modules = require(modulesPath); // eslint-disable-line security/detect-non-literal-require

const platforms = Object.keys(modules);
const results = await Promise.all(platforms.map(p => handlePlatform(modules, p)));
// Merge the platforms array into a single object
const merged = Object.assign({}, ...results);
const formattedJSON = JSON.stringify(merged, null, '\t');

console.log('Attempting to download...');

let results = await Promise.all(platforms.map(platform => handlePlatform(modules, platform)));

console.log('\nUpdating modules.json ...');

// Write updated modules.json to filesystem
await fs.writeFile(modulesPath, formattedJSON);
await fs.writeJson(modulesPath, Object.assign({}, ...results), { spaces: '\t' });
console.log('Successfully updated modules.json!');
}

Expand Down
6 changes: 3 additions & 3 deletions support/module/packaged/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"integrity": "sha512-G30ZTwV1VI+GI5FmRWJLGZUQgckvMYTiX7mYhWDLCGZac8cSQDpG4xylJlSp6B/isNqa6TBX4ZPE3ieJ50p0mA=="
},
"ti.playservices": {
"url": "https://github.com/appcelerator-modules/ti.playservices/releases/download/16.1.2/ti.playservices-android-16.1.2.zip",
"integrity": "sha512-IKcj16f1a1FE8cdacwmK6uICNy8MbMe+2BdCLu6ufSb1eQT3G8PiOPAVTJSsc5luiSvPshJaZ2OJIhvKXkWB8Q=="
"url": "https://github.com/appcelerator-modules/ti.playservices/releases/download/16.1.3/ti.playservices-android-16.1.3.zip",
"integrity": "sha512-RLMty/5JrQLvu6qtns9/3VBrAWBHu9L0SUYjkTnHpPu7yWb91z830XS+E8WiwSY1X1jVCX1vBi1Ll+8HVK9F5w=="
},
"ti.identity": {
"url": "https://github.com/appcelerator-modules/titanium-identity/releases/download/android-2.1.0/ti.identity-android-2.1.0.zip",
Expand All @@ -75,4 +75,4 @@
"integrity": "sha512-oKxHxWEyW1K+6/XgMoXB8Lt4+aZh4yl6L/+Q0F0lr1IlHkgfEUzzUVDsGfJOJ/KCDfP2WYXFKLz4VssJDJRHWg=="
}
}
}
}

0 comments on commit bdc0cc9

Please sign in to comment.