Skip to content

Commit

Permalink
refactor: version -> bobVersion, crnlVersion -> version
Browse files Browse the repository at this point in the history
  • Loading branch information
atlj committed Jun 10, 2024
1 parent 47ace88 commit b9eb871
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/create-react-native-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import githubUsername from 'github-username';
import prompts, { type PromptObject } from './utils/prompts';
import generateExampleApp from './utils/generateExampleApp';
import { spawn } from './utils/spawn';
import { version as crnlVersion } from '../package.json';
import { version } from '../package.json';

const FALLBACK_BOB_VERSION = '0.20.0';

Expand Down Expand Up @@ -554,18 +554,18 @@ async function create(_argv: yargs.Arguments<any>) {
} = answers;

// Get latest version of Bob from NPM
let version: string;
let bobVersion: string;

try {
version = await Promise.race([
bobVersion = await Promise.race([
new Promise<string>((resolve) => {
setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000);
}),
spawn('npm', ['view', 'react-native-builder-bob', 'dist-tags.latest']),
]);
} catch (e) {
// Fallback to a known version if we couldn't fetch
version = FALLBACK_BOB_VERSION;
bobVersion = FALLBACK_BOB_VERSION;
}

const moduleType = type.startsWith('view-') ? 'view' : 'module';
Expand Down Expand Up @@ -597,7 +597,7 @@ async function create(_argv: yargs.Arguments<any>) {

const options = {
bob: {
version: version || FALLBACK_BOB_VERSION,
version: bobVersion || FALLBACK_BOB_VERSION,
},
project: {
slug,
Expand Down Expand Up @@ -820,7 +820,7 @@ async function create(_argv: yargs.Arguments<any>) {
)
)
);
libraryMetadata.version = crnlVersion;
libraryMetadata.version = version;

const libraryPackageJson = await fs.readJson(path.join(folder, 'package.json'));
libraryPackageJson['create-react-native-library'] = libraryMetadata;
Expand Down

0 comments on commit b9eb871

Please sign in to comment.