@podosoft/podokit 0.13.0 → 0.14.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 (66) hide show
  1. package/dist/add.d.ts +27 -1
  2. package/dist/add.js +3 -1
  3. package/dist/index.js +6 -3
  4. package/dist/lib.d.ts +1 -1
  5. package/dist/lockfile.d.ts +4 -1
  6. package/dist/lockfile.js +4 -3
  7. package/dist/module-migrations.d.ts +25 -0
  8. package/dist/module-migrations.js +233 -0
  9. package/dist/templates/fullstack-nest-svelte/Dockerfile.dev +3 -1
  10. package/dist/templates/fullstack-nest-svelte/apps/api/package.json +1 -1
  11. package/dist/templates/fullstack-nest-svelte/apps/web/Dockerfile +3 -0
  12. package/dist/templates/fullstack-nest-svelte/apps/web/package.json +1 -1
  13. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/components/ui/input/input.svelte +3 -1
  14. package/dist/templates/fullstack-nest-svelte/apps/web/src/routes/+page.svelte +5 -0
  15. package/dist/templates/fullstack-nest-svelte/compose.dev.yaml +6 -0
  16. package/dist/templates/fullstack-nest-svelte/dot-env.example +2 -0
  17. package/dist/templates/fullstack-nest-svelte/infra/k3s/configmap.yaml +1 -0
  18. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image-upload.interceptor.ts +39 -0
  19. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.controller.ts +73 -0
  20. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.module.ts +9 -0
  21. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.service.spec.ts +43 -0
  22. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.service.ts +110 -0
  23. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.validation.spec.ts +79 -0
  24. package/dist/templates/modules/admin-dashboard/files/apps/api/src/profile-image/profile-image.validation.ts +74 -0
  25. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/admin/registry.svelte.ts +1 -1
  26. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/components/account-page.svelte +155 -2
  27. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/components/sidebar-user-menu.svelte +1 -1
  28. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/catalogs/admin-dashboard/en.json +13 -0
  29. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/catalogs/admin-dashboard/ko.json +13 -0
  30. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/server/protected-layout.ts +78 -0
  31. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(admin)/+layout.server.ts +8 -0
  32. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/+layout.svelte +2 -2
  33. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/+layout.server.ts +2 -47
  34. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/+page.svelte +4 -0
  35. package/dist/templates/modules/admin-dashboard/files/tests/api/profile-image.api.spec.ts +96 -0
  36. package/dist/templates/modules/admin-dashboard/files/tests/ui/account.ui.spec.ts +64 -1
  37. package/dist/templates/modules/admin-dashboard/files/tests/ui/dashboard.ui.spec.ts +16 -0
  38. package/dist/templates/modules/admin-dashboard/files/tests/ui/guards.ui.spec.ts +4 -7
  39. package/dist/templates/modules/admin-dashboard/files/tests/ui/settings-dialogs.ui.spec.ts +4 -1
  40. package/dist/templates/modules/admin-dashboard/module.manifest.json +74 -11
  41. package/dist/templates/modules/auth/files/apps/api/src/auth/auth.ts +5 -1
  42. package/dist/templates/modules/auth/files/apps/api/src/auth/user-delete-handlers.spec.ts +42 -0
  43. package/dist/templates/modules/auth/files/apps/api/src/auth/user-delete-handlers.ts +27 -0
  44. package/dist/templates/modules/auth/module.manifest.json +1 -1
  45. package/dist/templates/todo/Dockerfile.dev +3 -1
  46. package/dist/templates/todo/apps/api/package.json +1 -1
  47. package/dist/templates/todo/apps/web/package.json +1 -1
  48. package/dist/templates/todo/compose.dev.yaml +6 -0
  49. package/dist/update.d.ts +8 -1
  50. package/dist/update.js +68 -12
  51. package/package.json +1 -1
  52. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/components/{app-sidebar.svelte → admin-sidebar.svelte} +0 -0
  53. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/+page.svelte +0 -0
  54. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/account/+page.server.ts +0 -0
  55. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/account/+page.svelte +0 -0
  56. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/audit/+page.server.ts +0 -0
  57. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/audit/+page.svelte +0 -0
  58. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/organizations/+page.server.ts +0 -0
  59. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/organizations/+page.svelte +0 -0
  60. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/sessions/+page.server.ts +0 -0
  61. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/sessions/+page.svelte +0 -0
  62. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/settings/+page.server.ts +0 -0
  63. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/settings/+page.svelte +0 -0
  64. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/settings/general-settings.svelte +0 -0
  65. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/users/+page.server.ts +0 -0
  66. /package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/{(app) → (admin)}/admin/users/+page.svelte +0 -0
