Skip to content

Commit

Permalink
Merge branch 'dev' into dependabot-221-follow-redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
0.618 committed Apr 4, 2024
2 parents 9f58065 + 395f717 commit 8635929
Show file tree
Hide file tree
Showing 29 changed files with 324 additions and 281 deletions.
2 changes: 2 additions & 0 deletions .eslint-dictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"admingroup",
"adminui",
"aggs",
"al2023",
"allowlist",
"alphanumerics",
"amazonaws",
Expand Down Expand Up @@ -198,6 +199,7 @@
"igrantable",
"indexable",
"indicies",
"Infos",
"integ",
"integtest",
"integtestfn",
Expand Down
11 changes: 9 additions & 2 deletions codebuild_specs/e2e_workflow_generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,18 @@ batch:
TEST_SUITE: src/__tests__/api_6a.test.ts|src/__tests__/auth_7b.test.ts|src/__tests__/export-pull-b.test.ts
depend-on:
- upb
- identifier: l_function_3a_init_special_case_http_migration
- identifier: l_function_3a_dotnet_function_3a_go_function_3a_nodejs
buildspec: codebuild_specs/run_e2e_tests_linux.yml
env:
variables:
TEST_SUITE: src/__tests__/function_3a.test.ts|src/__tests__/init-special-case.test.ts|src/__tests__/transformer-migrations/http-migration.test.ts
TEST_SUITE: src/__tests__/function_3a_dotnet.test.ts|src/__tests__/function_3a_go.test.ts|src/__tests__/function_3a_nodejs.test.ts
depend-on:
- upb
- identifier: l_function_3a_python_init_special_case_http_migration
buildspec: codebuild_specs/run_e2e_tests_linux.yml
env:
variables:
TEST_SUITE: src/__tests__/function_3a_python.test.ts|src/__tests__/init-special-case.test.ts|src/__tests__/transformer-migrations/http-migration.test.ts
depend-on:
- upb
- identifier: l_schema_auth_12_schema_auth_3_schema_function_2
Expand Down
3 changes: 2 additions & 1 deletion codebuild_specs/wait_for_ids.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"l_function_1_storage_5",
"l_function_2b_function_7_api_connection_migration2",
"l_function_2c_function_3b_function_4",
"l_function_3a_init_special_case_http_migration",
"l_function_3a_dotnet_function_3a_go_function_3a_nodejs",
"l_function_3a_python_init_special_case_http_migration",
"l_function_6_storage_2_export",
"l_function_8_schema_iterative_update_locking_api_lambda_auth_2",
"l_general_config_headless_init_help_hooks_c",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"link-dev": "mkdir -p .bin/ && cd packages/amplify-cli && ln -s \"$(pwd)/bin/amplify\" ../../.bin/amplify-dev && cd ../../",
"link-win": "node ./scripts/link-bin.js packages/amplify-cli/bin/amplify amplify-dev",
"lint-check-package-json": "yarn eslint --no-eslintrc --config .eslint.package.json.js '**/package.json'",
"lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=773",
"lint-check": "yarn eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=755",
"lint-fix-package-json": "yarn lint-check-package-json --fix",
"lint-fix": "git diff --name-only --cached --diff-filter d | grep -E '\\.(js|jsx|ts|tsx)$' | xargs eslint --fix --quiet",
"mergewords": "yarn ts-node ./scripts/handle-dict-conflicts.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
AmplifyCategories,
AmplifyCategoryTransform,
AmplifyError,
AmplifyStackTemplate,
AmplifySupportedService,
buildOverrideDir,
CFNTemplateFormat,
Expand All @@ -16,7 +15,6 @@ import {
Template,
writeCFNTemplate,
} from '@aws-amplify/amplify-cli-core';
import { formatter } from '@aws-amplify/amplify-prompts';
import * as cdk from 'aws-cdk-lib';
import * as fs from 'fs-extra';
import _ from 'lodash';
Expand Down Expand Up @@ -95,7 +93,7 @@ export class AmplifyAuthTransform extends AmplifyCategoryTransform {
this.addCfnParameters(props);

// add CFN condition
this.addCfnConditions(props);
this.addCfnConditions();
// generate Resources

await this._authTemplateObj.generateCognitoStackResources(props);
Expand Down Expand Up @@ -544,7 +542,7 @@ export class AmplifyAuthTransform extends AmplifyCategoryTransform {
/**
* adds cfn conditions
*/
private addCfnConditions = (props: CognitoStackOptions): void => {
private addCfnConditions = (): void => {
this._authTemplateObj.addCfnCondition(
{
expression: cdk.Fn.conditionEquals(cdk.Fn.ref('env'), 'NONE'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
AmplifyCategories,
AmplifyCategoryTransform,
AmplifyError,
AmplifyStackTemplate,
AmplifySupportedService,
buildOverrideDir,
CFNTemplateFormat,
Expand All @@ -14,9 +13,7 @@ import {
Template,
writeCFNTemplate,
} from '@aws-amplify/amplify-cli-core';
import { formatter } from '@aws-amplify/amplify-prompts';
import * as cdk from 'aws-cdk-lib';
import * as fs from 'fs-extra';
import * as path from 'path';
import { AuthInputState } from '../auth-inputs-manager/auth-input-state';
import { CognitoCLIInputs } from '../service-walkthrough-types/awsCognito-user-input-types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ export const importedAuthEnvInit = async (
answers.appClientWeb = questionParameters.webClients!.find((c) => c.ClientId! === currentEnvSpecificParameters.webClientId);

if (!answers.appClientWeb) {
printer.error(importMessages.AppClientNotFound('Web', currentEnvSpecificParameters.webClientId));
printer.error(importMessages.AppClientNotFound('Web'));

return {
succeeded: false,
Expand All @@ -1140,7 +1140,7 @@ export const importedAuthEnvInit = async (
answers.appClientNative = questionParameters.nativeClients!.find((c) => c.ClientId! === currentEnvSpecificParameters.nativeClientId);

if (!answers.appClientNative) {
printer.error(importMessages.AppClientNotFound('Native', currentEnvSpecificParameters.nativeClientId));
printer.error(importMessages.AppClientNotFound('Native'));

return {
succeeded: false,
Expand Down Expand Up @@ -1292,15 +1292,15 @@ export const headlessImport = async (

if (!answers.appClientWeb) {
throw new AmplifyError('AuthImportError', {
message: importMessages.AppClientNotFound('Web', resolvedEnvParams.webClientId),
message: importMessages.AppClientNotFound('Web'),
});
}

answers.appClientNative = questionParameters.nativeClients?.find((c) => c.ClientId === resolvedEnvParams.nativeClientId);

if (!answers.appClientNative) {
throw new AmplifyError('AuthImportError', {
message: importMessages.AppClientNotFound('Native', resolvedEnvParams.nativeClientId),
message: importMessages.AppClientNotFound('Native'),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const importMessages = {
`The previously configured Cognito User Pool: '${userPoolName}' (${userPoolId}) cannot be found.`,
IdentityPoolNotFound: (identityPoolName: string, identityPoolId: string) =>
`The previously configured Identity Pool: '${identityPoolName}' (${identityPoolId}) cannot be found.`,
AppClientNotFound: (type: 'Web' | 'Native', clientId: string) => `The previously configured ${type} app client cannot be found.`,
AppClientNotFound: (type: 'Web' | 'Native') => `The previously configured ${type} app client cannot be found.`,
NoAtLeastOneAppClient: (type: 'Web' | 'Native') =>
`The selected Cognito User Pool does not have at least 1 ${type} app client configured. ${type} app clients are app clients ${
type === 'Web' ? 'without' : 'with'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const hasExistingSecrets = (secretDeltas: SecretDeltas) =>
*/
export const getExistingSecrets = (secretDeltas: SecretDeltas) =>
Object.entries(secretDeltas)
.filter(([_, delta]) => existingSecretDeltaPredicate(delta))
.filter(([, delta]) => existingSecretDeltaPredicate(delta))
.reduce((acc, [secretName, secretDelta]) => ({ ...acc, [secretName]: secretDelta }), {} as SecretDeltas);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export function getLayerName(context: $TSContext, layerName: string): string {

export function getLambdaFunctionsDependentOnLayerFromMeta(layerName: string, meta: $TSMeta) {
return Object.entries(meta[categoryName]).filter(
([_, lambdaFunction]: [string, $TSObject]) =>
([, lambdaFunction]: [string, $TSObject]) =>
lambdaFunction.service === ServiceName.LambdaFunction &&
lambdaFunction?.dependsOn?.filter((dependency) => dependency.resourceName === layerName).length > 0,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AmplifyDDBResourceTemplate, getProjectInfo } from '@aws-amplify/cli-extensibility-helper';
import { getProjectInfo } from '@aws-amplify/cli-extensibility-helper';
import { $TSContext, AmplifyError, buildOverrideDir, JSONUtilities, pathManager, runOverride } from '@aws-amplify/amplify-cli-core';
import { formatter } from '@aws-amplify/amplify-prompts';
import * as cdk from 'aws-cdk-lib';
import * as fs from 'fs-extra';
import * as path from 'path';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as cdk from 'aws-cdk-lib';
import { AmplifyS3ResourceTemplate, getProjectInfo } from '@aws-amplify/cli-extensibility-helper';
import { getProjectInfo } from '@aws-amplify/cli-extensibility-helper';
import {
$TSAny,
$TSContext,
Expand All @@ -12,7 +12,6 @@ import {
pathManager,
runOverride,
} from '@aws-amplify/amplify-cli-core';
import { formatter } from '@aws-amplify/amplify-prompts';
import * as fs from 'fs-extra';
import * as path from 'path';
import { S3PermissionType, S3UserInputs } from '../service-walkthrough-types/s3-user-input-types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const ReadMeContent = `# Getting Started with Amplify CLI
This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).
Helpful resources:
- Amplify documentation: https://docs.amplify.aws
- Amplify CLI documentation: https://docs.amplify.aws/cli
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files
- Join Amplify's community: https://amplify.aws/community/
- Amplify documentation: https://docs.amplify.aws.
- Amplify CLI documentation: https://docs.amplify.aws/cli.
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files.
- Join Amplify's community: https://amplify.aws/community/.
`;

export function writeReadMeFile(readMeFilePath: string): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//TODO Remove this whole function once read-json removed from everywhere
import { JSONUtilities, $TSAny } from '@aws-amplify/amplify-cli-core';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function readJsonFile(jsonFilePath, encoding = 'utf8', throwOnError = true): $TSAny {
return JSONUtilities.readJson(jsonFilePath, {
throwIfNotExist: throwOnError,
Expand Down
4 changes: 2 additions & 2 deletions packages/amplify-cli/src/init-steps/s9-onSuccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const onSuccess = async (context: $TSContext): Promise<void> => {
await initializeEnv(context, currentAmplifyMeta);

if (!context.parameters.options?.app) {
printWelcomeMessage(context);
printWelcomeMessage();
}
};

Expand Down Expand Up @@ -217,7 +217,7 @@ const generateHooksSampleDirectory = (context: $TSContext): void => {
stateManager.setSampleHooksDir(projectPath, sampleHookScriptsDirPath);
};

const printWelcomeMessage = (context: $TSContext): void => {
const printWelcomeMessage = (): void => {
printer.success('Your project has been successfully initialized and connected to the cloud!');
printer.info('Some next steps:', 'green');
printer.info(`
Expand Down
Loading

0 comments on commit 8635929

Please sign in to comment.