Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bunshi 2.0 #22

Merged
merged 51 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5ddc1e7
Re-organize packages
loganvolkers Jul 7, 2023
f4e1a95
Re-org and cleanup
loganvolkers Jul 7, 2023
9ffd8e4
Pull logic out of React
loganvolkers Jul 7, 2023
1399b39
Primite scope caching
loganvolkers Jul 7, 2023
713149b
Vue test suite working
loganvolkers Jul 8, 2023
8ca804f
Cleanup core and add keys/bindings
loganvolkers Aug 29, 2023
a4fbb5c
Move scope memoization state into the core store
loganvolkers Aug 30, 2023
a1eb9ca
Cleanup internals
loganvolkers Aug 31, 2023
74a217e
Added working examples and build
loganvolkers Sep 6, 2023
b238930
Rename store to injector, key to interface
loganvolkers Sep 6, 2023
bdf89a3
Working vanilla example
loganvolkers Sep 6, 2023
14b905a
Docs
loganvolkers Sep 6, 2023
b5cde88
Rename
loganvolkers Sep 7, 2023
f6d3efb
Lots of docs
loganvolkers Sep 7, 2023
a8bd245
Github actions extension
loganvolkers Sep 8, 2023
b07b050
Updates to docs
loganvolkers Sep 8, 2023
f54d994
Fix typeo
loganvolkers Sep 8, 2023
2f6bb8f
Update bindings API and added tests
loganvolkers Sep 8, 2023
889a041
Type errors and tests
loganvolkers Sep 10, 2023
f61f770
Default injector is shared globally
loganvolkers Sep 11, 2023
e4084b0
Changelog explanation
loganvolkers Sep 11, 2023
c780804
Vue support for interfaces or molecules
loganvolkers Sep 11, 2023
c4e6a31
New website and fixed tsconfig
loganvolkers Sep 11, 2023
5e5a0e1
Ignore generated files
loganvolkers Sep 12, 2023
7f55f11
TSDocs autogeneration and quickstarts
loganvolkers Sep 12, 2023
5d0c0b7
Add some missing keys in package.json, and link to the docs from the …
johanventer Sep 12, 2023
dbaef0e
Fix tests
loganvolkers Sep 13, 2023
d670008
Updated workflow, fix size test
loganvolkers Sep 13, 2023
72aacf5
Derp
loganvolkers Sep 13, 2023
0fe6bb9
Fix vanilla example
loganvolkers Sep 13, 2023
055214e
Ignore coverage
loganvolkers Sep 13, 2023
c145a3a
Component scopes, coverage and tests
loganvolkers Sep 13, 2023
9c0dd44
Export component scope and add docs
loganvolkers Sep 13, 2023
59b88f2
Remove some unecessary config in tsconfig
johanventer Sep 14, 2023
f5be2e6
Improve tsconfig for less LSP errors
johanventer Sep 14, 2023
4d9c5e4
Wrong path
johanventer Sep 14, 2023
0f8c7d8
Make d.ts files generate again
johanventer Sep 14, 2023
3e724db
Component scope tests
loganvolkers Sep 14, 2023
dfa1e02
Fix type error
loganvolkers Sep 14, 2023
1518239
Improve test coverage
loganvolkers Sep 19, 2023
a4076ea
Fix docs to ignore tests, fix tests, implement vue component scope
loganvolkers Sep 20, 2023
e0074e5
Better docs
loganvolkers Sep 20, 2023
ca83216
Vitest extension
loganvolkers Sep 20, 2023
3226c35
CA: Tiny typo fix
Locrian24 Sep 20, 2023
9547893
Docs cleanup
loganvolkers Sep 20, 2023
69dea08
Changelog and version bump
loganvolkers Sep 20, 2023
14d8297
Update interfaces.md
johanventer Sep 20, 2023
5dbd501
Update interfaces.md
johanventer Sep 20, 2023
387577d
Update readme with logo and links
loganvolkers Sep 20, 2023
1c87a41
Merge branch 'vanilla' of https://github.com/saasquatch/jotai-molecul…
loganvolkers Sep 20, 2023
4eed62a
Prep for deploy. Remove failing checks.
loganvolkers Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "Alpine",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:alpine-3.18",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"astro-build.astro-vscode",
"Vue.volar",
"GitHub.codespaces",
"GitHub.vscode-pull-request-github",
"github.vscode-github-actions",
"esbenp.prettier-vscode",
"ZixuanChen.vitest-explorer"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ jobs:
- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Test
run: npm test -- --ci --coverage --maxWorkers=2
- name: Test (vitest)
run: npm run test:code

