Skip to content

Commit aa8b0af

Browse files
committed
Fix index.d.ts build, cleaning
1 parent 36604ca commit aa8b0af

File tree

7 files changed

+21
-352
lines changed

7 files changed

+21
-352
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ Wrapper for `react-router` that allows you to load data before switching the scr
1414
| | | |
1515
| ------------ | ------- | --- |
1616
| react | >= 16.8 | |
17-
| react-dom | >= 16.8 | |
18-
| react-router | **5** | **Package version 0.x.x** |
19-
| react-router | **6** | **Package version 1.x.x** |
17+
| react-router | **^5.0.0** | **Package version 0.x.x** |
18+
| react-router | **^6.0.0** | **Package version 1.x.x** |
2019

2120
This package uses `react-router` (`react-router-dom` or `react-router-native`) as main router so you should implement it in your project first.
2221

examples/react-router-6/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"react": "^18.1.0",
1212
"react-dom": "^18.1.0",
1313
"react-router-dom": "^6.3.0",
14-
"react-router-loading": "1.0.0-beta.0"
14+
"react-router-loading": "1.0.0-beta.2"
1515
},
1616
"devDependencies": {
1717
"@types/react": "^18.0.9",

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
"private": true,
44
"workspaces": {
55
"packages": [
6-
"packages/react-router-loading",
7-
"examples/react-router-5/",
8-
"examples/react-router-6/"
6+
"packages/*",
7+
"examples/*"
98
]
109
},
1110
"devDependencies": {

packages/react-router-loading/lib/LoadingContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createContext } from 'react';
22

33
// Interface
44

5-
interface LoadingContextActions {
5+
export interface LoadingContextActions {
66
start: () => void;
77
done: () => void;
88
restart: () => void;

packages/react-router-loading/package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-loading",
3-
"version": "1.0.0-beta.1",
3+
"version": "1.0.0-beta.2",
44
"description": "Wrapper for react-router that allows you to load data before switching the screen",
55
"author": "Victor Trusov",
66
"repository": {
@@ -31,12 +31,12 @@
3131
"scripts": {
3232
"dev": "vite",
3333
"build": "tsc && vite build",
34+
"build:types": "tsc --declaration --emitDeclarationOnly --allowSyntheticDefaultImports --esModuleInterop --isolatedModules false -jsx react-jsx --outFile dist/index.d.ts lib/index.ts",
3435
"preview": "vite preview",
35-
"publish": "cp -fr ../../README.md . && npm publish"
36+
"publish": "build && build:types && cp -fr ../../README.md . && npm publish"
3637
},
3738
"peerDependencies": {
3839
"react": ">=16.8",
39-
"react-dom": ">=16.8",
4040
"react-router-dom": "^6.0.0"
4141
},
4242
"dependencies": {
@@ -45,15 +45,11 @@
4545
"devDependencies": {
4646
"@types/node": "^17.0.36",
4747
"@types/react": "^18.0.9",
48-
"@types/react-dom": "^18.0.5",
49-
"@types/react-router-dom": "^5.3.3",
5048
"@vitejs/plugin-react": "^1.3.2",
5149
"react": "^18.1.0",
52-
"react-dom": "^18.1.0",
5350
"react-router": "^6.3.0",
5451
"typescript": "^4.6.3",
55-
"vite": "^2.9.9",
56-
"vite-plugin-dts": "^1.2.0"
52+
"vite": "^2.9.9"
5753
},
5854
"files": [
5955
"dist"

packages/react-router-loading/vite.config.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
import { defineConfig } from 'vite';
22
import path from 'node:path';
33
import react from '@vitejs/plugin-react';
4-
import dts from 'vite-plugin-dts';
4+
5+
const resolvePath = (str: string) => path.resolve(__dirname, str);
56

67
// https://vitejs.dev/config/
78
export default defineConfig({
89
plugins: [
9-
react(),
10-
dts({
11-
insertTypesEntry: true,
12-
}),
10+
react()
1311
],
1412
build: {
1513
lib: {
16-
entry: path.resolve(__dirname, 'lib/index.ts'),
14+
entry: resolvePath('lib/index.ts'),
1715
name: 'react-router-loading',
1816
formats: ['es', 'umd'],
1917
fileName: (format) => `react-router-loading.${format}.js`,
2018
},
2119
rollupOptions: {
22-
external: ['react', 'react-dom', 'react-router', 'react-router-dom', 'topbar'],
20+
external: ['react', 'react-router', 'topbar'],
2321
output: {
2422
globals: {
2523
react: 'React',
26-
'react-dom': 'ReactDOM',
2724
'react-router': 'ReactRouter',
28-
'react-router-dom': 'ReactRouterDOM',
2925
'topbar': 'topbar'
3026
},
3127
},

0 commit comments

Comments
 (0)