Skip to content

Commit

Permalink
fix(types): replace React_2 with React in generated .d.ts files (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bsunderhus committed Apr 19, 2024
1 parent d2381e8 commit 6a3b237
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .changeset/mighty-donuts-remain.md
@@ -0,0 +1,7 @@
---
"@floating-ui/react": patch
"@floating-ui/react-dom": patch
"@floating-ui/react-native": patch
---

fix(types): replace `React_2` with `React` in generated .d.ts files
10 changes: 10 additions & 0 deletions config/scripts/build-api.mjs
Expand Up @@ -40,13 +40,15 @@ echo(
echo('');

echo(chalk.cyan(`Running tsc (${chalk.greenBright(tscPaths.join(', '))})`));

await Promise.all(tscPaths.map((tscPath) => $`npx tsc -b ${tscPath}`));

echo(
chalk.cyan(
`Running API Extractor (${chalk.greenBright(aecPaths.join(', '))})`,
),
);

await Promise.all(
aecPaths.map(async (aecPath) => {
await $`npx api-extractor run --local --verbose -c ${aecPath}`;
Expand All @@ -56,6 +58,14 @@ await Promise.all(
'<projectFolder>',
configFile.projectFolder ?? '.',
);
echo(
chalk.cyan(
`Replacing "React_2" for "React" from ${chalk.greenBright(path)}`,
),
);
const dtsFile = await fs.readFile(path, 'utf-8');
await fs.writeFile(path, dtsFile.replace(/React_2/g, 'React'));

const mdtsPath = path.replace(/\.d\.ts$/, '.d.mts');
echo(
chalk.cyan(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -47,7 +47,7 @@
"@babel/preset-typescript": "^7.23.3",
"@changesets/cli": "^2.27.1",
"@changesets/types": "^6.0.0",
"@microsoft/api-extractor": "^7.39.1",
"@microsoft/api-extractor": "^7.43.1",
"@playwright/test": "^1.40.1",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
72 changes: 44 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions turbo.json
@@ -1,5 +1,8 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [
"./config/scripts/build-api.mjs"
],
"pipeline": {
"build": {
"dependsOn": ["^build"],
Expand Down

0 comments on commit 6a3b237

Please sign in to comment.