- name: Build
run: npm run build

- name: Size Test
run: npm run test:size
12 changes: 0 additions & 12 deletions .github/workflows/size.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to GitHub Pages

on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
- name: Install, build, and upload your site
uses: withastro/action@v0
with:
path: website # The root location of your Astro project inside the repository. (optional)
# node-version: 16 # The specific version of Node that should be used to build your site. Defaults to 16. (optional)
# package-manager: yarn # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
node_modules
.cache
dist
coverage
8 changes: 0 additions & 8 deletions .storybook/main.js

This file was deleted.

5 changes: 0 additions & 5 deletions .storybook/preview.js

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"astro.language-server.ls-path": ""
}
43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0] - 2023-09-20

Bunshi 2.0 is the next big release of `jotai-molecules`. We were working on adding `vue` support, and in the process realized that not only did
we not rely on any code from `jotai`, but also that the concept of dependency injection for the frontend that we were working on was actually
useful for a number of different tools and libraries.

For `vue` we realized that molecules are a useful way of sharing and scoping a `ref` across an application. This is similar to the goals of `pinia`,
but we could accomplish it in a more granular way without relying on strings keys.

We also saw that other tools like `valtio` suffer from the need for memoization. Valtio recommends using `useRef` for keeping a stable proxy scoped to
a component or a component tree.

So, instead of creating `vue-molecules` and `valtio-molecules` and others, we decided to keep it simple and rename our library.

The new name for `jotai-molecules` is Bunshi. bunshi (分子, ぶんし) is the japanese word for molecule. Why bunshi? We are big fans of `valtio`, `zustand` and `jotai`,
so we wanted to keep with the tradition of naming libraries using other languages. If you didn't now, `zustand` is German for "state" and `valtio` is Finnish for "state".

The other thing that is releasing at the same time here is our new documentation website. It's difficult to keep everything up to date in a single Readme, so we moved to a static site generator.

Moving for `jotai-molecules` to `bunshi`? To migrate change your imports from `jotai-molecules` to `bunshi/react` for example:

```diff
- import { useMolecule, molecule } from "jotai-molecules"
+ import { useMolecule, molecule } from "bunshi/react"
```

### Changed
- Renamed from `jotai-molecules` to `bunshi`
- Default export no longer returns react. Users will need to change imports from `jotai-molecules` to `bunshi/react`

### Added
- `bunshi` Vanilla JS support
- `bunshi/vue` Vue support
- `bunshi/react` React-specific import
- `createInjector` and `getDefaultInjector` to access internal state
- `moleculeInterface` for creating bindable interfaces
- `ComponentScope` for pushing state down into components
- Documentation website


## [1.1.1] - 2023-04-20

### Changed
Expand Down Expand Up @@ -40,7 +80,8 @@ Initial release of `jotai-molecules`
- `createScope` for creating a scope for molecules
- `ScopeProvider` a React component for providing scope to the tree

[unreleased]: https://github.com/saasquatch/jotai-molecules/compare/v1.1.1...HEAD
[unreleased]: https://github.com/saasquatch/jotai-molecules/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/saasquatch/jotai-molecules/releases/tag/v2.0.0
[1.1.1]: https://github.com/saasquatch/jotai-molecules/releases/tag/v1.1.1
[1.1.0]: https://github.com/saasquatch/jotai-molecules/releases/tag/v1.1.0
[1.0.3]: https://github.com/saasquatch/jotai-molecules/releases/tag/v1.0.3
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Reporting Issues

If you have found what you think is a bug, please [file an issue](https://github.com/saasquatch/jotai-molecules/issues/new).
If you have found what you think is a bug, please [file an issue](https://github.com/saasquatch/bunshi/issues/new).

## Suggesting new features

Expand Down
Loading