package/dist/update.js CHANGED
@@ -12,6 +12,7 @@ const assemble_1 = require("./assemble");
12
12
  const lockfile_1 = require("./lockfile");
13
13
  const inspect_1 = require("./inspect");
14
14
  const add_1 = require("./add");
15
+ const module_migrations_1 = require("./module-migrations");
15
16
  function treeText(tree, path) {
16
17
  const file = tree.get(path);
17
18
  if (!file)
@@ -64,9 +65,29 @@ function planUpdate(projectRoot, templatesDir) {
64
65
  });
65
66
  const managedOverrides = targetManagedOverrides(projectRoot, templatesDir, manifest.modules, manifest.managedOverrides);
66
67
  const ownedGlobs = targetOwnedGlobs(projectRoot, templatesDir, manifest.modules, manifest.ownedGlobs);
67
- const changes = [];
68
+ const pendingMigrations = (0, module_migrations_1.collectPendingMigrations)(projectRoot, templatesDir, manifest.modules);
69
+ const migrationPlan = (0, module_migrations_1.planModuleMigrations)(projectRoot, newTree, lock, pendingMigrations);
70
+ const changes = migrationPlan.moves.map((move) => ({
71
+ path: move.to,
72
+ fromPath: move.from,
73
+ tier: move.tier,
74
+ action: "move",
75
+ note: "module path migration",
76
+ }));
77
+ for (const conflict of migrationPlan.conflicts) {
78
+ changes.push({
79
+ path: "module migration",
80
+ tier: "managed",
81
+ action: "conflict",
82
+ note: conflict,
83
+ });
84
+ }
85
+ const movedSources = new Set(migrationPlan.moves.map((move) => move.from));
86
+ const movedTargets = new Set(migrationPlan.moves.map((move) => move.to));
68
87
  const paths = new Set([...newTree.keys(), ...Object.keys(lock.files)]);
69
88
  for (const path of [...paths].sort()) {
89
+ if (movedSources.has(path) || movedTargets.has(path))
90
+ continue;
70
91
  const locked = lock.files[path];
71
92
  const newText = treeText(newTree, path);
72
93
  const disk = diskContent(projectRoot, path);
@@ -232,6 +253,19 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
232
253
  });
233
254
  const managedOverrides = targetManagedOverrides(projectRoot, templatesDir, modules, manifest.managedOverrides);
234
255
  const ownedGlobs = targetOwnedGlobs(projectRoot, templatesDir, modules, manifest.ownedGlobs);
256
+ const pendingMigrations = (0, module_migrations_1.collectPendingMigrations)(projectRoot, templatesDir, modules);
257
+ const migrationPlan = (0, module_migrations_1.planModuleMigrations)(projectRoot, newTree, previousLock, pendingMigrations);
258
+ if (migrationPlan.conflicts.length) {
259
+ throw new Error(`Cannot apply module path migration:\n${migrationPlan.conflicts
260
+ .map((conflict) => ` - ${conflict}`)
261
+ .join("\n")}`);
262
+ }
263
+ const migratedOwnedGlobs = [
264
+ ...new Set(ownedGlobs.map((glob) => (0, module_migrations_1.migrateConfiguredPath)(glob, pendingMigrations))),
265
+ ];
266
+ const migratedManagedOverrides = [
267
+ ...new Set(managedOverrides.map((glob) => (0, module_migrations_1.migrateConfiguredPath)(glob, pendingMigrations))),
268
+ ];
235
269
  const needsMergeBase = plan.changes.some((change) => change.action === "conflict");
