Skip to content

Commit

Permalink
Add yalc
Browse files Browse the repository at this point in the history
  • Loading branch information
tbantle22 committed Jan 12, 2024
1 parent 07e2535 commit 87c6b13
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 366 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"scripts": {
"ci": "yarn prettier && yarn compile && yarn lint && yarn test && yarn build",
"clean": "rimraf node_modules -g 'packages/*/.eslintcache' 'packages/*/*.tsbuildinfo' 'packages/*/dist' 'packages/*/.rollup.cache' 'packages/*/types'",
"clean": "rimraf node_modules -g 'packages/*/.eslintcache' 'packages/*/*.tsbuildinfo' 'packages/*/dist' 'packages/*/.rollup.cache' 'packages/*/types' 'packages/*/coverage'",
"compile": "yarn workspace @dolthub/react-hooks compile",
"build": "yarn workspace @dolthub/react-hooks build",
"lint": "yarn workspace @dolthub/react-hooks lint",
Expand Down
29 changes: 29 additions & 0 deletions packages/hooks/README.dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Developer notes

## Testing in a local app

Using [`yalc`](https://github.com/wclr/yalc) is the best way to test this library in another local package.

First, compile and build this package:

```zsh
% yarn dbuild
```

And publish to `yalc`:

```zsh
% yalc publish
```

The `yalc:publish` script will also achieve the above.

Then in your app, link to this package:

```zsh
other-app % yalc link @dolthub/react-hooks
```

And you will see and up-to-date version of this package. When you make a change to this package, you can push the change by running `yarn yalc:push`.

To remove the yalc package in your app, run `yalc remove --all`.
26 changes: 0 additions & 26 deletions packages/hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,3 @@ function MyComponent() {
return <div>Home</div>;
}
```

## Testing in a local package

First compile and build the package:

```
% yarn compile & yarn build
```

If you have a local copy of this package and want to test a change in another local
package, you can either add `@dolthub/react-hooks` and point it at the file path, or if
`@dolthub/react-hooks` is already installed add the file path to `resolutions` in your
`package.json`, like so:

```json
// ../other-package/package.json
{
...,
"resolutions": {
"@dolthub/react-hooks": "file:../../react-library/packages/hooks",
"@types/react": "18.2.33"
}
}
```

Note that you may also need the same `@types/react` version.
9 changes: 6 additions & 3 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"scripts": {
"compile": "tsc -b",
"build": "rollup -c --bundleConfigAsCjs",
"build:watch": "rollup -c --bundleConfigAsCjs --watch",
"dbuild": "yarn compile && yarn build",
"lint": "eslint --cache --ext .ts,.js,.tsx,.jsx src",
"prettier": "prettier --check 'src/**/*.{js,ts}'",
"prettier-fix": "prettier --write 'src/**/*.{js,ts}'",
"test": "jest --env=jest-environment-jsdom"
"test": "jest --env=jest-environment-jsdom",
"yalc:publish": "yarn dbuild && yalc publish",
"yalc:push": "yarn dbuild && yalc push"
},
"peerDependencies": {
"react": "^18.2.0",
Expand Down Expand Up @@ -63,7 +65,8 @@
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"yalc": "^1.0.0-pre.53"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"include": ["./src"],
"exclude": ["./types", "./esm", "./cjs", "node_modules", "dist", "__tests__"],
"exclude": ["./types", "./esm", "./cjs", "node_modules", "./dist", "./src/__tests__"],
"compilerOptions": {
"rootDir": "src",
"baseUrl": ".",
Expand Down
Loading

0 comments on commit 87c6b13

Please sign in to comment.