Skip to content

Commit 3b44564

Browse files
committed
Move generating TS declaration and JS entrypoint down
1 parent 521fe0d commit 3b44564

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

packages/ferric/src/build.ts

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -158,45 +158,6 @@ export const buildCommand = new Command("build")
158158
}
159159
);
160160

161-
const libraryName = determineLibraryBasename([
162-
...androidLibraries.map(([, outputPath]) => outputPath),
163-
]);
164-
165-
const declarationsFilename = `${libraryName}.d.ts`;
166-
const declarationsPath = path.join(outputPath, declarationsFilename);
167-
await oraPromise(
168-
generateTypeScriptDeclarations({
169-
outputFilename: declarationsFilename,
170-
createPath: process.cwd(),
171-
outputPath,
172-
}),
173-
{
174-
text: "Generating TypeScript declarations",
175-
successText: `Generated TypeScript declarations ${prettyPath(
176-
declarationsPath
177-
)}`,
178-
failText: (error) =>
179-
`Failed to generate TypeScript declarations: ${error.message}`,
180-
}
181-
);
182-
183-
const entrypointPath = path.join(outputPath, `${libraryName}.js`);
184-
185-
await oraPromise(
186-
generateEntrypoint({
187-
libraryName,
188-
outputPath: entrypointPath,
189-
}),
190-
{
191-
text: `Generating entrypoint`,
192-
successText: `Generated entrypoint into ${prettyPath(
193-
entrypointPath
194-
)}`,
195-
failText: (error) =>
196-
`Failed to generate entrypoint: ${error.message}`,
197-
}
198-
);
199-
200161
if (androidLibraries.length > 0) {
201162
const libraryPathByTriplet = Object.fromEntries(
202163
androidLibraries.map(([target, outputPath]) => [
@@ -260,6 +221,46 @@ export const buildCommand = new Command("build")
260221
}
261222
);
262223
}
224+
225+
const libraryName = determineLibraryBasename([
226+
...androidLibraries.map(([, outputPath]) => outputPath),
227+
...appleLibraries.map(([, outputPath]) => outputPath),
228+
]);
229+
230+
const declarationsFilename = `${libraryName}.d.ts`;
231+
const declarationsPath = path.join(outputPath, declarationsFilename);
232+
await oraPromise(
233+
generateTypeScriptDeclarations({
234+
outputFilename: declarationsFilename,
235+
createPath: process.cwd(),
236+
outputPath,
237+
}),
238+
{
239+
text: "Generating TypeScript declarations",
240+
successText: `Generated TypeScript declarations ${prettyPath(
241+
declarationsPath
242+
)}`,
243+
failText: (error) =>
244+
`Failed to generate TypeScript declarations: ${error.message}`,
245+
}
246+
);
247+
248+
const entrypointPath = path.join(outputPath, `${libraryName}.js`);
249+
250+
await oraPromise(
251+
generateEntrypoint({
252+
libraryName,
253+
outputPath: entrypointPath,
254+
}),
255+
{
256+
text: `Generating entrypoint`,
257+
successText: `Generated entrypoint into ${prettyPath(
258+
entrypointPath
259+
)}`,
260+
failText: (error) =>
261+
`Failed to generate entrypoint: ${error.message}`,
262+
}
263+
);
263264
} catch (error) {
264265
if (error instanceof SpawnFailure) {
265266
error.flushOutput("both");

0 commit comments

Comments
 (0)