|
1 | 1 | import { nspawn as spawn, getCLIPath, singleSelect, addCITags } from '..';
|
2 |
| -import { KEY_DOWN_ARROW, AmplifyFrontend } from '../utils'; |
| 2 | +import { KEY_DOWN_ARROW, AmplifyFrontend, ExecutionContext } from '../utils'; |
3 | 3 | import { amplifyRegions } from '../configure';
|
4 | 4 | import { v4 as uuid } from 'uuid';
|
5 | 5 |
|
@@ -44,6 +44,7 @@ export function initJSProjectWithProfile(cwd: string, settings: Object = {}): Pr
|
44 | 44 |
|
45 | 45 | return new Promise((resolve, reject) => {
|
46 | 46 | const chain = spawn(getCLIPath(), cliArgs, { cwd, stripColors: true, env, disableCIDetection: s.disableCIDetection })
|
| 47 | + confirmUsingGen1Amplify(chain) |
47 | 48 | .wait('Enter a name for the project')
|
48 | 49 | .sendLine(s.name)
|
49 | 50 | .wait('Initialize the project with the above configuration?')
|
@@ -91,19 +92,28 @@ export function initJSProjectWithProfile(cwd: string, settings: Object = {}): Pr
|
91 | 92 | });
|
92 | 93 | }
|
93 | 94 |
|
| 95 | +export const confirmUsingGen1Amplify = (executionContext: ExecutionContext): ExecutionContext => { |
| 96 | + return executionContext |
| 97 | + .wait('Do you want to continue with Amplify Gen 1?') |
| 98 | + .sendConfirmYes() |
| 99 | + .wait('Why would you like to use Amplify Gen 1?') |
| 100 | + .sendCarriageReturn() |
| 101 | +} |
| 102 | + |
94 | 103 | export function initAndroidProjectWithProfile(cwd: string, settings: Object): Promise<void> {
|
95 | 104 | const s = { ...defaultSettings, ...settings };
|
96 | 105 |
|
97 | 106 | addCITags(cwd);
|
98 | 107 |
|
99 | 108 | return new Promise((resolve, reject) => {
|
100 |
| - spawn(getCLIPath(), ['init'], { |
| 109 | + const chain = spawn(getCLIPath(), ['init'], { |
101 | 110 | cwd,
|
102 | 111 | stripColors: true,
|
103 | 112 | env: {
|
104 | 113 | CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1',
|
105 | 114 | },
|
106 | 115 | })
|
| 116 | + confirmUsingGen1Amplify(chain) |
107 | 117 | .wait('Enter a name for the project')
|
108 | 118 | .sendLine(s.name)
|
109 | 119 | .wait('Initialize the project with the above configuration?')
|
@@ -141,13 +151,14 @@ export function initIosProjectWithProfile(cwd: string, settings: Object): Promis
|
141 | 151 | addCITags(cwd);
|
142 | 152 |
|
143 | 153 | return new Promise((resolve, reject) => {
|
144 |
| - spawn(getCLIPath(), ['init'], { |
| 154 | + const chain = spawn(getCLIPath(), ['init'], { |
145 | 155 | cwd,
|
146 | 156 | stripColors: true,
|
147 | 157 | env: {
|
148 | 158 | CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1',
|
149 | 159 | },
|
150 | 160 | })
|
| 161 | + confirmUsingGen1Amplify(chain) |
151 | 162 | .wait('Enter a name for the project')
|
152 | 163 | .sendLine(s.name)
|
153 | 164 | .wait('Initialize the project with the above configuration?')
|
@@ -178,6 +189,7 @@ export function initFlutterProjectWithProfile(cwd: string, settings: Object): Pr
|
178 | 189 |
|
179 | 190 | return new Promise((resolve, reject) => {
|
180 | 191 | let chain = spawn(getCLIPath(), ['init'], { cwd, stripColors: true })
|
| 192 | + confirmUsingGen1Amplify(chain) |
181 | 193 | .wait('Enter a name for the project')
|
182 | 194 | .sendLine(s.name)
|
183 | 195 | .wait('Initialize the project with the above configuration?')
|
@@ -228,6 +240,7 @@ export function initProjectWithAccessKey(
|
228 | 240 | CLI_DEV_INTERNAL_DISABLE_AMPLIFY_APP_CREATION: '1',
|
229 | 241 | },
|
230 | 242 | })
|
| 243 | + confirmUsingGen1Amplify(chain) |
231 | 244 | .wait('Enter a name for the project')
|
232 | 245 | .sendLine(s.name)
|
233 | 246 | .wait('Initialize the project with the above configuration?')
|
|
0 commit comments