Skip to content

Commit

Permalink
fix: replace usedatafunctionreturn with serializefrom as per remix 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sandulat committed Aug 26, 2022
1 parent b5f2779 commit 03e2f40
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ First, you have to install the package itself:
yarn add -D remix-docs-gen
```

> Note that you need @remix-run/server-runtime to be at least ^1.7.0.
## Usage Example

You can simply run:
Expand Down
6 changes: 6 additions & 0 deletions packages/remix-docs-gen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# remix-docs-gen

## 0.1.3

### Patch Changes

- Replace UseDataFunctionReturn with SerializeFrom as per Remix 1.7.0.

## 0.1.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-docs-gen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remix-docs-gen",
"version": "0.1.2",
"version": "0.1.3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down Expand Up @@ -33,6 +33,6 @@
"config": "*"
},
"peerDependencies": {
"@remix-run/dev": "^1.0.3"
"@remix-run/dev": "^1.7.0"
}
}
6 changes: 3 additions & 3 deletions packages/remix-docs-gen/src/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ const parseDataFunctionOutput = (

const typeName = `__RESERVED_${dataFunctionName}_RETURN_TYPE_${timestamp}`;

const dataFunctionReturnTypeName = `__RESERVED_USE_DATA_FUNCTION_RETURN_${timestamp}`;
const serializeFromTypeName = `__RESERVED_SERIALIZE_FROM_${timestamp}`;

sourceFile
.replaceWithText(
`import { UseDataFunctionReturn as ${dataFunctionReturnTypeName} } from "@remix-run/react/dist/components";
`import type { SerializeFrom as ${serializeFromTypeName} } from "@remix-run/server-runtime";
${sourceFile.getFullText()}
type ${typeName} = ${dataFunctionReturnTypeName}<typeof ${dataFunctionName}>;
type ${typeName} = ${serializeFromTypeName}<typeof ${dataFunctionName}>;
`
)
.getFullText();
Expand Down

0 comments on commit 03e2f40

Please sign in to comment.