Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release codegen plugin #898

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
19 changes: 16 additions & 3 deletions packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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?')
Expand Down Expand Up @@ -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<void> {
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?')
Expand Down Expand Up @@ -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?')
Expand Down Expand Up @@ -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?')
Expand Down Expand Up @@ -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?')
Expand Down
3 changes: 2 additions & 1 deletion packages/amplify-codegen-e2e-core/src/utils/pinpoint.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -80,6 +80,7 @@ export function initProjectForPinpoint(cwd: string): Promise<void> {
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?')
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-codegen-e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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?')
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "2.7.1"
Expand Down Expand Up @@ -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"
Expand Down
Loading