Skip to content

Commit

Permalink
feat: 实现数据库类
Browse files Browse the repository at this point in the history
  • Loading branch information
LokiSharp committed Oct 14, 2023
1 parent 1b4c0a7 commit 6124122
Show file tree
Hide file tree
Showing 18 changed files with 657 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.idea
node_modules

coverage
tmp
2 changes: 1 addition & 1 deletion common/src/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export class ConfigManager {
class Config {
public common = {
constants: constants,
storage: storage,
dbCollections: dbCollections,
system: {},
};
public engine = engine;
public storage = storage;
}
1 change: 1 addition & 0 deletions common/src/configs/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const storage = {
db: {},
queue: {},
env: {},
dbOptions: { autosave: true, autosaveInterval: 10000 },
};
2 changes: 2 additions & 0 deletions driver/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

coverage
tmp
node_modules
dist
dist-ssr
Expand Down
35 changes: 31 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions storage/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": [
"prettier"
],
"ignorePatterns": [
"dist",
"coverage",
"vite.config.ts"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/explicit-member-accessibility": "warn",
"no-unused-vars": "warn",
"prettier/prettier": "error"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"./tsconfig.json"
]
}
}
26 changes: 26 additions & 0 deletions storage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

coverage
tmp
node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions storage/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"roots": ["<rootDir>/tests"],
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/src/$1"
},
"testMatch": [
"**/__tests__/**/*.+(ts)",
"**/?(*.)+(spec|test).+(ts)"
],
"transform": {
"^.+\\.(ts)$": "ts-jest"
}
}
35 changes: 35 additions & 0 deletions storage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@neo-screeps/storage",
"private": true,
"version": "0.0.0",
"type": "module",
"files": [
"dist"
],
"main": "./dist/storage.cjs",
"module": "./dist/storage.js",
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/storage.js",
"require": "./dist/storage.cjs"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx",
"test": "jest",
"coverage": "jest --coverage"
},
"_moduleAliases": {
"@": "src"
},
"dependencies": {
"lodash": "^4.17.21",
"lokijs": "^1.5.12",
"q": "^1.5.1"
},
"devDependencies": {
"@types/lokijs": "^1.5.10",
"@types/q": "^1.5.6"
}
}
Loading

0 comments on commit 6124122

Please sign in to comment.