@hamak/smart-data-dico 1.0.3 → 1.1.0

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 (52) hide show
  1. package/backend/dist/server.mjs +82212 -0
  2. package/bin/cli.js +28 -17
  3. package/frontend/dist/assets/index-1b53cffe.js +431 -0
  4. package/frontend/dist/assets/index-fa72a51a.css +1 -0
  5. package/frontend/dist/index.html +15 -0
  6. package/package.json +28 -27
  7. package/backend/package.json +0 -51
  8. package/backend/src/__tests__/integration/api.test.ts +0 -149
  9. package/backend/src/__tests__/setup.ts +0 -24
  10. package/backend/src/__tests__/utils/testUtils.ts +0 -76
  11. package/backend/src/adapters/EntityFileAdapter.ts +0 -154
  12. package/backend/src/adapters/YamlFileInfoEnricher.ts +0 -52
  13. package/backend/src/controllers/authController.ts +0 -131
  14. package/backend/src/controllers/diagramController.ts +0 -143
  15. package/backend/src/controllers/dictionaryController.ts +0 -306
  16. package/backend/src/controllers/importExportController.ts +0 -64
  17. package/backend/src/controllers/perspectiveController.ts +0 -90
  18. package/backend/src/controllers/serviceController.ts +0 -418
  19. package/backend/src/controllers/stereotypeController.ts +0 -59
  20. package/backend/src/controllers/versionController.ts +0 -226
  21. package/backend/src/kernel/config.ts +0 -43
  22. package/backend/src/middleware/auth.ts +0 -128
  23. package/backend/src/middleware/jwtAuth.ts +0 -100
  24. package/backend/src/models/Dictionary.ts +0 -38
  25. package/backend/src/models/EntitySchema.ts +0 -393
  26. package/backend/src/models/__tests__/Dictionary.test.ts +0 -92
  27. package/backend/src/models/__tests__/EntitySchema.test.ts +0 -119
  28. package/backend/src/routes/index.ts +0 -120
  29. package/backend/src/scripts/migrate-to-uuid.ts +0 -24
  30. package/backend/src/server.ts +0 -158
  31. package/backend/src/services/__mocks__/entityService.ts +0 -38
  32. package/backend/src/services/__mocks__/serviceService.ts +0 -88
  33. package/backend/src/services/__mocks__/versionService.ts +0 -38
  34. package/backend/src/services/__tests__/dictionaryService.test.ts +0 -74
  35. package/backend/src/services/diagramService.ts +0 -165
  36. package/backend/src/services/dictionaryService.ts +0 -582
  37. package/backend/src/services/entityService.ts +0 -102
  38. package/backend/src/services/exportService.ts +0 -172
  39. package/backend/src/services/importService.ts +0 -208
  40. package/backend/src/services/perspectiveService.ts +0 -276
  41. package/backend/src/services/qualityService.ts +0 -121
  42. package/backend/src/services/serviceService.ts +0 -763
  43. package/backend/src/services/stereotypeService.ts +0 -98
  44. package/backend/src/services/versionService.ts +0 -135
  45. package/backend/src/setupTests.ts +0 -12
  46. package/backend/src/utils/__mocks__/fileOperations.ts +0 -116
  47. package/backend/src/utils/fileOperations.ts +0 -602
  48. package/backend/src/utils/logger.ts +0 -38
  49. package/backend/src/utils/migration.ts +0 -254
  50. package/backend/src/utils/swagger.ts +0 -358
  51. package/backend/src/utils/uuid.ts +0 -41
  52. package/backend/tsconfig.json +0 -20
package/bin/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { fileURLToPath } from 'url';
4
- import { dirname, join, resolve } from 'path';
4
+ import { dirname, join, resolve } from 'node:path';
5
5
  import { existsSync, mkdirSync, cpSync } from 'fs';
6
6
  import { spawn } from 'child_process';
7
7
 
@@ -25,7 +25,7 @@ if (flags.help) {
25
25
 
26
26
  Usage:
27
27
  smart-data-dico [options]
28
- npx smart-data-dico [options]
28
+ npx @hamak/smart-data-dico [options]
29
29
 
30
30
  Options:
31
31
  --port <number> Server port (default: 3001)
@@ -59,14 +59,33 @@ if (!existsSync(dataDir)) {
59
59
  mkdirSync(join(dataDir, 'perspectives'), { recursive: true });
60
60
  }
61
61
 
62
- const serverTs = join(PKG_ROOT, 'backend', 'src', 'server.ts');
63
- const frontendDist = join(PKG_ROOT, 'frontend', 'dist');
64
-
65
- if (!existsSync(serverTs)) {
66
- console.error('Error: Backend source not found.');
62
+ // Determine how to run the server:
63
+ // 1. Bundled (production/npm): single .mjs file, run with node — no deps needed
64
+ // 2. Source (dev): TypeScript source, run with tsx
65
+ const bundledServer = join(PKG_ROOT, 'backend', 'dist', 'server.mjs');
66
+ const sourceServer = join(PKG_ROOT, 'backend', 'src', 'server.ts');
67
+
68
+ let bin, binArgs;
69
+
70
+ if (existsSync(bundledServer)) {
71
+ // Production: bundled server — all deps inlined, just node
72
+ bin = process.execPath; // 'node'
73
+ binArgs = [bundledServer];
74
+ } else if (existsSync(sourceServer)) {
75
+ // Development: run TypeScript source via tsx
76
+ const tsxPaths = [
77
+ join(PKG_ROOT, 'node_modules', '.bin', 'tsx'),
78
+ join(PKG_ROOT, 'backend', 'node_modules', '.bin', 'tsx'),
79
+ ];
80
+ bin = tsxPaths.find(p => existsSync(p)) || 'npx';
81
+ binArgs = bin.endsWith('npx') ? ['tsx', sourceServer] : [sourceServer];
82
+ } else {
83
+ console.error('Error: No server found (neither bundled nor source).');
67
84
  process.exit(1);
68
85
  }
69
86
 
87
+ const frontendDist = join(PKG_ROOT, 'frontend', 'dist');
88
+
70
89
  console.log(`
71
90
  Smart Data Dictionary
72
91
 
@@ -76,16 +95,8 @@ console.log(`
76
95
  Frontend: ${existsSync(frontendDist) ? 'bundled' : 'dev (use frontend dev server on :3000)'}
77
96
  `);
78
97
 
79
- // Find tsx binary — check local node_modules first, then global
80
- const tsxPaths = [
81
- join(PKG_ROOT, 'node_modules', '.bin', 'tsx'),
82
- join(PKG_ROOT, 'backend', 'node_modules', '.bin', 'tsx'),
83
- ];
84
- let tsxBin = tsxPaths.find(p => existsSync(p)) || 'npx';
85
- const tsxArgs = tsxBin === 'npx' ? ['tsx', serverTs] : [serverTs];
86
-
87
- const child = spawn(tsxBin, tsxArgs, {
88
- cwd: join(PKG_ROOT, 'backend'),
98
+ const child = spawn(bin, binArgs, {
99
+ cwd: PKG_ROOT,
89
100
  env: {
90
101
  ...process.env,
91
102
  PORT: port,