Skip to content

Commit 071af89

Browse files
committed
rename FingerprintSources to FingerprintOptions and run prettier
1 parent 7da1eb2 commit 071af89

22 files changed

Lines changed: 70 additions & 66 deletions

File tree

.github/pr-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
'release: bug fix':
44
- '/^fix/'
55
'release: breaking change':
6-
- '/^breaking/'
6+
- '/^breaking/'

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Choose your path based on your current situation:
3232

3333
### Creating a new project
3434

35-
> [!TIP]
35+
> [!TIP]
3636
> For **new projects**, we recommend starting with [Expo](https://expo.dev) for the best developer experience and similar remote caching capabilities. Rock is designed for teams who have outgrown the Community CLI.
3737
3838
To create a fresh React Native app with Rock, open a terminal and run:

packages/cli/src/lib/plugins/fingerprint.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createHash } from 'node:crypto';
22
import { performance } from 'node:perf_hooks';
33
import type { PluginApi } from '@rock-js/config';
4-
import type { FingerprintInputHash, FingerprintSources } from '@rock-js/tools';
4+
import type { FingerprintInputHash, FingerprintOptions } from '@rock-js/tools';
55
import {
66
color,
77
intro,
@@ -39,7 +39,7 @@ type NativeFingerprintCommandOptions = {
3939

4040
export async function nativeFingerprintCommand(
4141
path: string,
42-
{ extraSources, ignorePaths, env }: FingerprintSources,
42+
{ extraSources, ignorePaths, env }: FingerprintOptions,
4343
options: NativeFingerprintCommandOptions,
4444
) {
4545
validateOptions(options);

packages/cli/src/lib/plugins/remoteCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'node:fs';
22
import os from 'node:os';
33
import path from 'node:path';
44
import type { PluginApi, PluginOutput } from '@rock-js/config';
5-
import type { FingerprintSources, RemoteBuildCache } from '@rock-js/tools';
5+
import type { FingerprintOptions, RemoteBuildCache } from '@rock-js/tools';
66
import {
77
color,
88
colorLink,
@@ -48,7 +48,7 @@ async function remoteCache({
4848
args: Flags;
4949
remoteCacheProvider: null | (() => RemoteBuildCache);
5050
projectRoot: string;
51-
fingerprintOptions: FingerprintSources;
51+
fingerprintOptions: FingerprintOptions;
5252
}) {
5353
const isJsonOutput = args.json;
5454
if (!remoteCacheProvider) {

packages/config/src/lib/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
22
import { createRequire } from 'node:module';
33
import * as path from 'node:path';
44
import { pathToFileURL } from 'node:url';
5-
import type { FingerprintSources, RemoteBuildCache } from '@rock-js/tools';
5+
import type { FingerprintOptions, RemoteBuildCache } from '@rock-js/tools';
66
import { colorLink, getReactNativeVersion, logger } from '@rock-js/tools';
77
import type { ValidationError } from 'joi';
88
import { ConfigTypeSchema } from './schema.js';
@@ -54,7 +54,7 @@ export type PluginApi = {
5454
getRemoteCacheProvider: () => Promise<
5555
null | undefined | (() => RemoteBuildCache)
5656
>;
57-
getFingerprintOptions: () => FingerprintSources;
57+
getFingerprintOptions: () => FingerprintOptions;
5858
getBundlerStart: () => ({ args }: { args: DevServerArgs }) => void;
5959
getUsePrebuiltRNCore: () => number | undefined;
6060
};
@@ -103,7 +103,7 @@ export type ConfigType = {
103103
ignorePaths?: string[];
104104
env?: string[];
105105
};
106-
usePrebuiltRNCore?: number,
106+
usePrebuiltRNCore?: number;
107107
};
108108

109109
export type ConfigOutput = {
@@ -219,7 +219,7 @@ Read more: ${colorLink('https://rockjs.dev/docs/configuration#github-actions-pro
219219
return validatedConfig.remoteCacheProvider;
220220
},
221221
getFingerprintOptions: () =>
222-
validatedConfig.fingerprint as FingerprintSources,
222+
validatedConfig.fingerprint as FingerprintOptions,
223223
getBundlerStart:
224224
() =>
225225
({ args }: { args: DevServerArgs }) => {

packages/create-app/src/lib/utils/__tests__/initInExistingProject.test.ts

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
22
import * as path from 'node:path';
33
import { cleanup, getTempDirectory, writeFiles } from '@rock-js/test-helpers';
44
import * as tools from '@rock-js/tools';
5-
import { updateAndroidBuildGradle } from "../initInExistingProject.js";
5+
import { updateAndroidBuildGradle } from '../initInExistingProject.js';
66

77
const directory = getTempDirectory('test_updateAndroidBuildGradle');
88

@@ -61,15 +61,23 @@ describe('updateAndroidBuildGradle', () => {
6161
},
6262
];
6363

64-
it.each(workingCases)('should update the Android build.gradle file when $name', ({ content, expected }) => {
65-
const files = {
66-
'android/app/build.gradle': content,
67-
};
68-
writeFiles(directory, files);
69-
updateAndroidBuildGradle(directory, 'android');
70-
71-
expect(fs.readFileSync(path.join(directory, 'android/app/build.gradle'), 'utf8')).toStrictEqual(expected)
72-
});
64+
it.each(workingCases)(
65+
'should update the Android build.gradle file when $name',
66+
({ content, expected }) => {
67+
const files = {
68+
'android/app/build.gradle': content,
69+
};
70+
writeFiles(directory, files);
71+
updateAndroidBuildGradle(directory, 'android');
72+
73+
expect(
74+
fs.readFileSync(
75+
path.join(directory, 'android/app/build.gradle'),
76+
'utf8',
77+
),
78+
).toStrictEqual(expected);
79+
},
80+
);
7381

7482
it('should not update the Android build.gradle file when cliFile is already set', () => {
7583
const content = `
@@ -84,7 +92,9 @@ describe('updateAndroidBuildGradle', () => {
8492
writeFiles(directory, files);
8593
updateAndroidBuildGradle(directory, 'android');
8694

87-
expect(fs.readFileSync(path.join(directory, 'android/app/build.gradle'), 'utf8')).toStrictEqual(content)
95+
expect(
96+
fs.readFileSync(path.join(directory, 'android/app/build.gradle'), 'utf8'),
97+
).toStrictEqual(content);
8898
});
8999

90100
it('should display a warning when unable to update the Android build.gradle file', () => {
@@ -101,10 +111,12 @@ describe('updateAndroidBuildGradle', () => {
101111
writeFiles(directory, files);
102112
updateAndroidBuildGradle(directory, 'android');
103113

104-
expect(fs.readFileSync(path.join(directory, 'android/app/build.gradle'), 'utf8')).toStrictEqual(content)
114+
expect(
115+
fs.readFileSync(path.join(directory, 'android/app/build.gradle'), 'utf8'),
116+
).toStrictEqual(content);
105117

106118
expect(warn).toHaveBeenCalledWith(
107-
expect.stringContaining('Unable to update')
108-
)
119+
expect.stringContaining('Unable to update'),
120+
);
109121
});
110122
});

packages/platform-android/src/lib/commands/buildAndroid/buildAndroid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AndroidProjectConfig } from '@react-native-community/cli-types';
22
import type { RemoteBuildCache, RockCLIOptions } from '@rock-js/tools';
33
import {
44
colorLink,
5-
type FingerprintSources,
5+
type FingerprintOptions,
66
formatArtifactName,
77
getBinaryPath,
88
logger,
@@ -28,7 +28,7 @@ export async function buildAndroid(
2828
args: BuildFlags,
2929
projectRoot: string,
3030
remoteCacheProvider: null | (() => RemoteBuildCache) | undefined,
31-
fingerprintOptions: FingerprintSources,
31+
fingerprintOptions: FingerprintOptions,
3232
) {
3333
normalizeArgs(args);
3434
// Use assemble task by default, but bundle if the flag is set

packages/platform-android/src/lib/commands/runAndroid/runAndroid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
Config,
66
} from '@react-native-community/cli-types';
77
import type { StartDevServerArgs } from '@rock-js/config';
8-
import type { FingerprintSources, RemoteBuildCache } from '@rock-js/tools';
8+
import type { FingerprintOptions, RemoteBuildCache } from '@rock-js/tools';
99
import {
1010
color,
1111
formatArtifactName,
@@ -50,7 +50,7 @@ export async function runAndroid(
5050
args: Flags,
5151
projectRoot: string,
5252
remoteCacheProvider: null | (() => RemoteBuildCache) | undefined,
53-
fingerprintOptions: FingerprintSources,
53+
fingerprintOptions: FingerprintOptions,
5454
startDevServer: (options: StartDevServerArgs) => void,
5555
reactNativeVersion: string,
5656
reactNativePath: string,

packages/platform-android/src/lib/commands/runAndroid/tryInstallAppOnDevice.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export async function tryInstallAppOnDevice(
2020
) {
2121
let deviceId: string;
2222
if (!device.deviceId) {
23-
logger.debug(
24-
`No "deviceId" for ${device}, skipping launching the app`,
25-
);
23+
logger.debug(`No "deviceId" for ${device}, skipping launching the app`);
2624
return;
2725
} else {
2826
deviceId = device.deviceId;

packages/platform-android/src/lib/commands/runAndroid/tryLaunchAppOnDevice.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export async function tryLaunchAppOnDevice(
1111
) {
1212
let deviceId;
1313
if (!device.deviceId) {
14-
logger.debug(
15-
`No "deviceId" for ${device}, skipping launching the app`,
16-
);
14+
logger.debug(`No "deviceId" for ${device}, skipping launching the app`);
1715
return {};
1816
} else {
1917
deviceId = device.deviceId;

0 commit comments

Comments
 (0)