Skip to content

Commit ab707a2

Browse files
committed
refactored
1 parent ae3042b commit ab707a2

File tree

10 files changed

+50
-13
lines changed

10 files changed

+50
-13
lines changed

.github/workflows/npm-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 20
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 20
29+
registry-url: https://registry.npmjs.org/
30+
- run: npm ci
31+
- run: npm run build
32+
- run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

dist.es2015/route.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { FallbackProps } from 'react-error-boundary';
2+
import { type FallbackProps } from 'react-error-boundary';
33
import { RouteContext } from './context';
44
export interface RouteProps extends React.PropsWithChildren {
55
path?: string;

dist.es2015/router.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
2-
import { RouterContext, PathMatch } from './context';
2+
import { RouterContext } from './context';
3+
import type { PathMatch } from './context';
34
export interface RouterProps extends React.PropsWithChildren {
45
navigate?: (path: string, data?: any, replace?: boolean) => void;
56
match?: (path: string) => PathMatch;

dist/route.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { FallbackProps } from 'react-error-boundary';
2+
import { type FallbackProps } from 'react-error-boundary';
33
import { RouteContext } from './context';
44
export interface RouteProps extends React.PropsWithChildren {
55
path?: string;

dist/router.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
2-
import { RouterContext, PathMatch } from './context';
2+
import { RouterContext } from './context';
3+
import type { PathMatch } from './context';
34
export interface RouterProps extends React.PropsWithChildren {
45
navigate?: (path: string, data?: any, replace?: boolean) => void;
56
match?: (path: string) => PathMatch;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-slim",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "Declarative browser routing for React Web applications",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/route.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import * as React from 'react';
12
import { describe, expect, test } from '@jest/globals';
3+
import type { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
24
import Route from './route';
35
import Router from './router';
4-
import { RouterContext, RouteContext, Params } from './context';
5-
import * as React from 'react';
6-
import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
6+
import { RouterContext, RouteContext, type Params } from './context';
77

88
function defNavigate(path: string, data?: any, replace?: boolean) {
99
if (replace) {

src/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
2-
import { ErrorBoundary, FallbackProps } from 'react-error-boundary';
3-
import { RouteContext, RouterContext, Params } from './context';
2+
import { ErrorBoundary, type FallbackProps } from 'react-error-boundary';
3+
import { RouteContext, RouterContext, type Params } from './context';
44

55
export interface RouteProps extends React.PropsWithChildren {
66
path?: string;

src/router.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import * as React from 'react';
12
import { describe, expect, test } from '@jest/globals';
2-
import { RouterContext, RouteContext } from './context';
33
import Router from './router';
4-
import * as React from 'react';
4+
import { RouterContext } from './context';
55

66
jest.mock('react', () => ({
77
...jest.requireActual('react'),

src/router.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { pathToRegexp, parse } from 'path-to-regexp';
3-
import { RouterContext, RouteContext, Params, PathMatch } from './context';
3+
import { RouterContext, RouteContext } from './context';
4+
import type { Params, PathMatch } from './context';
45

56
const defChangeEvent = 'popstate';
67

0 commit comments

Comments
 (0)