mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 14:08:55 +08:00
feat(client): migration old package to rspack (#15068)
#### PR Dependency Tree * **PR #15068** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Upgraded Vitest across packages to 4.1.8 and bumped Tailwind PostCSS to 4.3.0 * CLI/tooling updated to support the media-capture-playground package and adjust build/dev server behavior * **Bug Fixes** * Improved workspace deletion reliability in the Electron app * **Refactor** * Simplified media capture playground build setup (build/config adjustments) * **Tests** * Made tests more robust by preserving/restoring environment state during runs <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -299,6 +299,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vanilla-extract/vite-plugin": "^5.0.0",
|
"@vanilla-extract/vite-plugin": "^5.0.0",
|
||||||
"msw": "^2.13.2",
|
"msw": "^2.13.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
@@ -7,7 +9,9 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
plugins: [vanillaExtractPlugin()],
|
plugins: [vanillaExtractPlugin()],
|
||||||
test: {
|
test: {
|
||||||
globalSetup: '../../../scripts/vitest-global.js',
|
globalSetup: fileURLToPath(
|
||||||
|
new URL('../../../scripts/vitest-global.js', import.meta.url)
|
||||||
|
),
|
||||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||||
testTimeout: 1000,
|
testTimeout: 1000,
|
||||||
coverage: {
|
coverage: {
|
||||||
|
|||||||
@@ -29,9 +29,9 @@
|
|||||||
"yjs": "^13.6.27"
|
"yjs": "^13.6.27"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitest/browser-playwright": "^4.0.18",
|
"@vitest/browser-playwright": "^4.1.8",
|
||||||
"playwright": "=1.58.2",
|
"playwright": "=1.58.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
"yjs": "^13.6.27"
|
"yjs": "^13.6.27"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -5,7 +7,9 @@ export default defineConfig({
|
|||||||
target: 'es2018',
|
target: 'es2018',
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
globalSetup: '../../scripts/vitest-global.js',
|
globalSetup: fileURLToPath(
|
||||||
|
new URL('../../../scripts/vitest-global.js', import.meta.url)
|
||||||
|
),
|
||||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||||
testTimeout: 1000,
|
testTimeout: 1000,
|
||||||
coverage: {
|
coverage: {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"lit": "^3.2.0"
|
"lit": "^3.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -5,7 +7,9 @@ export default defineConfig({
|
|||||||
target: 'es2018',
|
target: 'es2018',
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
globalSetup: '../../../scripts/vitest-global.js',
|
globalSetup: fileURLToPath(
|
||||||
|
new URL('../../../../scripts/vitest-global.js', import.meta.url)
|
||||||
|
),
|
||||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||||
testTimeout: 1000,
|
testTimeout: 1000,
|
||||||
coverage: {
|
coverage: {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"lit": "^3.2.0"
|
"lit": "^3.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -5,7 +7,9 @@ export default defineConfig({
|
|||||||
target: 'es2018',
|
target: 'es2018',
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
globalSetup: '../../../scripts/vitest-global.js',
|
globalSetup: fileURLToPath(
|
||||||
|
new URL('../../../../scripts/vitest-global.js', import.meta.url)
|
||||||
|
),
|
||||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||||
testTimeout: 1000,
|
testTimeout: 1000,
|
||||||
coverage: {
|
coverage: {
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitest/browser-playwright": "^4.0.18",
|
"@vitest/browser-playwright": "^4.1.8",
|
||||||
"playwright": "=1.58.2",
|
"playwright": "=1.58.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/pdfmake": "^0.2.12",
|
"@types/pdfmake": "^0.2.12",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"version": "0.26.3"
|
"version": "0.26.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -5,7 +7,9 @@ export default defineConfig({
|
|||||||
target: 'es2018',
|
target: 'es2018',
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
globalSetup: '../../../scripts/vitest-global.js',
|
globalSetup: fileURLToPath(
|
||||||
|
new URL('../../../scripts/vitest-global.js', import.meta.url)
|
||||||
|
),
|
||||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||||
testTimeout: 1000,
|
testTimeout: 1000,
|
||||||
coverage: {
|
coverage: {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
"rxjs": "^7.8.2"
|
"rxjs": "^7.8.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"version": "0.26.3"
|
"version": "0.26.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitest/browser-playwright": "^4.0.18",
|
"@vitest/browser-playwright": "^4.1.8",
|
||||||
"playwright": "=1.58.2",
|
"playwright": "=1.58.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
"y-protocols": "^1.0.6"
|
"y-protocols": "^1.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"yjs": "*"
|
"yjs": "*"
|
||||||
|
|||||||
@@ -35,11 +35,11 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vanilla-extract/vite-plugin": "^5.0.0",
|
"@vanilla-extract/vite-plugin": "^5.0.0",
|
||||||
"@vitest/browser-playwright": "^4.0.18",
|
"@vitest/browser-playwright": "^4.1.8",
|
||||||
"playwright": "=1.58.2",
|
"playwright": "=1.58.2",
|
||||||
"vite": "^7.2.7",
|
"vite": "^7.2.7",
|
||||||
"vite-plugin-wasm": "^3.5.0",
|
"vite-plugin-wasm": "^3.5.0",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"version": "0.26.3"
|
"version": "0.26.3"
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -64,9 +64,9 @@
|
|||||||
"@types/node": "^22.0.0",
|
"@types/node": "^22.0.0",
|
||||||
"@typescript-eslint/parser": "^8.55.0",
|
"@typescript-eslint/parser": "^8.55.0",
|
||||||
"@vanilla-extract/vite-plugin": "^5.0.0",
|
"@vanilla-extract/vite-plugin": "^5.0.0",
|
||||||
"@vitest/browser": "^4.0.18",
|
"@vitest/browser": "^4.1.8",
|
||||||
"@vitest/coverage-istanbul": "^4.0.18",
|
"@vitest/coverage-istanbul": "^4.1.8",
|
||||||
"@vitest/ui": "^4.0.18",
|
"@vitest/ui": "^4.1.8",
|
||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"electron": "^39.0.0",
|
"electron": "^39.0.0",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
"typescript-eslint": "^8.55.0",
|
"typescript-eslint": "^8.55.0",
|
||||||
"unplugin-swc": "^1.5.9",
|
"unplugin-swc": "^1.5.9",
|
||||||
"vite": "^7.2.7",
|
"vite": "^7.2.7",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.13.0",
|
"packageManager": "yarn@4.13.0",
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
@@ -150,20 +150,26 @@ test('should not switch user quota if the new quota is the same as the current o
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should use pro plan as free for selfhost instance', async t => {
|
test('should use pro plan as free for selfhost instance', async t => {
|
||||||
|
const previousDeploymentType = env.DEPLOYMENT_TYPE;
|
||||||
// @ts-expect-error DEPLOYMENT_TYPE is readonly
|
// @ts-expect-error DEPLOYMENT_TYPE is readonly
|
||||||
env.DEPLOYMENT_TYPE = 'selfhosted';
|
env.DEPLOYMENT_TYPE = 'selfhosted';
|
||||||
await using module = await createTestingModule();
|
try {
|
||||||
|
await using module = await createTestingModule();
|
||||||
|
|
||||||
const models = module.get(Models);
|
const models = module.get(Models);
|
||||||
const u1 = await models.user.create({
|
const u1 = await models.user.create({
|
||||||
email: 'u1@affine.pro',
|
email: 'u1@affine.pro',
|
||||||
registered: true,
|
registered: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
await models.userFeature.add(u1.id, 'free_plan_v1', 'legacy projection');
|
await models.userFeature.add(u1.id, 'free_plan_v1', 'legacy projection');
|
||||||
const quota = await models.userFeature.getQuota(u1.id);
|
const quota = await models.userFeature.getQuota(u1.id);
|
||||||
t.snapshot(
|
t.snapshot(
|
||||||
quota?.configs,
|
quota?.configs,
|
||||||
'use pro plan as free plan for selfhosted instance'
|
'use pro plan as free plan for selfhosted instance'
|
||||||
);
|
);
|
||||||
|
} finally {
|
||||||
|
// @ts-expect-error DEPLOYMENT_TYPE is readonly
|
||||||
|
env.DEPLOYMENT_TYPE = previousDeploymentType;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -327,6 +327,9 @@ test.after.always(async t => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('reconciles quota states from entitlements and business tables', async t => {
|
test('reconciles quota states from entitlements and business tables', async t => {
|
||||||
|
const previousDeploymentType = globalThis.env.DEPLOYMENT_TYPE;
|
||||||
|
// @ts-expect-error test mutates env singleton for cloud entitlement semantics
|
||||||
|
globalThis.env.DEPLOYMENT_TYPE = 'affine';
|
||||||
const cases = [
|
const cases = [
|
||||||
{
|
{
|
||||||
name: 'owner fallback uses user entitlement and owner storage usage',
|
name: 'owner fallback uses user entitlement and owner storage usage',
|
||||||
@@ -444,10 +447,15 @@ test('reconciles quota states from entitlements and business tables', async t =>
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const item of cases) {
|
try {
|
||||||
await t.context.module.initTestingDB();
|
for (const item of cases) {
|
||||||
const state = await item.setup();
|
await t.context.module.initTestingDB();
|
||||||
await item.assert(state);
|
const state = await item.setup();
|
||||||
|
await item.assert(state);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// @ts-expect-error restore mutable test env singleton
|
||||||
|
globalThis.env.DEPLOYMENT_TYPE = previousDeploymentType;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/debug": "^4.1.12",
|
"@types/debug": "^4.1.12",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"version": "0.26.3"
|
"version": "0.26.3"
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
"./automation": "./src/automation.ts",
|
"./automation": "./src/automation.ts",
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
"graphql": "^16.9.0"
|
"graphql": "^16.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"@graphql-codegen/typescript-operations": "^5.0.9",
|
"@graphql-codegen/typescript-operations": "^5.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"prettier": "^3.7.4",
|
"prettier": "^3.7.4",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "gql-gen --errors-only"
|
"build": "gql-gen --errors-only"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"@testing-library/react": "^16.1.0",
|
"@testing-library/react": "^16.1.0",
|
||||||
"@types/react": "^19.0.1",
|
"@types/react": "^19.0.1",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"electron": "*",
|
"electron": "*",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
"fake-indexeddb": "^6.0.0",
|
"fake-indexeddb": "^6.0.0",
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
"socket.io-client": "^4.8.3",
|
"socket.io-client": "^4.8.3",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@affine/error": "workspace:*",
|
"@affine/error": "workspace:*",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@blocksuite/affine": "workspace:*",
|
"@blocksuite/affine": "workspace:*",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@blocksuite/affine": "workspace:*"
|
"@blocksuite/affine": "workspace:*"
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"tailwindcss": "^4.1.17",
|
"tailwindcss": "^4.1.17",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "affine bundle",
|
"build": "affine bundle",
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
"@sentry/esbuild-plugin": "^5.3.0",
|
"@sentry/esbuild-plugin": "^5.3.0",
|
||||||
"@toeverything/infra": "workspace:*",
|
"@toeverything/infra": "workspace:*",
|
||||||
"@types/set-cookie-parser": "^2.4.10",
|
"@types/set-cookie-parser": "^2.4.10",
|
||||||
"@vitejs/plugin-react": "^5.2.0",
|
|
||||||
"app-builder-lib": "^26.8.1",
|
"app-builder-lib": "^26.8.1",
|
||||||
"builder-util-runtime": "^9.5.1",
|
"builder-util-runtime": "^9.5.1",
|
||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
@@ -71,7 +70,7 @@
|
|||||||
"tree-kill": "^1.2.2",
|
"tree-kill": "^1.2.2",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"uuid": "^14.0.0",
|
"uuid": "^14.0.0",
|
||||||
"vitest": "^4.0.18",
|
"vitest": "^4.1.8",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ async function deleteWorkspaceV1(workspaceId: string) {
|
|||||||
try {
|
try {
|
||||||
await ensureSQLiteDisconnected('workspace', workspaceId);
|
await ensureSQLiteDisconnected('workspace', workspaceId);
|
||||||
const basePath = await getWorkspaceBasePathV1('workspace', workspaceId);
|
const basePath = await getWorkspaceBasePathV1('workspace', workspaceId);
|
||||||
await fs.rmdir(basePath, { recursive: true });
|
await fs.remove(basePath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('deleteWorkspaceV1', error);
|
logger.error('deleteWorkspaceV1', error);
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ export async function deleteWorkspace(universalId: string) {
|
|||||||
const dbPath = await getSpaceDBPath(peer, type, id);
|
const dbPath = await getSpaceDBPath(peer, type, id);
|
||||||
try {
|
try {
|
||||||
await getDocStoragePool().disconnect(universalId);
|
await getDocStoragePool().disconnect(universalId);
|
||||||
await fs.rmdir(path.dirname(dbPath), { recursive: true });
|
await fs.remove(path.dirname(dbPath));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('deleteWorkspace', e);
|
logger.error('deleteWorkspace', e);
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ export async function trashWorkspace(universalId: string) {
|
|||||||
await fs.copy(path.dirname(dbPath), movedPath, {
|
await fs.copy(path.dirname(dbPath), movedPath, {
|
||||||
overwrite: true,
|
overwrite: true,
|
||||||
});
|
});
|
||||||
await fs.rmdir(path.dirname(dbPath), { recursive: true });
|
await fs.remove(path.dirname(dbPath));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('trashWorkspace', error);
|
logger.error('trashWorkspace', error);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ async function importWorkspaceDb(originalPath: string) {
|
|||||||
export async function deleteBackupWorkspace(id: string) {
|
export async function deleteBackupWorkspace(id: string) {
|
||||||
const basePath = await getDeletedWorkspacesBasePath();
|
const basePath = await getDeletedWorkspacesBasePath();
|
||||||
const workspacePath = path.join(basePath, normalizeWorkspaceIdForPath(id));
|
const workspacePath = path.join(basePath, normalizeWorkspaceIdForPath(id));
|
||||||
await fs.rmdir(workspacePath, { recursive: true });
|
await fs.remove(workspacePath);
|
||||||
logger.info(
|
logger.info(
|
||||||
'deleteBackupWorkspace',
|
'deleteBackupWorkspace',
|
||||||
`Deleted backup workspace: ${workspacePath}`
|
`Deleted backup workspace: ${workspacePath}`
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
const rootDir = fileURLToPath(new URL('../../../..', import.meta.url));
|
const rootDir = fileURLToPath(new URL('../../../..', import.meta.url));
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
// prevent tests using two different sources of yjs
|
// prevent tests using two different sources of yjs
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"unplugin-swc": "^1.5.9",
|
"unplugin-swc": "^1.5.9",
|
||||||
"vite": "^7.2.7",
|
"vite": "^7.2.7",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"version": "0.26.3"
|
"version": "0.26.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,6 @@
|
|||||||
"@vanilla-extract/css": "^1.17.0",
|
"@vanilla-extract/css": "^1.17.0",
|
||||||
"fake-indexeddb": "^6.0.0",
|
"fake-indexeddb": "^6.0.0",
|
||||||
"happy-dom": "^20.3.0",
|
"happy-dom": "^20.3.0",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
"@affine-tools/cli": "workspace:*",
|
"@affine-tools/cli": "workspace:*",
|
||||||
"@affine-tools/utils": "workspace:*",
|
"@affine-tools/utils": "workspace:*",
|
||||||
"glob": "^11.0.0",
|
"glob": "^11.0.0",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,18 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.26.3",
|
"version": "0.26.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:web": "vite",
|
"dev:web": "affine bundle --dev",
|
||||||
|
"build:web": "affine bundle",
|
||||||
"dev:server": "node --env-file-if-exists=.env --watch server/main.ts"
|
"dev:server": "node --env-file-if-exists=.env --watch server/main.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/native": "workspace:*",
|
"@affine/native": "workspace:*",
|
||||||
"@google/generative-ai": "^0.24.0",
|
"@google/generative-ai": "^0.24.0",
|
||||||
"@tailwindcss/vite": "^4.0.6",
|
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/multer": "^2.0.0",
|
"@types/multer": "^2.0.0",
|
||||||
"@types/react": "^19.0.8",
|
"@types/react": "^19.0.8",
|
||||||
"@types/react-dom": "^19.0.3",
|
"@types/react-dom": "^19.0.3",
|
||||||
"@vitejs/plugin-react": "^5.2.0",
|
|
||||||
"chokidar": "^4.0.3",
|
"chokidar": "^4.0.3",
|
||||||
"express": "^5.0.0",
|
"express": "^5.0.0",
|
||||||
"express-rate-limit": "^7.1.5",
|
"express-rate-limit": "^7.1.5",
|
||||||
@@ -29,8 +28,7 @@
|
|||||||
"socket.io": "^4.7.4",
|
"socket.io": "^4.7.4",
|
||||||
"socket.io-client": "^4.8.3",
|
"socket.io-client": "^4.8.3",
|
||||||
"swr": "^2.3.7",
|
"swr": "^2.3.7",
|
||||||
"tailwindcss": "^4.1.17",
|
"tailwindcss": "^4.1.17"
|
||||||
"vite": "^7.3.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^11",
|
"@types/fs-extra": "^11",
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import tailwindcss from '@tailwindcss/vite';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
|
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [react(), tailwindcss()],
|
|
||||||
root: './web',
|
|
||||||
server: {
|
|
||||||
proxy: {
|
|
||||||
'/api': {
|
|
||||||
target: 'http://localhost:6544',
|
|
||||||
changeOrigin: true,
|
|
||||||
rewrite: path => path.replace(/^\/api/, ''),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -2,12 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Media Capture Playground</title>
|
<title>Media Capture Playground</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/main.tsx"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"@affine-tools/cli": "workspace:*",
|
"@affine-tools/cli": "workspace:*",
|
||||||
"@affine-tools/utils": "workspace:*",
|
"@affine-tools/utils": "workspace:*",
|
||||||
"path-to-regexp": "^8.4.2",
|
"path-to-regexp": "^8.4.2",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^19.2.1",
|
"react": "^19.2.1",
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^19.0.1",
|
"@types/react": "^19.0.1",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"@rspack/dev-server": "^2.0.1",
|
"@rspack/dev-server": "^2.0.1",
|
||||||
"@sentry/webpack-plugin": "^5.3.0",
|
"@sentry/webpack-plugin": "^5.3.0",
|
||||||
"@swc/core": "^1.10.1",
|
"@swc/core": "^1.10.1",
|
||||||
"@tailwindcss/postcss": "^4.0.0",
|
"@tailwindcss/postcss": "^4.3.0",
|
||||||
"@vanilla-extract/webpack-plugin": "^2.3.15",
|
"@vanilla-extract/webpack-plugin": "^2.3.15",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"clipanion": "^3.2.1",
|
"clipanion": "^3.2.1",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export const RSPACK_SUPPORTED_PACKAGES = [
|
|||||||
'@affine/electron-renderer',
|
'@affine/electron-renderer',
|
||||||
'@affine/server',
|
'@affine/server',
|
||||||
'@affine/reader',
|
'@affine/reader',
|
||||||
|
'@affine/media-capture-playground',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
const rspackSupportedPackageSet = new Set<string>(RSPACK_SUPPORTED_PACKAGES);
|
const rspackSupportedPackageSet = new Set<string>(RSPACK_SUPPORTED_PACKAGES);
|
||||||
|
|||||||
+37
-5
@@ -194,11 +194,41 @@ function getRspackBundleConfigs(pkg: Package): MultiRspackOptions {
|
|||||||
}),
|
}),
|
||||||
] as MultiRspackOptions;
|
] as MultiRspackOptions;
|
||||||
}
|
}
|
||||||
|
case '@affine/media-capture-playground': {
|
||||||
|
return [
|
||||||
|
createRspackHTMLTargetConfig(pkg, pkg.join('web/main.tsx').value, {
|
||||||
|
template: pkg.join('web/index.html').value,
|
||||||
|
additionalEntryForSelfhost: false,
|
||||||
|
copySharedPublicAssets: false,
|
||||||
|
injectGlobalErrorHandler: false,
|
||||||
|
emitAssetsManifest: false,
|
||||||
|
}),
|
||||||
|
] as MultiRspackOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Unsupported package: ${pkg.name}`);
|
throw new Error(`Unsupported package: ${pkg.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRspackDevServerConfig(
|
||||||
|
pkg: Package
|
||||||
|
): RspackDevServerConfiguration | undefined {
|
||||||
|
if (pkg.name !== '@affine/media-capture-playground') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
proxy: [
|
||||||
|
{
|
||||||
|
context: '/api',
|
||||||
|
target: 'http://localhost:6544',
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^/api': '' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export class BundleCommand extends PackageCommand {
|
export class BundleCommand extends PackageCommand {
|
||||||
static override paths = [['bundle'], ['pack'], ['bun']];
|
static override paths = [['bundle'], ['pack'], ['bun']];
|
||||||
|
|
||||||
@@ -214,7 +244,7 @@ export class BundleCommand extends PackageCommand {
|
|||||||
const pkg = this.workspace.getPackage(this.package);
|
const pkg = this.workspace.getPackage(this.package);
|
||||||
|
|
||||||
if (this.dev) {
|
if (this.dev) {
|
||||||
await BundleCommand.dev(pkg);
|
await BundleCommand.dev(pkg, getRspackDevServerConfig(pkg));
|
||||||
} else {
|
} else {
|
||||||
await BundleCommand.build(pkg);
|
await BundleCommand.build(pkg);
|
||||||
}
|
}
|
||||||
@@ -294,10 +324,12 @@ export class BundleCommand extends PackageCommand {
|
|||||||
throw new Error('Failed to create rspack compiler');
|
throw new Error('Failed to create rspack compiler');
|
||||||
}
|
}
|
||||||
|
|
||||||
const devServer = new RspackDevServer(
|
const serverConfig = merge({}, DEFAULT_DEV_SERVER_CONFIG, devServerConfig);
|
||||||
merge({}, DEFAULT_DEV_SERVER_CONFIG, devServerConfig),
|
if (devServerConfig?.proxy) {
|
||||||
compiler
|
serverConfig.proxy = devServerConfig.proxy;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const devServer = new RspackDevServer(serverConfig, compiler);
|
||||||
|
|
||||||
await devServer.start();
|
await devServer.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ const currentDir = Path.dir(import.meta.url);
|
|||||||
|
|
||||||
export interface CreateHTMLPluginConfig {
|
export interface CreateHTMLPluginConfig {
|
||||||
filename?: string;
|
filename?: string;
|
||||||
|
template?: string;
|
||||||
|
copySharedPublicAssets?: boolean;
|
||||||
additionalEntryForSelfhost?: boolean;
|
additionalEntryForSelfhost?: boolean;
|
||||||
selfhostPublicPath?: string;
|
selfhostPublicPath?: string;
|
||||||
injectGlobalErrorHandler?: boolean;
|
injectGlobalErrorHandler?: boolean;
|
||||||
@@ -209,7 +211,10 @@ export function createHTMLPlugins(
|
|||||||
config: CreateHTMLPluginConfig
|
config: CreateHTMLPluginConfig
|
||||||
): (HtmlRspackPluginInstance | PluginLike)[] {
|
): (HtmlRspackPluginInstance | PluginLike)[] {
|
||||||
const publicPath = getPublicPath(BUILD_CONFIG);
|
const publicPath = getPublicPath(BUILD_CONFIG);
|
||||||
const htmlPluginOptions = getHTMLPluginOptions(BUILD_CONFIG);
|
const htmlPluginOptions = {
|
||||||
|
...getHTMLPluginOptions(BUILD_CONFIG),
|
||||||
|
...(config.template ? { template: config.template } : {}),
|
||||||
|
};
|
||||||
const selfhostPublicPath = config.selfhostPublicPath ?? '/';
|
const selfhostPublicPath = config.selfhostPublicPath ?? '/';
|
||||||
|
|
||||||
const plugins: (HtmlRspackPluginInstance | PluginLike)[] = [];
|
const plugins: (HtmlRspackPluginInstance | PluginLike)[] = [];
|
||||||
|
|||||||
@@ -77,12 +77,20 @@ export function createHTMLTargetConfig(
|
|||||||
deps?: string[]
|
deps?: string[]
|
||||||
): RspackConfiguration {
|
): RspackConfiguration {
|
||||||
entry = typeof entry === 'string' ? { index: entry } : entry;
|
entry = typeof entry === 'string' ? { index: entry } : entry;
|
||||||
|
const tailwindConfigPath = pkg.join('tailwind.config.js');
|
||||||
|
const hasTailwind =
|
||||||
|
tailwindConfigPath.exists() ||
|
||||||
|
pkg.name === '@affine/media-capture-playground';
|
||||||
|
const tailwindPlugin = tailwindConfigPath.exists()
|
||||||
|
? ['@tailwindcss/postcss', require(tailwindConfigPath.value)]
|
||||||
|
: ['@tailwindcss/postcss'];
|
||||||
|
|
||||||
htmlConfig = merge(
|
htmlConfig = merge(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
additionalEntryForSelfhost: true,
|
additionalEntryForSelfhost: true,
|
||||||
|
copySharedPublicAssets: true,
|
||||||
injectGlobalErrorHandler: true,
|
injectGlobalErrorHandler: true,
|
||||||
emitAssetsManifest: true,
|
emitAssetsManifest: true,
|
||||||
},
|
},
|
||||||
@@ -268,12 +276,9 @@ export function createHTMLTargetConfig(
|
|||||||
loader: 'postcss-loader',
|
loader: 'postcss-loader',
|
||||||
options: {
|
options: {
|
||||||
postcssOptions: {
|
postcssOptions: {
|
||||||
plugins: pkg.join('tailwind.config.js').exists()
|
plugins: hasTailwind
|
||||||
? [
|
? [
|
||||||
[
|
tailwindPlugin,
|
||||||
'@tailwindcss/postcss',
|
|
||||||
require(pkg.join('tailwind.config.js').value),
|
|
||||||
],
|
|
||||||
['autoprefixer'],
|
['autoprefixer'],
|
||||||
...(buildConfig.isAdmin
|
...(buildConfig.isAdmin
|
||||||
? [queuedashScopePostcssPlugin()]
|
? [queuedashScopePostcssPlugin()]
|
||||||
@@ -318,6 +323,7 @@ export function createHTMLTargetConfig(
|
|||||||
}),
|
}),
|
||||||
new VanillaExtractPlugin(),
|
new VanillaExtractPlugin(),
|
||||||
!buildConfig.isAdmin &&
|
!buildConfig.isAdmin &&
|
||||||
|
htmlConfig.copySharedPublicAssets &&
|
||||||
new rspack.CopyRspackPlugin({
|
new rspack.CopyRspackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
"infra",
|
"infra",
|
||||||
"editor",
|
"editor",
|
||||||
"tools",
|
"tools",
|
||||||
"y-octo"
|
"y-octo",
|
||||||
|
"client"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export const PackageToDistribution = new Map<
|
|||||||
>([
|
>([
|
||||||
['@affine/admin', 'admin'],
|
['@affine/admin', 'admin'],
|
||||||
['@affine/web', 'web'],
|
['@affine/web', 'web'],
|
||||||
|
['@affine/media-capture-playground', 'web'],
|
||||||
['@affine/electron-renderer', 'desktop'],
|
['@affine/electron-renderer', 'desktop'],
|
||||||
['@affine/electron', 'desktop'],
|
['@affine/electron', 'desktop'],
|
||||||
['@affine/mobile', 'mobile'],
|
['@affine/mobile', 'mobile'],
|
||||||
|
|||||||
Reference in New Issue
Block a user