Skip to content

Commit 34f96f1

Browse files
committed
added traillingcommas
1 parent 7e10315 commit 34f96f1

File tree

2 files changed

+83
-83
lines changed

2 files changed

+83
-83
lines changed

packages/ferric/src/build.ts

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
determineAndroidLibsFilename,
1616
determineLibraryBasename,
1717
determineXCFrameworkFilename,
18-
prettyPath
18+
prettyPath,
1919
} from "react-native-node-api";
2020
import { getBlockComment } from "./banner.js";
2121
import { build, ensureCargo } from "./cargo.js";
@@ -28,7 +28,7 @@ import {
2828
APPLE_TARGETS,
2929
type AppleTargetName,
3030
ensureInstalledTargets,
31-
filterTargetsByPlatform
31+
filterTargetsByPlatform,
3232
} from "./targets.js";
3333

3434
type EntrypointOptions = {
@@ -37,24 +37,24 @@ type EntrypointOptions = {
3737
};
3838
async function generateEntrypoint({
3939
outputPath,
40-
libraryName
40+
libraryName,
4141
}: EntrypointOptions) {
4242
await fs.promises.writeFile(
4343
outputPath,
4444
[
4545
"/* eslint-disable */",
4646
getBlockComment(),
47-
`module.exports = require('./${libraryName}.node');`
47+
`module.exports = require('./${libraryName}.node');`,
4848
].join("\n\n") + "\n",
49-
"utf8"
49+
"utf8",
5050
);
5151
}
5252

5353
const ANDROID_TRIPLET_PER_TARGET: Record<AndroidTargetName, AndroidTriplet> = {
5454
"aarch64-linux-android": "aarch64-linux-android",
5555
"armv7-linux-androideabi": "armv7a-linux-androideabi",
5656
"i686-linux-android": "i686-linux-android",
57-
"x86_64-linux-android": "x86_64-linux-android"
57+
"x86_64-linux-android": "x86_64-linux-android",
5858
};
5959

6060
// This should match https://github.com/react-native-community/template/blob/main/template/android/build.gradle#L7
@@ -71,8 +71,8 @@ function getDefaultTargets() {
7171
`Unexpected target in FERRIC_TARGETS: ${target}`,
7272
{
7373
instructions:
74-
"Pass only valid targets via FERRIC_TARGETS (or remove them)"
75-
}
74+
"Pass only valid targets via FERRIC_TARGETS (or remove them)",
75+
},
7676
);
7777
}
7878
return result as (typeof ALL_TARGETS)[number][];
@@ -85,21 +85,21 @@ const appleTarget = new Option("--apple", "Use all Apple targets");
8585
const androidTarget = new Option("--android", "Use all Android targets");
8686
const ndkVersionOption = new Option(
8787
"--ndk-version <version>",
88-
"The NDK version to use for Android builds"
88+
"The NDK version to use for Android builds",
8989
).default(DEFAULT_NDK_VERSION);
9090
const xcframeworkExtensionOption = new Option(
9191
"--xcframework-extension",
92-
"Don't rename the xcframework to .apple.node"
92+
"Don't rename the xcframework to .apple.node",
9393
).default(false);
9494

9595
const outputPathOption = new Option(
9696
"--output <path>",
97-
"Writing outputs to this directory"
97+
"Writing outputs to this directory",
9898
).default(process.cwd());
9999
const cwdPathOption = new Option("--cwd <path>", "Specify project path");
100100
const configurationOption = new Option(
101101
"--configuration <configuration>",
102-
"Build configuration"
102+
"Build configuration",
103103
)
104104
.choices(["debug", "release"])
105105
.default("debug");
@@ -123,7 +123,7 @@ export const buildCommand = new Command("build")
123123
output: outputPath,
124124
cwd: cwdPath,
125125
configuration,
126-
xcframeworkExtension
126+
xcframeworkExtension,
127127
}) => {
128128
const sourcePath =
129129
cwdPath && cwdPath.length > 0
@@ -160,11 +160,11 @@ export const buildCommand = new Command("build")
160160
chalk.yellowBright("ℹ"),
161161
chalk.dim(
162162
`Using default targets, pass ${chalk.italic(
163-
"--android"
163+
"--android",
164164
)}, ${chalk.italic("--apple")} or individual ${chalk.italic(
165-
"--target"
166-
)} options, to avoid this.`
167-
)
165+
"--target",
166+
)} options, to avoid this.`,
167+
),
168168
);
169169
}
170170
ensureCargo();
@@ -184,9 +184,9 @@ export const buildCommand = new Command("build")
184184
async (target) =>
185185
[
186186
target,
187-
await build({ configuration, target, sourcePath })
188-
] as const
189-
)
187+
await build({ configuration, target, sourcePath }),
188+
] as const,
189+
),
190190
),
191191
Promise.all(
192192
androidTargets.map(
@@ -198,49 +198,49 @@ export const buildCommand = new Command("build")
198198
target,
199199
sourcePath,
200200
ndkVersion,
201-
androidApiLevel: ANDROID_API_LEVEL
202-
})
203-
] as const
204-
)
205-
)
201+
androidApiLevel: ANDROID_API_LEVEL,
202+
}),
203+
] as const,
204+
),
205+
),
206206
]),
207207
{
208208
text: `Building ${targetsDescription}`,
209209
successText: `Built ${targetsDescription}`,
210-
failText: (error: Error) => `Failed to build: ${error.message}`
211-
}
210+
failText: (error: Error) => `Failed to build: ${error.message}`,
211+
},
212212
);
213213

214214
if (androidLibraries.length > 0) {
215215
const libraryPathByTriplet = Object.fromEntries(
216216
androidLibraries.map(([target, outputPath]) => [
217217
ANDROID_TRIPLET_PER_TARGET[target],
218-
outputPath
219-
])
218+
outputPath,
219+
]),
220220
) as Record<AndroidTriplet, string>;
221221

222222
const androidLibsFilename = determineAndroidLibsFilename(
223-
Object.values(libraryPathByTriplet)
223+
Object.values(libraryPathByTriplet),
224224
);
225225
const androidLibsOutputPath = path.resolve(
226226
outputPath,
227-
androidLibsFilename
227+
androidLibsFilename,
228228
);
229229

230230
await oraPromise(
231231
createAndroidLibsDirectory({
232232
outputPath: androidLibsOutputPath,
233233
libraryPathByTriplet,
234-
autoLink: true
234+
autoLink: true,
235235
}),
236236
{
237237
text: "Assembling Android libs directory",
238238
successText: `Android libs directory assembled into ${prettyPath(
239-
androidLibsOutputPath
239+
androidLibsOutputPath,
240240
)}`,
241241
failText: ({ message }) =>
242-
`Failed to assemble Android libs directory: ${message}`
243-
}
242+
`Failed to assemble Android libs directory: ${message}`,
243+
},
244244
);
245245
}
246246

@@ -249,35 +249,35 @@ export const buildCommand = new Command("build")
249249
const frameworkPaths = libraryPaths.map(createAppleFramework);
250250
const xcframeworkFilename = determineXCFrameworkFilename(
251251
frameworkPaths,
252-
xcframeworkExtension ? ".xcframework" : ".apple.node"
252+
xcframeworkExtension ? ".xcframework" : ".apple.node",
253253
);
254254

255255
// Create the xcframework
256256
const xcframeworkOutputPath = path.resolve(
257257
outputPath,
258-
xcframeworkFilename
258+
xcframeworkFilename,
259259
);
260260

261261
await oraPromise(
262262
createXCframework({
263263
outputPath: xcframeworkOutputPath,
264264
frameworkPaths,
265-
autoLink: true
265+
autoLink: true,
266266
}),
267267
{
268268
text: "Assembling XCFramework",
269269
successText: `XCFramework assembled into ${chalk.dim(
270-
path.relative(outputPath, xcframeworkOutputPath)
270+
path.relative(outputPath, xcframeworkOutputPath),
271271
)}`,
272272
failText: ({ message }) =>
273-
`Failed to assemble XCFramework: ${message}`
274-
}
273+
`Failed to assemble XCFramework: ${message}`,
274+
},
275275
);
276276
}
277277

278278
const libraryName = determineLibraryBasename([
279279
...androidLibraries.map(([, outputPath]) => outputPath),
280-
...appleLibraries.map(([, outputPath]) => outputPath)
280+
...appleLibraries.map(([, outputPath]) => outputPath),
281281
]);
282282

283283
const declarationsFilename = `${libraryName}.d.ts`;
@@ -286,33 +286,33 @@ export const buildCommand = new Command("build")
286286
generateTypeScriptDeclarations({
287287
outputFilename: declarationsFilename,
288288
createPath: sourcePath,
289-
outputPath
289+
outputPath,
290290
}),
291291
{
292292
text: "Generating TypeScript declarations",
293293
successText: `Generated TypeScript declarations ${prettyPath(
294-
declarationsPath
294+
declarationsPath,
295295
)}`,
296296
failText: (error) =>
297-
`Failed to generate TypeScript declarations: ${error.message}`
298-
}
297+
`Failed to generate TypeScript declarations: ${error.message}`,
298+
},
299299
);
300300

301301
const entrypointPath = path.join(outputPath, `${libraryName}.js`);
302302

303303
await oraPromise(
304304
generateEntrypoint({
305305
libraryName,
306-
outputPath: entrypointPath
306+
outputPath: entrypointPath,
307307
}),
308308
{
309309
text: `Generating entrypoint`,
310310
successText: `Generated entrypoint into ${prettyPath(
311-
entrypointPath
311+
entrypointPath,
312312
)}`,
313313
failText: (error) =>
314-
`Failed to generate entrypoint: ${error.message}`
315-
}
314+
`Failed to generate entrypoint: ${error.message}`,
315+
},
316316
);
317317
} catch (error) {
318318
process.exitCode = 1;
@@ -329,18 +329,18 @@ export const buildCommand = new Command("build")
329329
chalk.green("FIX"),
330330
error.fix.command
331331
? chalk.dim("Run: ") + error.fix.command
332-
: error.fix.instructions
332+
: error.fix.instructions,
333333
);
334334
}
335335
} else {
336336
throw error;
337337
}
338338
}
339-
}
339+
},
340340
);
341341

342342
async function combineLibraries(
343-
libraries: Readonly<[AppleTargetName, string]>[]
343+
libraries: Readonly<[AppleTargetName, string]>[],
344344
): Promise<string[]> {
345345
const result = [];
346346
const darwinLibraries = [];
@@ -362,8 +362,8 @@ async function combineLibraries(
362362
text: "Combining Darwin libraries into a universal library",
363363
successText: "Combined Darwin libraries into a universal library",
364364
failText: (error) =>
365-
`Failed to combine Darwin libraries: ${error.message}`
366-
}
365+
`Failed to combine Darwin libraries: ${error.message}`,
366+
},
367367
);
368368
return [...result, universalPath];
369369
}

0 commit comments

Comments
 (0)