Skip to content

Commit

Permalink
fix(amplify-provider-awscloudformation): fix redundant upload message (
Browse files Browse the repository at this point in the history
…aws-amplify#5429)

Update the s3 utility accept a parameter which disables printing upload message. Updated Appsync file
upload utility to print upload message only once. Migrated S3 class to typescript

fix aws-amplify#5393
  • Loading branch information
yuth authored Sep 29, 2020
1 parent 398d98b commit 3076b05
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 242 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ module.exports = {
'/packages/graphql-transformer-*/lib',
'/packages/amplify-headless-interface/lib',
'/packages/amplify-util-headless-input/lib',
'/packages/amplify-provider-awscloudformation/lib',

// Ignore CHANGELOG.md files
'/packages/*/CHANGELOG.md'
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
packages/amplify-headless-interface/**/*.schema.json
packages/*/CHANGELOG.md
packages/amplify-cli-core/src/__tests__/testFiles
packages/amplify-provider-awscloudformation/lib/
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs-extra');
const path = require('path');
const inquirer = require('inquirer');
const sequential = require('promise-sequential');
const S3 = require('./aws-utils/aws-s3');
const { S3 } = require('./aws-utils/aws-s3');
const { getConfiguredAmplifyClient } = require('./aws-utils/aws-amplify');
const constants = require('./constants');
const { checkAmplifyServiceIAMPermission } = require('./amplify-service-permission-check');
Expand Down Expand Up @@ -396,7 +396,7 @@ async function searchAmplifyService(amplifyClient, stackName) {
}

function storeArtifactsForAmplifyService(context) {
return new S3(context).then(async s3 => {
return S3.getInstance(context).then(async s3 => {
const currentCloudBackendDir = context.amplify.pathManager.getCurrentCloudBackendDirPath();
const amplifyMetaFilePath = path.join(currentCloudBackendDir, 'amplify-meta.json');
const backendConfigFilePath = path.join(currentCloudBackendDir, 'backend-config.json');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chalk = require('chalk');
const columnify = require('columnify');

const aws = require('./aws.js');
const S3 = require('./aws-s3');
const { S3 } = require('./aws-s3');
const providerName = require('../constants').ProviderName;
const { formUserAgentParam } = require('./user-agent');
const configurationManager = require('../configuration-manager');
Expand Down Expand Up @@ -207,13 +207,13 @@ class CloudFormation {
throw new Error('Project deployment bucket has not been created yet. Use amplify init to initialize the project.');
}

return new S3(this.context)
return S3.getInstance(this.context)
.then(s3 => {
const s3Params = {
Body: fs.createReadStream(filePath),
Key: cfnFile,
};
return s3.uploadFile(s3Params);
return s3.uploadFile(s3Params, false);
})
.then(bucketName => {
const templateURL = `https://s3.amazonaws.com/${bucketName}/${cfnFile}`;
Expand Down
218 changes: 0 additions & 218 deletions packages/amplify-provider-awscloudformation/src/aws-utils/aws-s3.js

This file was deleted.

Loading

0 comments on commit 3076b05

Please sign in to comment.