diff --git a/package.json b/package.json index 14fac5779..abec7b5c8 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,8 @@ "graphql": "15.8.0", "xml2js": "0.5.0", "axios": "^1.7.4", - "**/@aws-amplify/amplify-codegen-e2e-tests/**/fast-xml-parser": "^4.4.1" + "**/@aws-amplify/amplify-codegen-e2e-tests/**/fast-xml-parser": "^4.4.1", + "**/@aws-amplify/amplify-codegen-e2e-tests/**/cookie": "^0.7.0" }, "config": { "commitizen": { diff --git a/packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts b/packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts index 26b9ff1ad..ea742694d 100644 --- a/packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts +++ b/packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts @@ -1,5 +1,5 @@ import { nspawn as spawn, getCLIPath, singleSelect, addCITags } from '..'; -import { KEY_DOWN_ARROW, AmplifyFrontend } from '../utils'; +import { KEY_DOWN_ARROW, AmplifyFrontend, ExecutionContext } from '../utils'; import { amplifyRegions } from '../configure'; import { v4 as uuid } from 'uuid'; @@ -44,6 +44,7 @@ export function initJSProjectWithProfile(cwd: string, settings: Object = {}): Pr return new Promise((resolve, reject) => { const chain = spawn(getCLIPath(), cliArgs, { cwd, stripColors: true, env, disableCIDetection: s.disableCIDetection }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(s.name) .wait('Initialize the project with the above configuration?') @@ -91,19 +92,28 @@ export function initJSProjectWithProfile(cwd: string, settings: Object = {}): Pr }); } +export const confirmUsingGen1Amplify = (executionContext: ExecutionContext): ExecutionContext => { + return executionContext + .wait('Do you want to continue with Amplify Gen 1?') + .sendConfirmYes() + .wait('Why would you like to use Amplify Gen 1?') + .sendCarriageReturn() +} + export function initAndroidProjectWithProfile(cwd: string, settings: Object): Promise { const s = { ...defaultSettings, ...settings }; addCITags(cwd); return new Promise((resolve, reject) => { - spawn(getCLIPath(), ['init'], { + const chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true, env: { CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', }, }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(s.name) .wait('Initialize the project with the above configuration?') @@ -141,13 +151,14 @@ export function initIosProjectWithProfile(cwd: string, settings: Object): Promis addCITags(cwd); return new Promise((resolve, reject) => { - spawn(getCLIPath(), ['init'], { + const chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true, env: { CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', }, }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(s.name) .wait('Initialize the project with the above configuration?') @@ -178,6 +189,7 @@ export function initFlutterProjectWithProfile(cwd: string, settings: Object): Pr return new Promise((resolve, reject) => { let chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(s.name) .wait('Initialize the project with the above configuration?') @@ -228,6 +240,7 @@ export function initProjectWithAccessKey( CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', }, }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(s.name) .wait('Initialize the project with the above configuration?') diff --git a/packages/amplify-codegen-e2e-core/src/utils/pinpoint.ts b/packages/amplify-codegen-e2e-core/src/utils/pinpoint.ts index bf9cff28f..13a5b0277 100644 --- a/packages/amplify-codegen-e2e-core/src/utils/pinpoint.ts +++ b/packages/amplify-codegen-e2e-core/src/utils/pinpoint.ts @@ -1,5 +1,5 @@ import { Pinpoint } from 'aws-sdk'; -import { getCLIPath, nspawn as spawn, singleSelect, amplifyRegions, addCITags, KEY_DOWN_ARROW } from '..'; +import { getCLIPath, nspawn as spawn, singleSelect, amplifyRegions, addCITags, KEY_DOWN_ARROW, confirmUsingGen1Amplify } from '..'; import _ from 'lodash'; const settings = { @@ -80,6 +80,7 @@ export function initProjectForPinpoint(cwd: string): Promise { CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', }, }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendLine(settings.name) .wait('Initialize the project with the above configuration?') diff --git a/packages/amplify-codegen-e2e-tests/package.json b/packages/amplify-codegen-e2e-tests/package.json index 58ce70887..93bf258a6 100644 --- a/packages/amplify-codegen-e2e-tests/package.json +++ b/packages/amplify-codegen-e2e-tests/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@aws-amplify/amplify-codegen-e2e-core": "1.6.5", - "@aws-amplify/graphql-schema-test-library": "^2.2.28", + "@aws-amplify/graphql-schema-test-library": "^3.0.0", "amazon-cognito-identity-js": "^6.3.6", "aws-amplify": "^5.3.3", "aws-appsync": "^4.1.9", diff --git a/packages/amplify-codegen-e2e-tests/src/init-special-cases/index.ts b/packages/amplify-codegen-e2e-tests/src/init-special-cases/index.ts index 0490c7ffa..d4ab39854 100644 --- a/packages/amplify-codegen-e2e-tests/src/init-special-cases/index.ts +++ b/packages/amplify-codegen-e2e-tests/src/init-special-cases/index.ts @@ -1,5 +1,5 @@ import path from 'path'; -import { nspawn as spawn, getCLIPath, singleSelect, amplifyRegions, addCITags, KEY_DOWN_ARROW } from '@aws-amplify/amplify-codegen-e2e-core'; +import { nspawn as spawn, getCLIPath, singleSelect, amplifyRegions, addCITags, KEY_DOWN_ARROW, confirmUsingGen1Amplify } from '@aws-amplify/amplify-codegen-e2e-core'; import fs from 'fs-extra'; import os from 'os'; @@ -52,6 +52,7 @@ async function initWorkflow(cwd: string, settings: { accessKeyId: string; secret CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1', }, }) + confirmUsingGen1Amplify(chain) .wait('Enter a name for the project') .sendCarriageReturn() .wait('Initialize the project with the above configuration?') diff --git a/yarn.lock b/yarn.lock index 4bda1c49e..57134bf96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -583,10 +583,10 @@ graphql-transformer-common "4.30.1" immer "^9.0.12" -"@aws-amplify/graphql-schema-test-library@^2.2.28": - version "2.2.28" - resolved "https://registry.yarnpkg.com/@aws-amplify/graphql-schema-test-library/-/graphql-schema-test-library-2.2.28.tgz#a60ae3fd2d9e5d4bd154899a6e0d28a48af0a855" - integrity sha512-1ZFFGKICIINhZkbkHC9lrPD9nMa5uLppmUyL1cJR2TKqneVKO8l0B88nnqhwjq/9yREFEP06VklORfm1XBKeUQ== +"@aws-amplify/graphql-schema-test-library@^3.0.0": + version "3.0.4" + resolved "https://registry.npmjs.org/@aws-amplify/graphql-schema-test-library/-/graphql-schema-test-library-3.0.4.tgz#05bcb53a0b6364e49eec1fb526dfca2cad79097c" + integrity sha512-KM7HMrAP3wPHuKD1Rd/Z00bkVqtNbRNmTMmNOTDkommwnirrjBAFtZCLCp5GL1zdhxqsheCSuFZur+RGYAQqqA== "@aws-amplify/graphql-searchable-transformer@2.7.1": version "2.7.1" @@ -9580,10 +9580,10 @@ convert-source-map@^2.0.0: resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie@^0.4.0: - version "0.4.2" - resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" - integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== +cookie@^0.4.0, cookie@^0.7.0: + version "0.7.2" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" + integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== copyfiles@^2.2.0: version "2.4.1"