Skip to content

Commit

Permalink
[types] Allow make build-lib-types to be run multiple times in a row.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Mar 17, 2024
1 parent e1a086f commit 49db203
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions script/build/lib/build-lib-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ await spawnPromise("npx", [
"dist/lib/cubing",
]);

const TYPESCRIPT_DECLARATION_INDEX = "index.d.ts";
export const TYPESCRIPT_DECLARATION_INDEX = "index.d.ts";

// TODO: remove this once TypeScript resolves types from the `package.json` exports out of the box.
for (const packageName of packageNames) {
await mkdir(packageName);
await mkdir(packageName, { recursive: true });
const indexFileName = join(packageName, TYPESCRIPT_DECLARATION_INDEX);
await writeFile(
indexFileName,
Expand Down
3 changes: 1 addition & 2 deletions script/build/lib/clean-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { existsSync } from "node:fs";
import { rm, rmdir } from "node:fs/promises";
import { join } from "node:path";
import { packageNames } from "../common/package-info";

const TYPESCRIPT_DECLARATION_INDEX = "index.d.ts";
import { TYPESCRIPT_DECLARATION_INDEX } from "./build-lib-types";

for (const packageName of packageNames) {
const indexFileName = join(packageName, TYPESCRIPT_DECLARATION_INDEX);
Expand Down

0 comments on commit 49db203

Please sign in to comment.