Browse Source

Separate project

Extract project from monorepo.
master
TheoryOfNekomata 3 years ago
commit
f1019fe92d
6 changed files with 65 additions and 0 deletions
  1. +2
    -0
      .npmignore
  2. +3
    -0
      README.md
  3. +11
    -0
      package.json
  4. +5
    -0
      src/plugin.ts
  5. +16
    -0
      src/storage.ts
  6. +28
    -0
      tsconfig.json

+ 2
- 0
.npmignore View File

@@ -0,0 +1,2 @@
*.ts
tsconfig.json

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
# Zeichen - Core

Library for authoring Zeichen plugins and themes.

+ 11
- 0
package.json View File

@@ -0,0 +1,11 @@
{
"name": "zeichen-core",
"description": "Library for authoring Zeichen plugins and themes.",
"version": "0.1.0",
"devDependencies": {
"typescript": "^4.0.3"
},
"scripts": {
"build": "tsc **/*.ts"
}
}

+ 5
- 0
src/plugin.ts View File

@@ -0,0 +1,5 @@
export type State = {
currentUserId: string,
}

export type Plugin<T = {}> = (config: T) => (state: State) => void

+ 16
- 0
src/storage.ts View File

@@ -0,0 +1,16 @@
export default interface Storage<T> {
queryItems(): Promise<T[]>
saveItem(item: T): Promise<void>
deleteItem(item: T): Promise<boolean>
}

export interface Collection<T> {
items: T[],
lastModifiedBy: string,
lastModifiedAt: Date,
}

export type Serializer<T = unknown> = (t: T) => string
export type Deserializer<T = unknown> = (s: string) => T

export class OutOfSyncError {}

+ 28
- 0
tsconfig.json View File

@@ -0,0 +1,28 @@
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"declarationDir": "./dist",
"emitDeclarationOnly": true,
"sourceMap": true,
"strict": false
},
"exclude": [
"node_modules",
"**/*.test.ts"
],
"include": [
"**/*.ts"
]
}

Loading…
Cancel
Save