Skip to content

Commit

Permalink
Revert problematic PRs (#4803)
Browse files Browse the repository at this point in the history
* feat(amplify-provider-awscloudformation): add region ca-central-1

* fix test

* Revert "Add region ca-central-1 (#4796)"

This reverts commit af29f35.

* Revert "feat: add check for extra command line args provided with amplify delete (#4576)"

This reverts commit 48b27b7.

* Revert "perf: fulfill promises to upload files to S3 concurrently (#4575)"

This reverts commit 9fbee8a.

* Revert "fix(cli): remove unnecessary stack trace log when adding services (#4610)"

This reverts commit 56efb32.

* Revert "fix test"

This reverts commit 50a8073fbbdb56931191912938fb50f542197832.

Co-authored-by: UnleashedMind <zhoweimi@186590ce137f.ant.amazon.com>
  • Loading branch information
UnleashedMind and UnleashedMind committed Jul 10, 2020
1 parent af29f35 commit f21a0f4
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 259 deletions.
1 change: 1 addition & 0 deletions packages/amplify-category-analytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/amplify-category-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function migrate(context, serviceName) {
if (providerController) {
if (!serviceName || serviceName === amplifyMeta[category][resourceName].service) {
migrateResourcePromises.push(
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName),
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName)
);
}
}
Expand Down Expand Up @@ -149,7 +149,7 @@ async function getPermissionPolicies(context, resourceOpsMapping) {
context,
amplifyMeta[category][resourceName].service,
resourceName,
resourceOpsMapping[resourceName],
resourceOpsMapping[resourceName]
);
permissionPolicies.push(policy);
resourceAttributes.push({ resourceName, attributes, category });
Expand All @@ -171,6 +171,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-category-auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { readdirSync, existsSync } = require('fs');
const { createReadStream } = require('fs-extra');
const Ora = require('ora');
const mime = require('mime-types');
const sequential = require('promise-sequential');
const { getAuthResourceName } = require('../../../utils/getAuthResourceName');

const providerName = 'awscloudformation';
Expand Down Expand Up @@ -29,12 +30,15 @@ async function uploadFiles(context) {
return null;
}
const fileList = readdirSync(assetPath);
const uploadFileTasks = fileList.map((file) => uploadFile(s3Client, bucketName, `${assetPath}/${file}`, file));
const uploadFileTasks = [];
fileList.forEach(file => {
uploadFileTasks.push(async () => await uploadFile(s3Client, bucketName, `${assetPath}/${file}`, file));
});

const spinner = new Ora('Uploading files...');
try {
spinner.start();
await Promise.all(uploadFileTasks);
await sequential(uploadFileTasks);
spinner.succeed('Uploaded files successfully.');
} catch (e) {
spinner.fail('Error has occurred during file upload.');
Expand Down
47 changes: 0 additions & 47 deletions packages/amplify-category-auth/tests/commands/push.test.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/amplify-category-function/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs-extra');
const path = require('path');
const Ora = require('ora');
const mime = require('mime-types');
const sequential = require('promise-sequential');
const fileScanner = require('./file-scanner');
const constants = require('../../constants');

Expand All @@ -14,6 +15,7 @@ async function run(context, distributionDirPath) {
const { output } = context.exeInfo.amplifyMeta[category][serviceName];
const fileList = fileScanner.scan(context, distributionDirPath, WebsiteConfiguration);

const uploadFileTasks = [];
const s3Client = await getS3Client(context, 'update');
const hostingBucketName = getHostingBucketName(context);

Expand All @@ -25,14 +27,14 @@ async function run(context, distributionDirPath) {
cloudFrontS3CanonicalUserId = originAccessIdentity.S3CanonicalUserId;
}

const uploadFileTasks = fileList.map((filePath) =>
uploadFile(s3Client, hostingBucketName, distributionDirPath, filePath, cloudFrontS3CanonicalUserId)
);
fileList.forEach(filePath => {
uploadFileTasks.push(() => uploadFile(s3Client, hostingBucketName, distributionDirPath, filePath, cloudFrontS3CanonicalUserId));
});

const spinner = new Ora('Uploading files...');
try {
spinner.start();
await Promise.all(uploadFileTasks);
await sequential(uploadFileTasks);
spinner.succeed('Uploaded files successfully.');
} catch (e) {
spinner.fail('Error has occurred during file upload.');
Expand Down
5 changes: 3 additions & 2 deletions packages/amplify-category-interactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function migrate(context) {
const providerController = require(`./provider-utils/${amplifyMeta[category][resourceName].providerPlugin}/index`);
if (providerController) {
migrateResourcePromises.push(
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName),
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName)
);
} else {
context.print.error(`Provider not configured for ${category}: ${resourceName}`);
Expand Down Expand Up @@ -42,7 +42,7 @@ async function getPermissionPolicies(context, resourceOpsMapping) {
context,
amplifyMeta[category][resourceName].service,
resourceName,
resourceOpsMapping[resourceName],
resourceOpsMapping[resourceName]
);
permissionPolicies.push(policy);
resourceAttributes.push({ resourceName, attributes, category });
Expand All @@ -64,6 +64,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-category-notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = {
}
})
.catch(err => {
context.print.error(err.message);
context.print.info(err.stack);
context.print.error('An error occurred when removing the predictions resource');
context.usageData.emitError(err);
});
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-category-predictions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/amplify-category-storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function migrate(context) {
const providerController = require(`./provider-utils/${amplifyMeta[category][resourceName].providerPlugin}/index`);
if (providerController) {
migrateResourcePromises.push(
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName),
providerController.migrateResource(context, projectPath, amplifyMeta[category][resourceName].service, resourceName)
);
} else {
context.print.error(`Provider not configured for ${category}: ${resourceName}`);
Expand Down Expand Up @@ -68,7 +68,7 @@ async function getPermissionPolicies(context, resourceOpsMapping) {
context,
service,
resourceName,
resourceOpsMapping[resourceName],
resourceOpsMapping[resourceName]
);
permissionPolicies.push(policy);
resourceAttributes.push({ resourceName, attributes, category });
Expand All @@ -90,6 +90,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
1 change: 1 addition & 0 deletions packages/amplify-category-xr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ async function executeAmplifyCommand(context) {
} else {
commandPath = path.join(commandPath, category, context.input.command);
}

const commandModule = require(commandPath);
await commandModule.run(context);
}
Expand Down
96 changes: 0 additions & 96 deletions packages/amplify-cli/src/__tests__/commands/delete.test.ts

This file was deleted.

46 changes: 0 additions & 46 deletions packages/amplify-cli/src/__tests__/executeAmplifyCommand.test.ts

This file was deleted.

0 comments on commit f21a0f4

Please sign in to comment.