Skip to content

Commit

Permalink
Reorganize signals-react package (#372)
Browse files Browse the repository at this point in the history
* Move usePreactSignalStore to it's own file

* Change usePreactSignalStore to useSignalTracking and to return a `stopTracking` function

* Move patching react internals to a separate file

* Rename useSignalTracking to useSignals

* Move core functionality into runtime subpkg

* Add changeset

* Fix build script

* Fix tsc checking

* Fix exports.umd file path

Co-authored-by: Ryan Christian <[email protected]>
  • Loading branch information
andrewiggins and rschristian committed Jun 20, 2023
1 parent 145bcb3 commit 6717601
Show file tree
Hide file tree
Showing 7 changed files with 569 additions and 505 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-stingrays-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@preact/signals-react": patch
---

Reorganize signals-react package
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"private": true,
"scripts": {
"prebuild": "rimraf packages/core/dist/ packages/preact/dist",
"build": "pnpm build:core && pnpm build:preact && pnpm build:react",
"build": "pnpm build:core && pnpm build:preact && pnpm build:react-runtime && pnpm build:react",
"build:core": "microbundle --raw --cwd packages/core && pnpm postbuild:core",
"build:preact": "microbundle --raw --cwd packages/preact && pnpm postbuild:preact",
"build:react": "microbundle --raw --cwd packages/react && pnpm postbuild:react",
"build:react-runtime": "microbundle --raw --cwd packages/react/runtime && pnpm postbuild:react-runtime",
"postbuild:core": "cd packages/core/dist && mv -f index.d.ts signals-core.d.ts",
"postbuild:preact": "cd packages/preact/dist && mv -f preact/src/index.d.ts signals.d.ts && rm -dr preact",
"postbuild:react": "cd packages/react/dist && mv -f react/src/index.d.ts signals.d.ts && rm -dr react",
"postbuild:react-runtime": "cd packages/react/runtime/dist && mv -f react/runtime/src/*.d.ts . && rm -dr react",
"postbuild": "node ./scripts/node-13-exports.js",
"lint": "pnpm lint:eslint && pnpm lint:tsc",
"lint:eslint": "eslint 'packages/**/*.{ts,tsx,js,jsx}'",
Expand Down
27 changes: 27 additions & 0 deletions packages/react/runtime/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@preact/signals-react-runtime",
"description": "Sub package for @preact/signals-react that contains the pure runtime functions",
"private": true,
"amdName": "reactSignalsRuntime",
"main": "dist/runtime.js",
"module": "dist/runtime.module.js",
"unpkg": "dist/runtime.min.js",
"types": "dist/index.d.ts",
"source": "src/index.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"browser": "./dist/runtime.module.js",
"umd": "./dist/runtime.min.js",
"import": "./dist/runtime.mjs",
"require": "./dist/runtime.js"
}
},
"dependencies": {
"@preact/signals-core": "workspace:^1.3.0",
"use-sync-external-store": "^1.2.0"
},
"peerDependencies": {
"react": "^16.14.0 || 17.x || 18.x"
}
}
Loading

0 comments on commit 6717601

Please sign in to comment.