236
270
  let oldTree = null;
237
271
  if (options.oldTemplatesDir && needsMergeBase) {
@@ -250,7 +284,13 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
250
284
  (0, node_fs_1.rmSync)(previousModules.root, { recursive: true, force: true });
251
285
  }
252
286
  }
253
- const result = { written: [], removed: [], merged: [], conflicts: [] };
287
+ const result = {
288
+ written: [],
289
+ moved: (0, module_migrations_1.applyModuleMigrations)(projectRoot, migrationPlan),
290
+ removed: [],
291
+ merged: [],
292
+ conflicts: [],
293
+ };
254
294
  for (const change of plan.changes) {
255
295
  const newText = treeText(newTree, change.path);
256
296
  if (change.action === "update" || change.action === "add") {
@@ -280,22 +320,37 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
280
320
  // Keep the assembled target as the managed baseline. A merged working file
281
321
  // intentionally remains drifted so a future update performs another 3-way
282
322
  // merge instead of treating the user's lines as clean generated output.
283
- (0, lockfile_1.writeFilesLock)(projectRoot, updatedFilesLock(projectRoot, newTree, previousLock, ownedGlobs, managedOverrides));
323
+ (0, lockfile_1.writeFilesLock)(projectRoot, updatedFilesLock(projectRoot, newTree, previousLock, migratedOwnedGlobs, migratedManagedOverrides));
284
324
  const modulesDir = (0, node_path_1.join)(templatesDir, "modules");
325
+ const appliedMigrations = new Map();
326
+ for (const pending of pendingMigrations) {
327
+ const ids = appliedMigrations.get(pending.module) ?? [];
328
+ ids.push(pending.migration.id);
329
+ appliedMigrations.set(pending.module, ids);
330
+ }
285
331
  const refreshedModules = manifest.modules.map((module) => {
286
332
  const resolved = (0, add_1.resolveModule)(module.packageName ?? module.name, modulesDir, projectRoot);
287
- return resolved?.packageName
288
- ? {
289
- ...module,
290
- packageName: resolved.packageName,
291
- moduleVersion: resolved.moduleVersion,
292
- }
293
- : module;
333
+ const applied = [
334
+ ...new Set([
335
+ ...(module.appliedMigrations ?? []),
336
+ ...(appliedMigrations.get(module.name) ?? []),
337
+ ]),
338
+ ];
339
+ return {
340
+ ...module,
341
+ ...(resolved?.packageName
342
+ ? {
343
+ packageName: resolved.packageName,
344
+ moduleVersion: resolved.moduleVersion,
345
+ }
346
+ : {}),
347
+ ...(applied.length ? { appliedMigrations: applied } : {}),
348
+ };
294
349
  });
295
350
  (0, lockfile_1.writeManifest)(projectRoot, {
296
351
  ...manifest,
297
- ownedGlobs,
298
- managedOverrides,
352
+ ownedGlobs: migratedOwnedGlobs,
353
+ managedOverrides: migratedManagedOverrides,
299
354
  modules: refreshedModules,
300
355
  podokitVersion: (0, lockfile_1.podokitVersion)(),
301
356
  });
@@ -308,6 +363,7 @@ function summarize(plan) {
308
363
  merge: 0,
309
364
  conflict: 0,
310
365
  add: 0,
366
+ move: 0,
311
367
  remove: 0,
312
368
  skip: 0,
313
369
  "up-to-date": 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podosoft/podokit",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "An opinionated but extensible starter toolkit and CLI for full-stack TypeScript apps with NestJS, SvelteKit, TailwindCSS, shadcn-svelte, Docker, and k3s.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {