Skip to content

Commit 7139a67

Browse files
committed
feat: add initial implementation
0 parents  commit 7139a67

39 files changed

+10193
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.js]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[{package.json,*.yml,*.cjson}]
14+
indent_style = space
15+
indent_size = 2

.github/workflows/ci.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
- renovate/*
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- run: corepack enable
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: pnpm
23+
24+
- name: 📦 Install dependencies
25+
run: pnpm install
26+
27+
- name: 🔠 Lint project
28+
run: pnpm lint
29+
30+
- name: ✂️ Knip project
31+
run: pnpm knip
32+
33+
- name: ⚙️ Check package engines
34+
run: pnpm installed-check -d
35+
36+
test:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
- run: corepack enable
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: 20
45+
cache: pnpm
46+
47+
- name: 📦 Install dependencies
48+
run: pnpm install
49+
50+
- name: 🛠 Build project
51+
run: pnpm build
52+
53+
- name: 💪 Test types
54+
run: pnpm test:types
55+
56+
- name: 🧪 Test project
57+
run: pnpm test:unit -- --coverage
58+
59+
- name: 🟩 Coverage
60+
uses: codecov/codecov-action@v5

.github/workflows/codeql.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: "31 15 * * 5"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ javascript ]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: +security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v3
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v3
40+
with:
41+
category: "/language:${{ matrix.language }}"

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
dist
2+
node_modules
3+
coverage
4+
.vscode
5+
.DS_Store
6+
.eslintcache
7+
*.log*
8+
*.env*
9+
10+
!playground/.env

CODE_OF_CONDUCT.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44+
45+
[homepage]: https://www.contributor-covenant.org
46+
47+
For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq

LICENCE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Daniel Roe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# zero-vue
2+
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![Github Actions][github-actions-src]][github-actions-href]
6+
[![Codecov][codecov-src]][codecov-href]
7+
8+
> Package description
9+
10+
## Usage
11+
12+
Install package:
13+
14+
```sh
15+
# npm
16+
npm install zero-vue
17+
18+
# pnpm
19+
pnpm install zero-vue
20+
```
21+
22+
```js
23+
import {} from 'zero-vue'
24+
```
25+
26+
## 💻 Development
27+
28+
- Clone this repository
29+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
30+
- Install dependencies using `pnpm install`
31+
- Run interactive tests using `pnpm dev`
32+
33+
## License
34+
35+
Made with ❤️
36+
37+
Published under [MIT License](./LICENCE).
38+
39+
<!-- Badges -->
40+
41+
[npm-version-src]: https://img.shields.io/npm/v/zero-vue?style=flat-square
42+
[npm-version-href]: https://npmjs.com/package/zero-vue
43+
[npm-downloads-src]: https://img.shields.io/npm/dm/zero-vue?style=flat-square
44+
[npm-downloads-href]: https://npm.chart.dev/zero-vue
45+
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/danielroe/zero-vue/ci.yml?branch=main&style=flat-square
46+
[github-actions-href]: https://github.com/danielroe/zero-vue/actions?query=workflow%3Aci
47+
[codecov-src]: https://img.shields.io/codecov/c/gh/danielroe/zero-vue/main?style=flat-square
48+
[codecov-href]: https://codecov.io/gh/danielroe/zero-vue

build.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { cp, readdir, rm } from 'node:fs/promises'
2+
import { defineBuildConfig } from 'unbuild'
3+
4+
export default defineBuildConfig({
5+
hooks: {
6+
'rollup:done': async function () {
7+
// default to .js and .d.ts extensions
8+
for (const file of await readdir('dist')) {
9+
if (file.endsWith('.mjs') || file.endsWith('.d.mts')) {
10+
await cp(`dist/${file}`, `dist/${file.replace('.mjs', '.js').replace('.d.mts', '.d.ts')}`)
11+
await rm(`dist/${file}`)
12+
}
13+
}
14+
},
15+
},
16+
})

eslint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu()

knip.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"ignoreWorkspaces": [
4+
"playground"
5+
]
6+
}

package.json

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "zero-vue",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"packageManager": "pnpm@9.15.1",
6+
"description": "",
7+
"license": "MIT",
8+
"repository": "danielroe/zero-vue",
9+
"sideEffects": false,
10+
"exports": {
11+
".": "./dist/index.js"
12+
},
13+
"main": "./dist/index.js",
14+
"module": "./dist/index.js",
15+
"types": "./dist/index.d.ts",
16+
"files": [
17+
"dist"
18+
],
19+
"scripts": {
20+
"build": "unbuild",
21+
"dev": "vitest dev",
22+
"lint": "eslint . --fix",
23+
"prepare": "simple-git-hooks",
24+
"prepack": "pnpm build",
25+
"prepublishOnly": "pnpm lint && pnpm test",
26+
"release": "bumpp && pnpm publish",
27+
"test": "pnpm test:unit && pnpm test:types",
28+
"test:unit": "vitest",
29+
"test:types": "tsc --noEmit && pnpm -r test:types"
30+
},
31+
"peerDependencies": {
32+
"vue": "^3.5.13"
33+
},
34+
"dependencies": {
35+
"@rocicorp/zero": "^0.10.2024122404"
36+
},
37+
"devDependencies": {
38+
"@antfu/eslint-config": "latest",
39+
"@vitest/coverage-v8": "latest",
40+
"bumpp": "latest",
41+
"eslint": "latest",
42+
"installed-check": "latest",
43+
"knip": "latest",
44+
"lint-staged": "latest",
45+
"simple-git-hooks": "latest",
46+
"typescript": "latest",
47+
"unbuild": "latest",
48+
"vitest": "latest",
49+
"vue": "^3.5.13"
50+
},
51+
"resolutions": {
52+
"zero-vue": "link:."
53+
},
54+
"simple-git-hooks": {
55+
"pre-commit": "npx lint-staged"
56+
},
57+
"lint-staged": {
58+
"*.{js,ts,mjs,cjs,json,.*rc}": [
59+
"npx eslint --fix"
60+
]
61+
}
62+
}

playground/.env

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ZERO_UPSTREAM_DB="postgresql://user:password@127.0.0.1:5430/zstart"
2+
ZERO_CVR_DB="postgresql://user:password@127.0.0.1:5430/zstart_cvr"
3+
ZERO_CHANGE_DB="postgresql://user:password@127.0.0.1:5430/zstart_cdb"
4+
ZERO_AUTH_SECRET="secretkey"
5+
ZERO_REPLICA_FILE="/tmp/zstart_replica.db"
6+
7+
VITE_ZERO_SERVER='http://localhost:4848'

playground/docker/docker-compose.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
zstart_postgres:
3+
image: postgres:16.6-alpine
4+
shm_size: 1g
5+
user: postgres
6+
restart: always
7+
healthcheck:
8+
test: 'pg_isready -U user --dbname=postgres'
9+
interval: 10s
10+
timeout: 5s
11+
retries: 5
12+
ports:
13+
- 5430:5432
14+
environment:
15+
POSTGRES_USER: user
16+
POSTGRES_DB: postgres
17+
POSTGRES_PASSWORD: password
18+
command: |
19+
postgres
20+
-c wal_level=logical
21+
-c max_wal_senders=10
22+
-c max_replication_slots=5
23+
-c hot_standby=on
24+
-c hot_standby_feedback=on
25+
volumes:
26+
- zstart_pgdata:/var/lib/postgresql/data
27+
- ./:/docker-entrypoint-initdb.d
28+
29+
volumes:
30+
zstart_pgdata:
31+
driver: local

0 commit comments

Comments
 (0)