refactor(server): rename @affine/storage to @affine/server-native (#6682)

- Close https://github.com/toeverything/AFFiNE/issues/6680
This commit is contained in:
Brooooooklyn
2024-04-29 02:14:20 +00:00
parent 236c6e00df
commit fed2503782
26 changed files with 76 additions and 79 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ yarn
### Build Native binding
```bash
yarn workspace @affine/storage build
yarn workspace @affine/server-native build
```
### Run server
+1 -1
View File
@@ -96,7 +96,7 @@
},
"devDependencies": {
"@affine-test/kit": "workspace:*",
"@affine/storage": "workspace:*",
"@affine/server-native": "workspace:*",
"@napi-rs/image": "^1.9.1",
"@nestjs/testing": "^10.3.7",
"@types/cookie-parser": "^1.4.7",
@@ -1,19 +1,19 @@
import { createRequire } from 'node:module';
let storageModule: typeof import('@affine/storage');
let serverNativeModule: typeof import('@affine/server-native');
try {
storageModule = await import('@affine/storage');
serverNativeModule = await import('@affine/server-native');
} catch {
const require = createRequire(import.meta.url);
storageModule =
serverNativeModule =
process.arch === 'arm64'
? require('../../../storage.arm64.node')
? require('../../../server-native.arm64.node')
: process.arch === 'arm'
? require('../../../storage.armv7.node')
: require('../../../storage.node');
? require('../../../server-native.armv7.node')
: require('../../../server-native.node');
}
export const mergeUpdatesInApplyWay = storageModule.mergeUpdatesInApplyWay;
export const mergeUpdatesInApplyWay = serverNativeModule.mergeUpdatesInApplyWay;
export const verifyChallengeResponse = async (
response: any,
@@ -21,10 +21,10 @@ export const verifyChallengeResponse = async (
resource: string
) => {
if (typeof response !== 'string' || !response || !resource) return false;
return storageModule.verifyChallengeResponse(response, bits, resource);
return serverNativeModule.verifyChallengeResponse(response, bits, resource);
};
export const mintChallengeResponse = async (resource: string, bits: number) => {
if (!resource) return null;
return storageModule.mintChallengeResponse(resource, bits);
return serverNativeModule.mintChallengeResponse(resource, bits);
};
+1 -1
View File
@@ -23,7 +23,7 @@
"path": "./tsconfig.node.json"
},
{
"path": "../storage/tsconfig.json"
"path": "../native/tsconfig.json"
}
],
"ts-node": {