Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Release v1.0.4
Browse files Browse the repository at this point in the history
Initial plugin to create the elemental resources to host a AWS Video Services

- Added shim for older versions of Amplify

Please note this uses lambda functions to deploy the resources as there is no cloudformation support for elemental yet.
  • Loading branch information
wizage committed Jun 27, 2019
1 parent e6e8a2f commit 1f3bacd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion extensions/livestream-push.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ async function copyFilesToS3(context, options, props) {
const { amplify } = context;
const targetDir = amplify.pathManager.getBackendDirPath();
const targetBucket = amplify.getProjectMeta().providers.awscloudformation.DeploymentBucketName;
const provider = context.amplify.getPluginInstance(context, options.providerPlugin);
var provider;
if ( typeof context.amplify.getPluginInstance === "function"){
provider = context.amplify.getPluginInstance(context, options.providerPlugin);
} else {
console.log("Falling back to old version of getting AWS SDK. If you see this error you are running an old version of Amplify. Please update as soon as possible!");
provider = getPluginInstanceShim(context, options.providerPlugin);
}

const aws = await provider.getConfiguredAWSClient(context);
const s3Client = new aws.S3();
Expand Down Expand Up @@ -358,3 +364,17 @@ async function serviceQuestions(context, resourceName) {

return props;
}

/*
Shim for old versions of amplify.
*/
function getPluginInstanceShim(context, pluginName) {
const { plugins } = context.runtime;
const pluginObj = plugins.find((plugin) => {
const nameSplit = plugin.name.split('-');
return (nameSplit[nameSplit.length - 1] === pluginName);
});
if (pluginObj) {
return require(pluginObj.directory);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-category-video",
"version": "1.0.3",
"version": "1.0.4",
"description": "Plugin for Amplify to add support for live streaming. Made for Unicorn Trivia Workshop",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 1f3bacd

Please sign in to comment.