regpick 0.2.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.
Files changed (48) hide show
  1. package/.github/workflows/release.yml +51 -0
  2. package/.release-it.json +22 -0
  3. package/CHANGELOG.md +12 -0
  4. package/README.md +56 -0
  5. package/bin/regpick.js +3 -0
  6. package/docs/mvp-decisions.md +77 -0
  7. package/examples/README.md +26 -0
  8. package/examples/complex-ui-registry/registry.json +35 -0
  9. package/examples/simple-utils-registry/registry.json +28 -0
  10. package/package.json +39 -0
  11. package/regpick.config.schema.json +40 -0
  12. package/src/commands/add.ts +261 -0
  13. package/src/commands/init.ts +89 -0
  14. package/src/commands/list.ts +54 -0
  15. package/src/commands/pack.ts +97 -0
  16. package/src/commands/update.ts +139 -0
  17. package/src/core/__tests__/result-errors.test.ts +19 -0
  18. package/src/core/errors.ts +36 -0
  19. package/src/core/result.ts +19 -0
  20. package/src/domain/__tests__/addPlan.test.ts +64 -0
  21. package/src/domain/__tests__/initCore.test.ts +28 -0
  22. package/src/domain/__tests__/listCore.test.ts +29 -0
  23. package/src/domain/__tests__/pathPolicy.test.ts +64 -0
  24. package/src/domain/__tests__/registryModel.test.ts +32 -0
  25. package/src/domain/__tests__/selection.test.ts +58 -0
  26. package/src/domain/addPlan.ts +51 -0
  27. package/src/domain/aliasCore.ts +13 -0
  28. package/src/domain/initCore.ts +15 -0
  29. package/src/domain/listCore.ts +34 -0
  30. package/src/domain/packCore.ts +44 -0
  31. package/src/domain/pathPolicy.ts +61 -0
  32. package/src/domain/registryModel.ts +100 -0
  33. package/src/domain/selection.ts +47 -0
  34. package/src/index.ts +117 -0
  35. package/src/shell/cli/args.ts +37 -0
  36. package/src/shell/config.ts +105 -0
  37. package/src/shell/installer.ts +70 -0
  38. package/src/shell/lockfile.ts +35 -0
  39. package/src/shell/packageManagers/__tests__/resolver.test.ts +61 -0
  40. package/src/shell/packageManagers/__tests__/strategy.test.ts +40 -0
  41. package/src/shell/packageManagers/resolver.ts +27 -0
  42. package/src/shell/packageManagers/strategy.ts +65 -0
  43. package/src/shell/registry.ts +182 -0
  44. package/src/shell/runtime/ports.ts +200 -0
  45. package/src/types.ts +92 -0
  46. package/test-clack.ts +2 -0
  47. package/tsconfig.json +15 -0
  48. package/tsdown.config.ts +8 -0
package/src/types.ts ADDED
@@ -0,0 +1,92 @@
1
+ import type { RuntimePorts } from "./shell/runtime/ports.js";
2
+
3
+ export type FlagValue = string | boolean;
4
+
5
+ export type CliArgs = {
6
+ flags: Record<string, FlagValue>;
7
+ positionals: string[];
8
+ };
9
+
10
+ export type CommandContext = {
11
+ cwd: string;
12
+ args: CliArgs;
13
+ runtime: RuntimePorts;
14
+ };
15
+
16
+ export type OverwritePolicy = "prompt" | "overwrite" | "skip";
17
+ export type PackageManager = "auto" | "npm" | "yarn" | "pnpm";
18
+
19
+ export type RegpickConfig = {
20
+ registries: Record<string, string>;
21
+ targetsByType: Record<string, string>;
22
+ aliases?: Record<string, string>;
23
+ overwritePolicy: OverwritePolicy;
24
+ packageManager: PackageManager;
25
+ preferManifestTarget: boolean;
26
+ allowOutsideProject: boolean;
27
+ };
28
+
29
+ export type RegistrySourceMeta = {
30
+ type: "http" | "file" | "directory";
31
+ baseUrl?: string;
32
+ baseDir?: string;
33
+ };
34
+
35
+ export type RegistryFile = {
36
+ path?: string;
37
+ target?: string;
38
+ type: string;
39
+ content?: string;
40
+ url?: string;
41
+ };
42
+
43
+ export type RegistryItem = {
44
+ name: string;
45
+ title: string;
46
+ description: string;
47
+ type: string;
48
+ dependencies: string[];
49
+ devDependencies: string[];
50
+ registryDependencies: string[];
51
+ files: RegistryFile[];
52
+ sourceMeta: RegistrySourceMeta;
53
+ };
54
+
55
+ export type PlannedWrite = {
56
+ itemName: string;
57
+ sourceFile: RegistryFile;
58
+ absoluteTarget: string;
59
+ relativeTarget: string;
60
+ };
61
+
62
+ export type DependencyPlan = {
63
+ dependencies: string[];
64
+ devDependencies: string[];
65
+ };
66
+
67
+ export type InstallPlan = {
68
+ selectedItems: RegistryItem[];
69
+ plannedWrites: PlannedWrite[];
70
+ dependencyPlan: DependencyPlan;
71
+ conflicts: PlannedWrite[];
72
+ };
73
+
74
+ export type LockfileItem = {
75
+ version?: string;
76
+ source?: string;
77
+ hash: string;
78
+ };
79
+
80
+ export type RegpickLockfile = {
81
+ components: Record<string, LockfileItem>;
82
+ };
83
+
84
+ export type CommandOutcome =
85
+ | {
86
+ kind: "success";
87
+ message?: string;
88
+ }
89
+ | {
90
+ kind: "noop";
91
+ message: string;
92
+ };
package/test-clack.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { autocompleteMultiselect } from "@clack/prompts";
2
+ console.log(typeof autocompleteMultiselect);
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "resolveJsonModule": true,
10
+ "outDir": "dist",
11
+ "rootDir": "src",
12
+ "types": ["node"]
13
+ },
14
+ "include": ["src/**/*.ts"]
15
+ }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'tsdown'
2
+
3
+ export default defineConfig({
4
+ entry: ['./src/index.ts'],
5
+ format: ['esm'],
6
+ target: 'node24',
7
+ clean: true,
8
+ })