From 72ee451cccb3ed26be8da134c4c8cc8205c1d3e7 Mon Sep 17 00:00:00 2001 From: Doma Date: Tue, 28 Feb 2023 15:27:05 +0800 Subject: [PATCH] fix: fix expected undefined output --- package.json | 2 +- pnpm-lock.yaml | 22 +++++++++------------- src/promptForParameters.ts | 4 +++- src/setupMSW.ts | 7 +++++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index a7210be..5da92cc 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "vitest": "0.12.6" }, "dependencies": { - "@clack/prompts": "^0.2.0", + "@clack/prompts": "^0.4.5", "@netlify/framework-info": "^9.8.3", "emphasize": "^6.0.0", "execa": "^7.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 286fd6f..7060304 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: 5.4 specifiers: - '@clack/prompts': ^0.2.0 + '@clack/prompts': ^0.4.5 '@egoist/prettier-config': 1.0.0 '@netlify/framework-info': ^9.8.3 '@types/fs-extra': ^11.0.1 @@ -16,7 +16,7 @@ specifiers: vitest: 0.12.6 dependencies: - '@clack/prompts': 0.2.0 + '@clack/prompts': 0.4.5 '@netlify/framework-info': 9.8.3 emphasize: 6.0.0 execa: 7.0.0 @@ -55,21 +55,22 @@ packages: js-tokens: 4.0.0 dev: false - /@clack/core/0.1.2: - resolution: {integrity: sha512-NwVrhVMvX+QC4EoRwmBnkotzKzxM+Ppyi9tYKUf6N1WQd+ETIfwY/czVTZTOW4F8wbuqduHQHNjaSxTpp5DgMA==} + /@clack/core/0.1.9: + resolution: {integrity: sha512-2VaGLFQq54lGkpc48ZsPK8LzbQCbu5I+7zAFrvKM9PTCMI3Lzut+Q8LnflyRLeAsjqzvc5o258+nAoAiRWC0jA==} dependencies: picocolors: 1.0.0 sisteransi: 1.0.5 dev: false - /@clack/prompts/0.2.0: - resolution: {integrity: sha512-2/z+ggir05igkE1BWReiamGEWDi7oklR6/rURbaWhWTMHiJkqmMhza1eilAtMeg+ALnX16msDfK8IMVeW0LGTg==} + /@clack/prompts/0.4.5: + resolution: {integrity: sha512-TOuHKYSRWSUMJIDHSeF/JgPkR0avRipQTlr2CBsQkjw3BYInZN8UfI6vBFZhDu8svCrZGhGKaur5/hfw4x2yBw==} dependencies: - '@clack/core': 0.1.2 - ansi-regex: 6.0.1 + '@clack/core': 0.1.9 picocolors: 1.0.0 sisteransi: 1.0.5 dev: false + bundledDependencies: + - is-unicode-supported /@egoist/prettier-config/1.0.0: resolution: {integrity: sha512-D1Tp9Jv4aVoEo3cOAO966gFCI0wx/1lZ6sEHX8uMAfyVxuxD2+knGxhfGlb/FNLxWV3ifSI5hOmB/zFfsi7Rzw==} @@ -189,11 +190,6 @@ packages: uri-js: 4.4.1 dev: false - /ansi-regex/6.0.1: - resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} - engines: {node: '>=12'} - dev: false - /ansi-styles/3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} diff --git a/src/promptForParameters.ts b/src/promptForParameters.ts index a36e1a6..c2caeca 100644 --- a/src/promptForParameters.ts +++ b/src/promptForParameters.ts @@ -55,9 +55,11 @@ export async function promptForParameters() { } } + const guessedPublicDirectory = await guessPublicDirectory() const publicDirectory = await text({ message: "Your public directory", - placeholder: await guessPublicDirectory(), + placeholder: guessedPublicDirectory, + defaultValue: guessedPublicDirectory, }) if (isCancel(publicDirectory)) { diff --git a/src/setupMSW.ts b/src/setupMSW.ts index cef003c..fbebb33 100644 --- a/src/setupMSW.ts +++ b/src/setupMSW.ts @@ -35,9 +35,12 @@ export async function setupMSW(options: SetupMSWOptions) { ) // Run msw init - if (options.integrationType === "browser") { + if ( + options.integrationType === "browser" || + options.integrationType === "both" + ) { await runAsyncWithSpinner( - `Executing ${pc.cyan(`msw init`)}...`, + `Executing ${pc.cyan(`msw init ${options.publicDirectory} --save`)}...`, async () => { await execa("npx", ["msw", "init", options.publicDirectory, "--save"]) },