create-pardx-scaffold 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.cursor/worktrees.json +37 -0
- package/template/.dockerignore +49 -0
- package/template/.mcp.json +26 -0
- package/template/.nvmrc +1 -0
- package/template/CLAUDE.md +85 -0
- package/template/apps/api/libs/domain/services/index.ts +7 -0
- package/template/apps/api/libs/{infra/shared-services → domain/services}/ip-info/ip-info.module.ts +2 -0
- package/template/apps/api/libs/{infra/shared-services → domain/services}/ip-info/ip-info.service.ts +2 -0
- package/template/apps/api/libs/infra/clients/internal/file-storage/dto/file.dto.ts +1 -1
- package/template/apps/api/libs/infra/common/ts-rest/response.helper.ts +9 -1
- package/template/apps/api/libs/infra/shared-services/email/email.module.ts +0 -2
- package/template/apps/api/libs/infra/shared-services/file-storage/bucket-resolver.ts +1 -1
- package/template/apps/api/libs/infra/shared-services/file-storage/file-storage.module.ts +1 -1
- package/template/apps/api/libs/infra/shared-services/sms/sms.module.ts +0 -2
- package/template/apps/api/libs/infra/shared-services/uploader/uploader.service.ts +4 -4
- package/template/apps/api/package.json +15 -15
- package/template/apps/api/prisma/migrations/migration_lock.toml +3 -0
- package/template/apps/api/src/app.module.ts +5 -1
- package/template/apps/api/src/modules/uploader/uploader.controller.ts +305 -0
- package/template/apps/api/src/modules/uploader/uploader.module.ts +17 -0
- package/template/apps/web/.env.example +6 -4
- package/template/apps/web/components/error-boundary.tsx +166 -0
- package/template/apps/web/components/index.ts +10 -0
- package/template/apps/web/components.json +20 -0
- package/template/apps/web/config.ts +115 -0
- package/template/apps/web/eslint.config.mjs +4 -0
- package/template/apps/web/lib/api/avatar-upload.ts +1 -0
- package/template/apps/web/lib/api/contracts/client.ts +51 -30
- package/template/apps/web/lib/api/contracts/hooks/index.ts +0 -3
- package/template/apps/web/lib/api/contracts/hooks/notification.ts +42 -124
- package/template/apps/web/lib/api.ts +24 -1
- package/template/apps/web/lib/dynamic-import.tsx +121 -0
- package/template/apps/web/lib/logger.ts +113 -0
- package/template/apps/web/lib/upload/api.ts +37 -105
- package/template/apps/web/lib/upload/batch-uploader.ts +7 -74
- package/template/apps/web/lib/upload/uploader.ts +10 -74
- package/template/apps/web/locales/zh-CN/assessment.json +5 -0
- package/template/apps/web/locales/zh-CN/chat.json +6 -0
- package/template/apps/web/locales/zh-CN/common.json +38 -0
- package/template/apps/web/locales/zh-CN/creative.json +5 -0
- package/template/apps/web/locales/zh-CN/daily-challenge.json +6 -0
- package/template/apps/web/locales/zh-CN/errors.json +16 -0
- package/template/apps/web/locales/zh-CN/forms.json +18 -0
- package/template/apps/web/locales/zh-CN/memory.json +5 -0
- package/template/apps/web/locales/zh-CN/navigation.json +12 -0
- package/template/apps/web/locales/zh-CN/recommendation.json +5 -0
- package/template/apps/web/locales/zh-CN/recruitment.json +5 -0
- package/template/apps/web/locales/zh-CN/settings.json +7 -0
- package/template/apps/web/locales/zh-CN/subscription.json +6 -0
- package/template/apps/web/locales/zh-CN/validation.json +8 -0
- package/template/apps/web/package.json +14 -15
- package/template/apps/web/postcss.config.mjs +1 -0
- package/template/apps/web/proxy.ts +102 -0
- package/template/apps/web/public/logo.svg +21 -0
- package/template/apps/web/vitest.config.ts +69 -0
- package/template/apps/web/vitest.setup.ts +80 -0
- package/template/package.json +7 -7
- package/template/packages/constants/package.json +3 -1
- package/template/packages/constants/tsconfig.build.esm.json +8 -0
- package/template/packages/contracts/package.json +2 -2
- package/template/packages/contracts/src/schemas/uploader.schema.ts +33 -10
- package/template/packages/ui/.storybook/main.ts +28 -0
- package/template/packages/ui/.storybook/preview.ts +40 -0
- package/template/packages/ui/eslint.config.js +3 -0
- package/template/packages/ui/package.json +15 -2
- package/template/packages/ui/src/components/button.stories.tsx +171 -0
- package/template/packages/ui/src/styles/globals.css +1 -1
- package/template/packages/ui/tsconfig.json +1 -1
- package/template/packages/utils/package.json +2 -2
- package/template/packages/utils/tsconfig.build.esm.json +8 -0
- package/template/packages/validators/package.json +1 -1
- package/template/pnpm-lock.yaml +2263 -999
- package/template/scripts/export-scaffold-for-create.js +65 -0
- package/template/apps/api/libs/infra/utils/download.ts +0 -21
- package/template/apps/web/lib/api/client.ts +0 -649
- package/template/apps/web/lib/audio-buffer-queue.ts +0 -273
- package/template/apps/web/lib/upload/folder-utils.ts +0 -295
- /package/template/apps/api/libs/{infra/shared-services → domain/services}/ip-info/index.ts +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 将当前仓库中 git 跟踪的文件导出到 packages/create-pardx-scaffold/template/
|
|
4
|
+
* 供 create-pardx-scaffold 在 npx create-pardx-scaffold xxx 时复制到目标目录。
|
|
5
|
+
*
|
|
6
|
+
* 排除:packages/create-pardx-scaffold/*(避免把脚手架生成器自身打进模板)
|
|
7
|
+
*
|
|
8
|
+
* 使用:在仓库根目录执行
|
|
9
|
+
* node scripts/export-scaffold-for-create.js
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execSync } = require('child_process');
|
|
15
|
+
|
|
16
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
17
|
+
const TEMPLATE_ROOT = path.join(REPO_ROOT, 'packages', 'create-pardx-scaffold', 'template');
|
|
18
|
+
const EXCLUDE_PREFIX = 'packages/create-pardx-scaffold/';
|
|
19
|
+
|
|
20
|
+
function main() {
|
|
21
|
+
process.chdir(REPO_ROOT);
|
|
22
|
+
|
|
23
|
+
let list;
|
|
24
|
+
try {
|
|
25
|
+
list = execSync('git ls-files', { encoding: 'utf8' });
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error('export-scaffold: git ls-files failed. Run from repository root.');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const files = list
|
|
32
|
+
.trim()
|
|
33
|
+
.split(/\n/)
|
|
34
|
+
.filter((p) => p && !p.startsWith(EXCLUDE_PREFIX));
|
|
35
|
+
|
|
36
|
+
if (files.length === 0) {
|
|
37
|
+
console.warn('export-scaffold: no files to export (or all excluded).');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (fs.existsSync(TEMPLATE_ROOT)) {
|
|
42
|
+
fs.rmSync(TEMPLATE_ROOT, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
fs.mkdirSync(TEMPLATE_ROOT, { recursive: true });
|
|
45
|
+
|
|
46
|
+
let copied = 0;
|
|
47
|
+
for (const rel of files) {
|
|
48
|
+
const src = path.join(REPO_ROOT, rel);
|
|
49
|
+
const dest = path.join(TEMPLATE_ROOT, rel);
|
|
50
|
+
if (!fs.existsSync(src)) {
|
|
51
|
+
console.warn('export-scaffold: skip (missing):', rel);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const dir = path.dirname(dest);
|
|
55
|
+
if (!fs.existsSync(dir)) {
|
|
56
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
57
|
+
}
|
|
58
|
+
fs.copyFileSync(src, dest);
|
|
59
|
+
copied++;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('export-scaffold: copied', copied, 'files to packages/create-pardx-scaffold/template/');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as stream from 'stream';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import * as fs from 'node:fs';
|
|
5
|
-
|
|
6
|
-
const finished = promisify(stream.finished);
|
|
7
|
-
|
|
8
|
-
export async function downloadFile(
|
|
9
|
-
fileUrl: string,
|
|
10
|
-
outputLocationPath: string,
|
|
11
|
-
): Promise<any> {
|
|
12
|
-
const writer = fs.createWriteStream(outputLocationPath);
|
|
13
|
-
return axios({
|
|
14
|
-
method: 'GET',
|
|
15
|
-
url: fileUrl,
|
|
16
|
-
responseType: 'stream',
|
|
17
|
-
}).then((response) => {
|
|
18
|
-
response.data.pipe(writer);
|
|
19
|
-
return finished(writer); //this is a Promise
|
|
20
|
-
});
|
|
21
|
-
}
|