Skip to content

Commit

Permalink
feat: Migration to typescript and provides types
Browse files Browse the repository at this point in the history
  • Loading branch information
rudionrails committed Feb 22, 2022
1 parent 542b99d commit b914e62
Show file tree
Hide file tree
Showing 10 changed files with 5,514 additions and 5,435 deletions.
14 changes: 4 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
.cache/
dist/
/node_modules
.cache
dist
node_modules

# testing
/coverage
coverage
.nyc_output

# linting
.eslintcache

# production
/build

# misc
.DS_Store
npm-debug.log*
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ userRoute({ id: "123", foo: "bar" }); // => "/users/123?foo=bar"
* You can access the initially passed pattern in multiple ways
*/
const pattern = userRoute.pattern; // => "/users/:id"
const routes = { [userRoute]: true } // => { "/users/:id": true }
const routes = { [userRoute]: true }; // => { "/users/:id": true }
const text = `The pattern is "${userRoute}"`; // => The pattern is "/users/:id"

```

Define your routes. The below example could be in your `src/routes.js` and may use a framework, such as React, Vue, Angular, etc:
Expand All @@ -49,8 +48,7 @@ export const myTaskRoute = createRoute("/tasks/:id");
export default {
[tasksRoute]: TasksPage,
[myTaskRoute]: TaskPage,
}

};
```

Now use a route in a component. The example uses React, but this could be any framework:
Expand All @@ -70,3 +68,25 @@ function List() {
}
```
## Release
To release a new version of the package, run the following commands:
```
# version bump the next patch (detault)
npm run release
# make sure the new tag is in github
git push --follow-tags origin master
# publish to npm
npm publish
```
If you want to control the version, see instructions here for [syandard-version](https://www.npmjs.com/package/standard-version):
```
npm release -- --release-as minor
```
41 changes: 0 additions & 41 deletions index.js

This file was deleted.

60 changes: 0 additions & 60 deletions index.test.js

This file was deleted.

6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>/src/"],
};
Loading

0 comments on commit b914e62

Please # to comment.