Skip to content

Commit

Permalink
init: open source
Browse files Browse the repository at this point in the history
  • Loading branch information
cancue committed Apr 23, 2024
0 parents commit 2b89aed
Show file tree
Hide file tree
Showing 90 changed files with 16,878 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
["@babel/preset-env", {"targets": {"node": "current"}}],
"@babel/preset-typescript"
]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
coverage/
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"unused-imports"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"eqeqeq": "off",
"import/no-anonymous-default-export": "off",
"unused-imports/no-unused-imports": "error",
"quotes": [
"error",
"double"
],
"semi": [
"error",
"never"
]
}
}
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# dependencies
/node_modules

# testing
/coverage

# production
/dist

# editor
.idea
.vscode
*.code-workspace
*.suo
*.ntvs*
*.njsproj
*.sln
*.svd
*.userprefs
*.csproj
*.pidb
*.user
*.unityproj
*.booproj
ExportedObj/
*.xcuserstate

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.eslintcache

# log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"bracketSpacing": false,
"trailingComma": "es5",
"arrowParens": "avoid"
}
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# nb-crdt

[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/notebox)

A block based Conflict-free Replicated Data Type that enables collaborative editing across multiple participants allowing for flexible data sharing across spreadsheets, boards, rich text, and more.

## Development

### Prerequisites
```
npm install
```

### Test
```
npm test
```

## Checkout Points
for synchronization, just investigate
- `domain/entity/block`
- `domain/entity/contribution`

for making an editor, all the interfaces you need are in
- `domain/usecase/replica`

## Key Concepts
- `replicaID`
- is an identifier for writers or devices
- `note`
- consists of `blocks`
- `block`
- `block-props`
- nested json object for block properties
- each leaf has its own stamp
- `replicaID`
- `timestamp`
- `text`
- consists of `spans`
- `span`
- `point`
- position identifier
- `content`
- `attrs`
- length
- `text-props`
- flat json object
- `stamp`
- string (UTF16)
- `version`
- per `replicaID`
- `block-props` version
- `text-points` or `DB_RECORD-point` version
12 changes: 12 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"testEnvironment": "node",
"roots": ["<rootDir>/src"],
"coveragePathIgnorePatterns": ["<rootDir>/dist/"],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
],
"moduleNameMapper": {
"@/(.*)": "<rootDir>/src/$1"
}
}
Loading

0 comments on commit 2b89aed

Please sign in to comment.