create-pardx-scaffold 0.1.0 → 0.1.2

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.
Files changed (75) hide show
  1. package/package.json +1 -1
  2. package/template/.cursor/worktrees.json +37 -0
  3. package/template/.dockerignore +49 -0
  4. package/template/.mcp.json +26 -0
  5. package/template/.nvmrc +1 -0
  6. package/template/CLAUDE.md +85 -0
  7. package/template/apps/api/libs/domain/services/index.ts +7 -0
  8. package/template/apps/api/libs/{infra/shared-services → domain/services}/ip-info/ip-info.module.ts +2 -0
  9. package/template/apps/api/libs/{infra/shared-services → domain/services}/ip-info/ip-info.service.ts +2 -0
  10. package/template/apps/api/libs/infra/clients/internal/file-storage/dto/file.dto.ts +1 -1
  11. package/template/apps/api/libs/infra/shared-services/email/email.module.ts +0 -2
  12. package/template/apps/api/libs/infra/shared-services/file-storage/bucket-resolver.ts +1 -1
  13. package/template/apps/api/libs/infra/shared-services/file-storage/file-storage.module.ts +1 -1
  14. package/template/apps/api/libs/infra/shared-services/sms/sms.module.ts +0 -2
  15. package/template/apps/api/package.json +15 -15
  16. package/template/apps/api/prisma/migrations/migration_lock.toml +3 -0
  17. package/template/apps/api/src/app.module.ts +1 -1
  18. package/template/apps/web/.env.example +6 -4
  19. package/template/apps/web/components/error-boundary.tsx +166 -0
  20. package/template/apps/web/components/index.ts +10 -0
  21. package/template/apps/web/components.json +20 -0
  22. package/template/apps/web/config.ts +115 -0
  23. package/template/apps/web/eslint.config.mjs +4 -0
  24. package/template/apps/web/lib/api/avatar-upload.ts +1 -0
  25. package/template/apps/web/lib/api/contracts/client.ts +51 -30
  26. package/template/apps/web/lib/api/contracts/hooks/index.ts +0 -3
  27. package/template/apps/web/lib/api/contracts/hooks/notification.ts +42 -124
  28. package/template/apps/web/lib/api.ts +24 -1
  29. package/template/apps/web/lib/dynamic-import.tsx +121 -0
  30. package/template/apps/web/lib/logger.ts +113 -0
  31. package/template/apps/web/lib/upload/api.ts +37 -105
  32. package/template/apps/web/lib/upload/batch-uploader.ts +7 -74
  33. package/template/apps/web/lib/upload/uploader.ts +10 -74
  34. package/template/apps/web/locales/zh-CN/assessment.json +5 -0
  35. package/template/apps/web/locales/zh-CN/chat.json +6 -0
  36. package/template/apps/web/locales/zh-CN/common.json +38 -0
  37. package/template/apps/web/locales/zh-CN/creative.json +5 -0
  38. package/template/apps/web/locales/zh-CN/daily-challenge.json +6 -0
  39. package/template/apps/web/locales/zh-CN/errors.json +16 -0
  40. package/template/apps/web/locales/zh-CN/forms.json +18 -0
  41. package/template/apps/web/locales/zh-CN/memory.json +5 -0
  42. package/template/apps/web/locales/zh-CN/navigation.json +12 -0
  43. package/template/apps/web/locales/zh-CN/recommendation.json +5 -0
  44. package/template/apps/web/locales/zh-CN/recruitment.json +5 -0
  45. package/template/apps/web/locales/zh-CN/settings.json +7 -0
  46. package/template/apps/web/locales/zh-CN/subscription.json +6 -0
  47. package/template/apps/web/locales/zh-CN/validation.json +8 -0
  48. package/template/apps/web/package.json +14 -15
  49. package/template/apps/web/postcss.config.mjs +1 -0
  50. package/template/apps/web/proxy.ts +102 -0
  51. package/template/apps/web/public/logo.svg +21 -0
  52. package/template/apps/web/vitest.config.ts +69 -0
  53. package/template/apps/web/vitest.setup.ts +80 -0
  54. package/template/package.json +7 -7
  55. package/template/packages/constants/package.json +3 -1
  56. package/template/packages/constants/tsconfig.build.esm.json +8 -0
  57. package/template/packages/contracts/package.json +2 -2
  58. package/template/packages/contracts/src/schemas/uploader.schema.ts +33 -10
  59. package/template/packages/ui/.storybook/main.ts +28 -0
  60. package/template/packages/ui/.storybook/preview.ts +40 -0
  61. package/template/packages/ui/eslint.config.js +3 -0
  62. package/template/packages/ui/package.json +15 -2
  63. package/template/packages/ui/src/components/button.stories.tsx +171 -0
  64. package/template/packages/ui/src/styles/globals.css +1 -1
  65. package/template/packages/ui/tsconfig.json +1 -1
  66. package/template/packages/utils/package.json +2 -2
  67. package/template/packages/utils/tsconfig.build.esm.json +8 -0
  68. package/template/packages/validators/package.json +1 -1
  69. package/template/pnpm-lock.yaml +2263 -999
  70. package/template/scripts/export-scaffold-for-create.js +65 -0
  71. package/template/apps/api/libs/infra/utils/download.ts +0 -21
  72. package/template/apps/web/lib/api/client.ts +0 -649
  73. package/template/apps/web/lib/audio-buffer-queue.ts +0 -273
  74. package/template/apps/web/lib/upload/folder-utils.ts +0 -295
  75. /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
- }