feat(courseware,docs): 完善课件传输与岛编辑并统一全仓文档
- 增加课件上传、班级可见范围、设备补收与传输进度 - 整合自定义灵动岛编辑器和相关客户端交互 - 同步三端契约、数据库迁移、部署配置与隔离回归 - 按源码统一文档与官网说明,移除过时任务书和审查记录 - 保持产品版本为 1.4.0
This commit is contained in:
1 parent
536379036a
commit
c7f215a09c
127 files changed
+4334
-8482
No files matched your search
@@ -0,0 +1,43 @@
|
||||
/** 课件验收始终使用临时库和临时文件目录,不访问正在使用的班级。 */
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { createRequire } from 'node:module';
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const dir = path.join(root, '.cache', 'v14-verification', `courseware-${process.pid}-${Date.now()}`);
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
const env = {
|
||||
...process.env,
|
||||
DATABASE_PROVIDER: 'sqlite',
|
||||
DATABASE_URL: `file:${path.join(dir, 'test.db').replaceAll('\\', '/')}`,
|
||||
COURSEWARE_DIR: path.join(dir, 'files'),
|
||||
TZ: 'Asia/Shanghai',
|
||||
RATE_LIMIT_ENABLED: 'false',
|
||||
LOG_LEVEL: 'warn',
|
||||
};
|
||||
const require = createRequire(path.join(root, 'packages/server/package.json'));
|
||||
const { createClient } = require('@libsql/client');
|
||||
const db = createClient({ url: env.DATABASE_URL });
|
||||
await db.execute('PRAGMA user_version=0');
|
||||
db.close();
|
||||
async function run(args) {
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn(process.execPath, args, { cwd: root, env, stdio: 'inherit', windowsHide: true });
|
||||
child.once('error', reject);
|
||||
child.once('exit', (code) => (code === 0 ? resolve() : reject(new Error(`课件验收失败:${code}`))));
|
||||
});
|
||||
}
|
||||
await run([
|
||||
'packages/server/node_modules/prisma/build/index.js',
|
||||
'migrate',
|
||||
'deploy',
|
||||
'--config',
|
||||
'packages/server/prisma.config.ts',
|
||||
]);
|
||||
await run([
|
||||
'--import',
|
||||
'./packages/server/node_modules/tsx/dist/loader.mjs',
|
||||
'packages/server/scripts/verify-courseware.ts',
|
||||
]);
|
||||
console.log(`隔离验收留档:${dir}`);
|
||||
Reference in new issue
Block a user