Skip to content

Commit 2474835

Browse files
committed
refactor: rename assert methods
1 parent 4e9fcec commit 2474835

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/create-react-native-library/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import prompts from './utils/prompts';
77
import generateExampleApp from './exampleApp/generateExampleApp';
88
import { addCodegenBuildScript } from './exampleApp/addCodegenBuildScript';
99
import { createInitialGitCommit } from './utils/initialCommit';
10-
import { assertAnswers, assertNpx } from './utils/assert';
10+
import { assertUserInput, assertNpxExists } from './utils/assert';
1111
import { resolveBobVersionWithFallback } from './utils/promiseWithFallback';
1212
import { applyTemplates, generateTemplateConfiguration } from './template';
1313
import {
@@ -40,6 +40,7 @@ yargs
4040
.strict().argv;
4141

4242
async function create(_argv: yargs.Arguments<Args>) {
43+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4344
const { _, $0, ...argv } = _argv;
4445

4546
// Prefetch bob version in background while asking questions
@@ -48,7 +49,7 @@ async function create(_argv: yargs.Arguments<Args>) {
4849
const local = await promptLocalLibrary(argv);
4950
const folder = await promptPath(argv, local);
5051

51-
await assertNpx();
52+
await assertNpxExists();
5253

5354
const basename = path.basename(folder);
5455

@@ -58,7 +59,7 @@ async function create(_argv: yargs.Arguments<Args>) {
5859
argv,
5960
});
6061

61-
assertAnswers(questions, argv);
62+
assertUserInput(questions, argv);
6263

6364
const promptAnswers = await prompts(questions);
6465

@@ -69,7 +70,7 @@ async function create(_argv: yargs.Arguments<Args>) {
6970
...promptAnswers,
7071
} as Required<Answers>;
7172

72-
assertAnswers(questions, answers);
73+
assertUserInput(questions, answers);
7374

7475
const bobVersion = await resolveBobVersion();
7576

packages/create-react-native-library/src/utils/assert.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import kleur from 'kleur';
22
import { spawn } from './spawn';
33
import type { Answers, Args, Question } from '../input';
44

5-
export async function assertNpx() {
5+
export async function assertNpxExists() {
66
try {
77
await spawn('npx', ['--help']);
88
} catch (error) {
@@ -24,7 +24,10 @@ export async function assertNpx() {
2424
/**
2525
* Makes sure the answers are in expected form and ends the process with error if they are not
2626
*/
27-
export function assertAnswers(questions: Question[], answers: Answers | Args) {
27+
export function assertUserInput(
28+
questions: Question[],
29+
answers: Answers | Args
30+
) {
2831
for (const [key, value] of Object.entries(answers)) {
2932
if (value == null) {
3033
continue;

0 commit comments

Comments
 (0)