Skip to content

Commit

Permalink
🐛 fix: Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Nov 25, 2024
1 parent 820b4bc commit b6ae2a1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"react.js"
],
"scripts": {
"build": "npm run clean && father build && npm run build:d",
"build:d": "cp react.js react.d.ts && cp server.js server.d.ts",
"build": "tsx ./scripts/clean.ts && father build && tsx ./scripts/build.ts",
"ci": "npm run lint && npm run type-check && npm run doctor",
"clean": "rm react.d.ts && rm server.d.ts",
"dev": "father dev",
"docs:build": "npm run build && dumi build",
"docs:build-analyze": "ANALYZE=1 dumi build",
Expand Down
11 changes: 11 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { copyFileSync } from 'node:fs';
import { resolve } from 'node:path';

const root = resolve(__dirname, '..');

const build = async (filename: string) => {
copyFileSync(filename, filename.replace('.js', '.d.ts'));
};

build(resolve(root, 'react.js'));
build(resolve(root, 'server.js'));
13 changes: 13 additions & 0 deletions scripts/clean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { existsSync, unlinkSync } from 'node:fs';
import { resolve } from 'node:path';

const root = resolve(__dirname, '..');

const clean = async (filename: string) => {
if (existsSync(filename)) {
unlinkSync(filename);
}
};

clean(resolve(root, 'react.d.ts'));
clean(resolve(root, 'server.d.ts'));

0 comments on commit b6ae2a1

Please sign in to comment.