@g3nomaly/ui 0.3.3 → 0.3.5

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 (139) hide show
  1. package/README.md +49 -26
  2. package/dist/cli/adapter.d.ts +25 -8
  3. package/dist/cli/adapter.d.ts.map +1 -1
  4. package/dist/cli/adapter.js +34 -20
  5. package/dist/cli/adapter.js.map +1 -1
  6. package/dist/cli/afterInstall.d.ts +26 -0
  7. package/dist/cli/afterInstall.d.ts.map +1 -0
  8. package/dist/cli/afterInstall.js +54 -0
  9. package/dist/cli/afterInstall.js.map +1 -0
  10. package/dist/cli/commands/add.d.ts +8 -2
  11. package/dist/cli/commands/add.d.ts.map +1 -1
  12. package/dist/cli/commands/add.js +10 -5
  13. package/dist/cli/commands/add.js.map +1 -1
  14. package/dist/cli/commands/index.d.ts +1 -0
  15. package/dist/cli/commands/index.d.ts.map +1 -1
  16. package/dist/cli/commands/index.js +1 -0
  17. package/dist/cli/commands/index.js.map +1 -1
  18. package/dist/cli/commands/init.d.ts +16 -5
  19. package/dist/cli/commands/init.d.ts.map +1 -1
  20. package/dist/cli/commands/init.js +59 -13
  21. package/dist/cli/commands/init.js.map +1 -1
  22. package/dist/cli/commands/ls.d.ts +1 -1
  23. package/dist/cli/commands/ls.js +1 -1
  24. package/dist/cli/commands/ls.js.map +1 -1
  25. package/dist/cli/commands/manifest.js +1 -1
  26. package/dist/cli/commands/manifest.js.map +1 -1
  27. package/dist/cli/commands/source.d.ts +4 -1
  28. package/dist/cli/commands/source.d.ts.map +1 -1
  29. package/dist/cli/commands/source.js +29 -2
  30. package/dist/cli/commands/source.js.map +1 -1
  31. package/dist/cli/commands/sourceInit.d.ts +9 -0
  32. package/dist/cli/commands/sourceInit.d.ts.map +1 -0
  33. package/dist/cli/commands/sourceInit.js +78 -0
  34. package/dist/cli/commands/sourceInit.js.map +1 -0
  35. package/dist/cli/commands/update.d.ts +10 -3
  36. package/dist/cli/commands/update.d.ts.map +1 -1
  37. package/dist/cli/commands/update.js +9 -4
  38. package/dist/cli/commands/update.js.map +1 -1
  39. package/dist/cli/index.js +17 -6
  40. package/dist/cli/index.js.map +1 -1
  41. package/dist/cli/localSources.d.ts +12 -0
  42. package/dist/cli/localSources.d.ts.map +1 -0
  43. package/dist/cli/localSources.js +49 -0
  44. package/dist/cli/localSources.js.map +1 -0
  45. package/dist/cli/npmDependencies.d.ts +11 -0
  46. package/dist/cli/npmDependencies.d.ts.map +1 -0
  47. package/dist/cli/npmDependencies.js +73 -0
  48. package/dist/cli/npmDependencies.js.map +1 -0
  49. package/dist/cli/packageFiles.d.ts +15 -0
  50. package/dist/cli/packageFiles.d.ts.map +1 -0
  51. package/dist/cli/packageFiles.js +54 -0
  52. package/dist/cli/packageFiles.js.map +1 -0
  53. package/dist/cli/themeTokens.d.ts +12 -0
  54. package/dist/cli/themeTokens.d.ts.map +1 -0
  55. package/dist/cli/themeTokens.js +60 -0
  56. package/dist/cli/themeTokens.js.map +1 -0
  57. package/dist/packages/dependencies.d.ts +48 -0
  58. package/dist/packages/dependencies.d.ts.map +1 -0
  59. package/dist/packages/dependencies.js +66 -0
  60. package/dist/packages/dependencies.js.map +1 -0
  61. package/dist/packages/install.d.ts +30 -0
  62. package/dist/packages/install.d.ts.map +1 -0
  63. package/dist/packages/install.js +54 -0
  64. package/dist/packages/install.js.map +1 -0
  65. package/dist/packages/localPack.d.ts +48 -0
  66. package/dist/packages/localPack.d.ts.map +1 -0
  67. package/dist/packages/localPack.js +72 -0
  68. package/dist/packages/localPack.js.map +1 -0
  69. package/dist/registry/adapters/shadcn.adapter.d.ts +32 -7
  70. package/dist/registry/adapters/shadcn.adapter.d.ts.map +1 -1
  71. package/dist/registry/adapters/shadcn.adapter.js +75 -20
  72. package/dist/registry/adapters/shadcn.adapter.js.map +1 -1
  73. package/dist/registry/adapters/shadcnImports.d.ts +10 -0
  74. package/dist/registry/adapters/shadcnImports.d.ts.map +1 -0
  75. package/dist/registry/adapters/shadcnImports.js +18 -0
  76. package/dist/registry/adapters/shadcnImports.js.map +1 -0
  77. package/dist/registry/componentsJson.d.ts +6 -1
  78. package/dist/registry/componentsJson.d.ts.map +1 -1
  79. package/dist/registry/componentsJson.js +34 -1
  80. package/dist/registry/componentsJson.js.map +1 -1
  81. package/dist/registry/index.d.ts +1 -1
  82. package/dist/registry/index.d.ts.map +1 -1
  83. package/dist/registry/index.js +1 -1
  84. package/dist/registry/index.js.map +1 -1
  85. package/dist/registry/manifest.d.ts +2 -13
  86. package/dist/registry/manifest.d.ts.map +1 -1
  87. package/dist/registry/manifest.js +4 -76
  88. package/dist/registry/manifest.js.map +1 -1
  89. package/dist/registry/packageExports.d.ts +9 -0
  90. package/dist/registry/packageExports.d.ts.map +1 -0
  91. package/dist/registry/packageExports.js +50 -0
  92. package/dist/registry/packageExports.js.map +1 -0
  93. package/dist/registry/packageImports.d.ts +23 -0
  94. package/dist/registry/packageImports.d.ts.map +1 -0
  95. package/dist/registry/packageImports.js +51 -0
  96. package/dist/registry/packageImports.js.map +1 -0
  97. package/dist/registry/readSource.d.ts +4 -2
  98. package/dist/registry/readSource.d.ts.map +1 -1
  99. package/dist/registry/readSource.js +27 -3
  100. package/dist/registry/readSource.js.map +1 -1
  101. package/dist/registry/types.d.ts +86 -3
  102. package/dist/registry/types.d.ts.map +1 -1
  103. package/dist/registry/types.js +46 -3
  104. package/dist/registry/types.js.map +1 -1
  105. package/dist/sources/builtins.d.ts +1 -5
  106. package/dist/sources/builtins.d.ts.map +1 -1
  107. package/dist/sources/builtins.js +2 -7
  108. package/dist/sources/builtins.js.map +1 -1
  109. package/dist/theme/cssVars.d.ts +43 -0
  110. package/dist/theme/cssVars.d.ts.map +1 -0
  111. package/dist/theme/cssVars.js +107 -0
  112. package/dist/theme/cssVars.js.map +1 -0
  113. package/dist/theme/detectCssFile.d.ts +9 -0
  114. package/dist/theme/detectCssFile.d.ts.map +1 -0
  115. package/dist/theme/detectCssFile.js +41 -0
  116. package/dist/theme/detectCssFile.js.map +1 -0
  117. package/package.json +8 -21
  118. package/template/build.ts +32 -0
  119. package/template/package.json +22 -0
  120. package/template/src/components/example/Example.css +20 -0
  121. package/template/src/components/example/Example.tsx +26 -0
  122. package/template/src/components/example/example.meta.ts +69 -0
  123. package/dist/components/basic/Card.css +0 -32
  124. package/dist/components/basic/Card.debug.ts +0 -5
  125. package/dist/components/basic/Card.tsx +0 -31
  126. package/dist/components/basic/CardFooter.css +0 -16
  127. package/dist/components/basic/CardFooter.debug.ts +0 -5
  128. package/dist/components/basic/CardFooter.tsx +0 -29
  129. package/dist/components/basic/CardHeader.css +0 -14
  130. package/dist/components/basic/CardHeader.debug.ts +0 -5
  131. package/dist/components/basic/CardHeader.tsx +0 -29
  132. package/dist/components/basic/card.meta.ts +0 -14
  133. package/dist/components/basic/cardfooter.meta.ts +0 -14
  134. package/dist/components/basic/cardheader.meta.ts +0 -14
  135. package/dist/components/input/Button.css +0 -34
  136. package/dist/components/input/Button.debug.ts +0 -5
  137. package/dist/components/input/Button.tsx +0 -28
  138. package/dist/components/input/button.meta.ts +0 -14
  139. package/dist/components.json +0 -138
package/README.md CHANGED
@@ -1,26 +1,27 @@
1
1
  # @g3nomaly/ui
2
2
 
3
- `g3nui` copies React components into your project as source files, the way shadcn does. You own the copied files and can edit them. The g3n components ship with this package and are always available. The CLI can also install shadcn components, and you can register other sources: a git repository, an npm package or a local folder.
3
+ `@g3nomaly/ui` copies React components into your project as source files, the way shadcn does. You own the copied files and can edit them. This package is the installer only. The g3n components live in [`@g3nomaly/g3n-ui`](https://www.npmjs.com/package/@g3nomaly/g3n-ui), which is built in as a source and always available. The installer can also install shadcn components, and you can register other sources: a git repository, an npm package or a local folder.
4
4
 
5
5
  ## Requirements
6
6
 
7
7
  - [Bun](https://bun.sh). The CLI runs on Bun only.
8
- - A git repository. `g3nui` anchors every command to the repository root.
9
- - React. Each g3n component is a `.tsx` file that imports its own `.css` file, so your bundler must handle CSS imports.
8
+ - A git repository. The installer anchors every command to the repository root.
9
+ - React, for the components you install.
10
10
 
11
11
  For shadcn components you also need:
12
12
 
13
13
  - the `shadcn` package next to `@g3nomaly/ui` in your project: `bun add -d @g3nomaly/ui shadcn@latest`
14
14
  - Tailwind CSS, because shadcn components are styled with Tailwind classes
15
- - network access, since `g3nui` reads the component list from `ui.shadcn.com`
15
+ - network access, since the installer reads the component list from `ui.shadcn.com`
16
16
 
17
- No `components.json` is needed. `g3nui` keeps its own config.
17
+ No `components.json` is needed. The installer keeps its own config.
18
18
 
19
19
  ## Install components
20
20
 
21
- Run these from the root of your project:
21
+ Run these from the root of your project. Adding the installer first pins its version in `bun.lock`, so everyone on the team runs the same one:
22
22
 
23
23
  ```sh
24
+ bun add -d @g3nomaly/ui
24
25
  bunx @g3nomaly/ui init # writes .g3n.config.json and asks where components go
25
26
  bunx @g3nomaly/ui ls # lists the components you can install
26
27
  bunx @g3nomaly/ui add button # installs one component
@@ -28,30 +29,27 @@ bunx @g3nomaly/ui add basic # or every component in the basic group
28
29
  bunx @g3nomaly/ui add # or pick from a list
29
30
  ```
30
31
 
31
- `init` asks for the install directory, `src/components/ui` by default, and whether to copy the `.debug.ts` and `.meta.ts` files that come with each component. Pass `--install-dir <path>` to skip the questions, or `-f` to reconfigure without being asked first.
32
+ `init` asks for the install directory, `src/components/ui` by default, whether to copy the `.debug.ts` and `.meta.ts` files that come with each component, and for your global stylesheet, which it finds itself when shadcn's `components.json` names it or it sits in a usual place such as `src/index.css`. When your `package.json` lists `shadcn`, it also asks whether to install shadcn components. Pass `--install-dir <path>` to skip the questions, which turns shadcn on when `package.json` lists it, or `-f` to reconfigure without being asked first.
32
33
 
33
- `add` installs the dependencies of a component too, so `add cardheader` also installs `card`. Files keep their group folder: `button` lands in `src/components/ui/input/Button.tsx`. The `--debug` and `--meta` flags include the optional files for one run.
34
+ `add` installs the dependencies of a component too, so `add cardheader` also installs `card`. When more than one source offers a name, as a group or a component, `add` asks which source to take it from. Name the source yourself to skip the question: `g3n-ui:basic` for a group, `button@g3n-ui` for a component. Without a terminal, as in CI, `add` prints these forms and stops. Files keep their group folder: `button` lands in `src/components/ui/input/Button.tsx`. The `--debug` and `--meta` flags include the optional files for one run.
34
35
 
35
- `g3nui` records what it installed in `.g3n/.g3nui-manifest.json`. Commit it with `.g3n.config.json` so your team gets the same components.
36
+ Some files stay in their source package, such as a store that manages a component's data. The installer never copies them, and the component imports them from the package, so they update with `bun install`. Such a source must be installed with `bun add` (not `-d`, since your app imports it at runtime) and registered as `npm:<package>`. The source lists every package those files import as a peer, so they use your app's React and not a second copy. When you install such a source from a folder with `bun add file:<path>`, the installer swaps the link for a packed copy on every `add` and `update`, since a linked folder brings its own `node_modules`. `add --include-unsafe` copies them next to the component anyway, as an unsafe copy: the component keeps importing the package's version until you point the import at the copy yourself, and `update` and `remove` leave the copy alone.
36
37
 
37
- ## The g3n components
38
+ A component can declare theme tokens its CSS needs, such as shadcn's sidebar colours. After `add` and `update`, the installer adds the ones your stylesheet lacks: to `:root`, `.dark` and `@theme inline`, the blocks a shadcn or tweakcn `globals.css` has. A token your stylesheet already defines keeps your value. Without a stylesheet set, the installer prints the tokens to add by hand.
38
39
 
39
- | Key | Group | What it is | Needs |
40
- |---|---|---|---|
41
- | `button` | `input` | A button with `primary`, `secondary` and `ghost` variants | |
42
- | `card` | `basic` | A card container | |
43
- | `cardheader` | `basic` | The header section of a card | `card` |
44
- | `cardfooter` | `basic` | The footer section of a card | `card` |
40
+ A component can list the npm packages its files import, such as `radix-ui` or `recharts@3.8.0`. After `add` and `update`, the installer prints each package that your `package.json` does not list, and each installed package whose version is outside the range a component asks for, with the `bun add` command that fixes it. Pass `--install` to run that command for you. A package a component imports at runtime but your `package.json` lists only under `devDependencies` is reported too: move it to `dependencies` yourself, since the installer keeps the range you gave it.
41
+
42
+ The installer records what it installed, and the sources you registered, in `.g3n/ui.json`. Commit it with `.g3n.config.json` so your team gets the same components and sources.
45
43
 
46
- The CSS of every component sits under the `.g3nui` class, so it does not leak into the rest of your styles.
44
+ The g3n components the built-in `g3n-ui` source offers are listed in the [`@g3nomaly/g3n-ui` README](https://www.npmjs.com/package/@g3nomaly/g3n-ui). The installer reads them from `node_modules/@g3nomaly/g3n-ui` when your project has that package, and downloads the latest release otherwise.
47
45
 
48
46
  ## shadcn components
49
47
 
50
- shadcn is off until you turn it on. Add `"shadcn"` to `registeredPackages` in `.g3n.config.json`:
48
+ Add the `shadcn` package with `bun add -d shadcn@latest` before you run `init`, and `init` turns shadcn on for you. To turn it on later, run `init` again, or add `"shadcn"` to `registeredPackages` in `.g3n.config.json`:
51
49
 
52
50
  ```json
53
51
  {
54
- "g3nui": {
52
+ "ui": {
55
53
  "settings": {
56
54
  "registeredPackages": ["shadcn"]
57
55
  }
@@ -66,7 +64,13 @@ bunx @g3nomaly/ui ls --source shadcn
66
64
  bunx @g3nomaly/ui add @shadcn/button @shadcn/dialog
67
65
  ```
68
66
 
69
- Every shadcn file goes to a `shadcn/` folder in your install directory, for example `src/components/ui/shadcn/button.tsx`. `g3nui` writes each file as the shadcn registry serves it and installs the shadcn components it depends on. It does not install npm packages, so add the ones the files import, such as `class-variance-authority` or `radix-ui`, with `bun add`.
67
+ Every shadcn file goes to a `shadcn/` folder in your install directory, for example `src/components/ui/shadcn/button.tsx`. The installer also installs the shadcn components it depends on. The registry serves files with imports such as `@/registry/new-york-v4/ui/button`, which only resolve inside the shadcn repository, so the installer rewrites them to the sibling file, `./button`. No path alias is needed.
68
+
69
+ shadcn components list their npm packages, such as `cn` and `radix-ui`, and the installer checks them like any other component's. Pass `--install` to add them.
70
+
71
+ The installed `shadcn` package decides the version: each shadcn component records it, and `update` shows the change, such as `@shadcn/button 4.21.1 → 4.22.1`. To move to newer shadcn components, upgrade the package with `bun add -d shadcn@latest`, then run `update`. The shadcn registry only serves its latest files, so an older version cannot be installed again. Your git history keeps the files you had.
72
+
73
+ Keep formatters and lint fixers away from the `shadcn/` folder and the rest of your install directory. A reformatted file counts as a local change, and `update` then leaves it alone.
70
74
 
71
75
  ## Keep components up to date
72
76
 
@@ -78,7 +82,7 @@ bunx @g3nomaly/ui remove cardheader
78
82
  bunx @g3nomaly/ui ls --installed
79
83
  ```
80
84
 
81
- `update` reinstalls each component from the source it came from. When you have changed an installed file, `update` asks whether to restore the source version, fork the component under a new key that updates leave alone, or skip it and ask again next time. Pass `-f` to restore without asking. `add -f` does the same for files `add` would overwrite.
85
+ `update` reinstalls each component from the source it came from and shows the version change, such as `button 0.1.0 → 0.2.0`. A component that gained a dependency since you installed it gets that dependency installed too. `--dry-run` names it instead. When you have changed an installed file, `update` asks whether to restore the source version, fork the component under a new key that updates leave alone, or skip it and ask again next time. Pass `-f` to restore without asking. `add -f` does the same for files `add` would overwrite.
82
86
 
83
87
  `remove` offers to remove the installed components that depend on the one you remove. It asks before deleting a file you changed, unless you pass `-f`.
84
88
 
@@ -93,27 +97,46 @@ bunx @g3nomaly/ui manifest
93
97
  ```sh
94
98
  bunx @g3nomaly/ui source add owner/repo # a GitHub repository
95
99
  bunx @g3nomaly/ui source add https://git.example.com/ui.git --ref v1
96
- bunx @g3nomaly/ui source add npm:some-components # an npm package
100
+ bunx @g3nomaly/ui source add npm:some-components # an npm package in your package.json
97
101
  bunx @g3nomaly/ui source add ./my-components --name mine # a local folder
98
102
  bunx @g3nomaly/ui source ls
99
103
  bunx @g3nomaly/ui add card@mine # a component from one source
100
104
  bunx @g3nomaly/ui source remove mine
101
105
  ```
102
106
 
103
- The built-in `g3nui` source cannot be removed. `source remove` also refuses a source that installed components came from, unless you pass `-f`.
107
+ The built-in `g3n-ui` source cannot be removed. `source remove` also refuses a source that installed components came from, unless you pass `-f`. To point a registered name somewhere else, such as from a local folder to the npm package, pass `-f` to `source add`: `source add npm:my-ui --name mine -f`. Installed components keep their source name, so they update from the new place.
108
+
109
+ Every registered source is stored in `.g3n/ui.json`, so it stays registered for everyone who clones the project. Which kind to use:
110
+
111
+ | Kind | Register | Version | For |
112
+ |---|---|---|---|
113
+ | npm | `bun add <pkg>`, then `source add npm:<pkg>` | `package.json` and `bun.lock`, like any dependency. `update` reads the installed copy | Teams. The package can come from npm, from git (`bun add github:me/my-ui#v1.2.0`), from your Bun workspace (`"my-ui": "workspace:*"`) or from a folder (`bun add file:../my-ui`). A workspace is the best way to work on a source next to an app |
114
+ | git | `source add owner/repo`, optionally `--ref <tag>` | The branch or tag, cloned on each command | Sources not installed as a package |
115
+ | local | `source add ../my-ui` | Whatever the folder holds | Working on a source next to an app. The path is stored relative to the project, so teammates need the same folder layout |
116
+
117
+ An npm source must be in your `package.json` before you register it. When `package.json` lists it but `node_modules` does not hold it, commands ask you to run `bun install` and leave its components as they are. They never download a different version. A source whose components keep no files in the package is only read by the installer, so `bun add -d` is enough for it. Unscoped package names need the `npm:` prefix. Scoped names such as `@me/my-ui` work without it.
118
+
119
+ ## Write your own source
120
+
121
+ ```sh
122
+ bunx @g3nomaly/ui source init my-ui # a package.json, a build script and one example component
123
+ cd my-ui && bun install && bun run build
124
+ ```
125
+
126
+ The comments in the example component explain how a source works: the meta file, how files land in an app, relative imports, files that stay in the package (`install: "package"`, reached through the `exports` field), depending on shadcn components and npm packages, theme colours, versions and publishing. Start in `src/components/example/example.meta.ts`. [`@g3nomaly/g3n-ui`](https://www.npmjs.com/package/@g3nomaly/g3n-ui) is built the same way.
104
127
 
105
- A source must hold a built `dist/components.json` next to its files in `dist/components/<group>/`. Each component has a `.meta.ts` file that lists its files and dependencies. `writeComponentsJson` from `@g3nomaly/ui/registry` scans those files and writes `components.json`, and `PackagedComponent` from `@g3nomaly/ui/types` types them.
128
+ A built source holds `dist/components.json` next to its files in `dist/components/<group>/`. `writeComponentsJson` from `@g3nomaly/ui/registry` writes it from the `.meta.ts` files, and `PackagedComponent` from `@g3nomaly/ui/types` types them.
106
129
 
107
130
  ## Development
108
131
 
109
132
  Run `bun install` at the repository root first, then every command from this directory.
110
133
 
111
134
  ```sh
112
- bun run g3nui -- ls # the CLI from source
135
+ bun run ui -- ls # the CLI from source
113
136
  bun run typecheck
114
137
  bun run lint
115
138
  bun test tests/unit
116
- bun run build # types, components and dist/components.json into dist/
139
+ bun run build # the CLI and its types into dist/
117
140
  ```
118
141
 
119
142
  `@g3nomaly/ui` depends on [`@g3nomaly/core`](https://www.npmjs.com/package/@g3nomaly/core), which holds the install logic it shares with [`@g3nomaly/skills`](https://www.npmjs.com/package/@g3nomaly/skills) and [`@g3nomaly/mods`](https://www.npmjs.com/package/@g3nomaly/mods).
@@ -3,6 +3,7 @@ import type { G3nConfig } from "@g3nomaly/core/config";
3
3
  import type { InstallCommandContext, ManifestTarget, SourceCommandContext } from "@g3nomaly/core/cli";
4
4
  import type { SourceRegistry } from "@g3nomaly/core/installer";
5
5
  import type { RegisteredSource, SourceRecord } from "@g3nomaly/core/sources";
6
+ import type { FetchedComponentFields } from "../registry/adapters/shadcn.adapter";
6
7
  import type { ComponentFileFlags } from "../registry/readSource";
7
8
  import type { ComponentMeta, ComponentRegistry } from "../registry/types";
8
9
  /**
@@ -16,7 +17,7 @@ export interface ProjectDeps {
16
17
  builtins?: SourceRecord;
17
18
  }
18
19
  /**
19
- * @brief A project opened for a g3nui command: its root, config, the one install target and the built-in sources.
20
+ * @brief A project opened for a g3n-ui command: its root, config, the one install target and the built-in sources.
20
21
  *
21
22
  * @property projectRoot - Absolute project root.
22
23
  * @property config - Loaded g3n config.
@@ -29,12 +30,21 @@ export interface UiProject {
29
30
  target: ManifestTarget;
30
31
  builtins: SourceRecord;
31
32
  }
32
- /** What the core install commands print, check and fetch for components. */
33
+ /** How the README runs the installer: the project's copy when installed, never a package that merely shares the bin's name. */
34
+ export declare const UI_COMMAND = "bunx @g3nomaly/ui";
35
+ /** What the core commands print and check for components. */
33
36
  export declare const UI_CONTEXT: InstallCommandContext<ComponentMeta>;
34
37
  /**
35
- * @brief Anchors the command to the git project, loads its config, migrates a
36
- * manifest from before the shared shape, and opens the manifest; exits when
37
- * outside a repo or when the manifest cannot be read.
38
+ * @brief What the core install commands print, check and fetch for components: shadcn components are
39
+ * fetched from the shadcn registry, every other component is copied out of its source.
40
+ *
41
+ * @param fetchedByKey - Filled with the npm packages and theme tokens of each shadcn component fetched, by component key.
42
+ * @returns The install context.
43
+ */
44
+ export declare function uiInstallContext(fetchedByKey: Map<string, FetchedComponentFields>): InstallCommandContext<ComponentMeta>;
45
+ /**
46
+ * @brief Anchors the command to the git project, loads its config and opens the
47
+ * manifest; exits when outside a repo or when the manifest cannot be read.
38
48
  *
39
49
  * @param deps - Test injection.
40
50
  * @returns The opened project.
@@ -67,15 +77,22 @@ export declare function fileFlags(project: UiProject, options?: {
67
77
  }): ComponentFileFlags;
68
78
  /**
69
79
  * @brief Reads the components of the project's sources, plus shadcn's when it is in
70
- * `g3nui.settings.registeredPackages`, and prints what could not be read;
80
+ * `ui.settings.registeredPackages`, and prints what could not be read;
71
81
  * the caller disposes the result.
72
82
  *
83
+ * With `packLocal`, an npm source the app installs from a folder on disk is first installed as a
84
+ * packed copy, when its components keep files in the package (see `packLocalSources`).
85
+ *
73
86
  * @param project - The opened project.
74
87
  * @param flags - Which optional file kinds to read.
75
- * @param only - Source name to read alone; exits when no such source is registered.
88
+ * @param options - `only`: source name to read alone, exiting when no such source is registered.
89
+ * `packLocal`: install or refresh packed copies of local sources first; for commands that install.
76
90
  * @returns The components per source; dispose it once read.
77
91
  */
78
- export declare function openComponentRegistry(project: UiProject, flags: ComponentFileFlags, only?: string): Promise<SourceRegistry<ComponentMeta>>;
92
+ export declare function openComponentRegistry(project: UiProject, flags: ComponentFileFlags, options?: {
93
+ only?: string;
94
+ packLocal?: boolean;
95
+ }): Promise<SourceRegistry<ComponentMeta>>;
79
96
  /**
80
97
  * @brief What the core source commands need to know about components in one project.
81
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBA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EAAE,qBAAqB,CAAC,aAAa,CAI3D,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAExH;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAc9E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,GAAG,gBAAgB,EAAE,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,GAAG,iBAAiB,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,kBAAkB,CAKnH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAmBxC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAEvF"}
@@ -1,25 +1,36 @@
1
1
  // packages/ui/src/cli/adapter.ts
2
2
  import path from "node:path";
3
3
  import { loadConfig, resolveProjectRoot } from "@g3nomaly/core/config";
4
- import { c, lineError, lineInfo, narrowSources, orExit, reportSourceRegistry } from "@g3nomaly/core/cli";
4
+ import { lineError, narrowSources, orExit, reportSourceRegistry } from "@g3nomaly/core/cli";
5
5
  import { entrySource, installedEntries, loadInstallManifest, loadSourceRegistry, manifestSources } from "@g3nomaly/core/installer";
6
6
  import { createRegistryStore, register } from "@g3nomaly/core/registry";
7
7
  import { readShadcnEntries, shadcnFileSource } from "../registry/adapters/shadcn.adapter";
8
- import { SHADCN_SOURCE, migrateLegacyManifest, uiManifestPath } from "../registry/manifest";
8
+ import { SHADCN_SOURCE, uiManifestPath } from "../registry/manifest";
9
9
  import { readComponentSource } from "../registry/readSource";
10
10
  import { ComponentMetaSchema } from "../registry/types";
11
11
  import { BUILTIN_SOURCES } from "../sources/builtins";
12
- /** What the core install commands print, check and fetch for components. */
12
+ import { packLocalSources } from "./localSources";
13
+ /** How the README runs the installer: the project's copy when installed, never a package that merely shares the bin's name. */
14
+ export const UI_COMMAND = "bunx @g3nomaly/ui";
15
+ /** What the core commands print and check for components. */
13
16
  export const UI_CONTEXT = {
14
- bin: "g3nui",
17
+ command: UI_COMMAND,
15
18
  noun: "component",
16
19
  entrySchema: ComponentMetaSchema,
17
- fileSource: (registry) => shadcnFileSource(entrySource(registry)),
18
20
  };
19
21
  /**
20
- * @brief Anchors the command to the git project, loads its config, migrates a
21
- * manifest from before the shared shape, and opens the manifest; exits when
22
- * outside a repo or when the manifest cannot be read.
22
+ * @brief What the core install commands print, check and fetch for components: shadcn components are
23
+ * fetched from the shadcn registry, every other component is copied out of its source.
24
+ *
25
+ * @param fetchedByKey - Filled with the npm packages and theme tokens of each shadcn component fetched, by component key.
26
+ * @returns The install context.
27
+ */
28
+ export function uiInstallContext(fetchedByKey) {
29
+ return { ...UI_CONTEXT, fileSource: (registry) => shadcnFileSource(entrySource(registry), fetchedByKey) };
30
+ }
31
+ /**
32
+ * @brief Anchors the command to the git project, loads its config and opens the
33
+ * manifest; exits when outside a repo or when the manifest cannot be read.
23
34
  *
24
35
  * @param deps - Test injection.
25
36
  * @returns The opened project.
@@ -27,18 +38,15 @@ export const UI_CONTEXT = {
27
38
  export async function openUiProject(deps = {}) {
28
39
  const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
29
40
  if (projectRoot === null) {
30
- console.error(lineError("No g3n project found: run `g3nui init` inside a git repository."));
41
+ console.error(lineError(`No g3n project found: run \`${UI_COMMAND} init\` inside a git repository.`));
31
42
  process.exit(1);
32
43
  }
33
44
  const config = await loadConfig(projectRoot);
34
- const migrated = await migrateLegacyManifest(projectRoot);
35
- if (migrated !== null)
36
- console.log(lineInfo(`Migrated ${c.file(path.relative(projectRoot, migrated))} to the shared manifest shape`));
37
45
  const manifest = orExit(() => loadInstallManifest(uiManifestPath(projectRoot), ComponentMetaSchema));
38
46
  return {
39
47
  projectRoot,
40
48
  config,
41
- target: { label: "", installDir: path.join(projectRoot, config.g3nui.settings.componentsDir), store: manifest.store, manifest },
49
+ target: { label: "", installDir: path.join(projectRoot, config.ui.settings.componentsDir), store: manifest.store, manifest },
42
50
  builtins: deps.builtins ?? BUILTIN_SOURCES,
43
51
  };
44
52
  }
@@ -69,25 +77,31 @@ export function installedComponents(project) {
69
77
  */
70
78
  export function fileFlags(project, options = {}) {
71
79
  return {
72
- includeDebug: options.debug ?? project.config.g3nui.settings.includeDebugFiles,
73
- includeMeta: options.meta ?? project.config.g3nui.settings.includeMetaFiles,
80
+ includeDebug: options.debug ?? project.config.ui.settings.includeDebugFiles,
81
+ includeMeta: options.meta ?? project.config.ui.settings.includeMetaFiles,
74
82
  };
75
83
  }
76
84
  /**
77
85
  * @brief Reads the components of the project's sources, plus shadcn's when it is in
78
- * `g3nui.settings.registeredPackages`, and prints what could not be read;
86
+ * `ui.settings.registeredPackages`, and prints what could not be read;
79
87
  * the caller disposes the result.
80
88
  *
89
+ * With `packLocal`, an npm source the app installs from a folder on disk is first installed as a
90
+ * packed copy, when its components keep files in the package (see `packLocalSources`).
91
+ *
81
92
  * @param project - The opened project.
82
93
  * @param flags - Which optional file kinds to read.
83
- * @param only - Source name to read alone; exits when no such source is registered.
94
+ * @param options - `only`: source name to read alone, exiting when no such source is registered.
95
+ * `packLocal`: install or refresh packed copies of local sources first; for commands that install.
84
96
  * @returns The components per source; dispose it once read.
85
97
  */
86
- export async function openComponentRegistry(project, flags, only) {
87
- const packages = project.config.g3nui.settings.registeredPackages;
98
+ export async function openComponentRegistry(project, flags, options = {}) {
99
+ const packages = project.config.ui.settings.registeredPackages;
88
100
  const shadcnOn = packages.includes(SHADCN_SOURCE);
89
- const named = narrowSources([...uiSources(project), ...(shadcnOn ? [{ name: SHADCN_SOURCE }] : [])], only, "g3nui").map((s) => s.name);
101
+ const named = narrowSources([...uiSources(project), ...(shadcnOn ? [{ name: SHADCN_SOURCE }] : [])], options.only, UI_COMMAND).map((s) => s.name);
90
102
  const sources = uiSources(project).filter((s) => named.includes(s.name));
103
+ if (options.packLocal === true)
104
+ await packLocalSources(project.projectRoot, sources);
91
105
  const registry = await loadSourceRegistry(sources, project.projectRoot, readComponentSource(flags));
92
106
  if (shadcnOn && named.includes(SHADCN_SOURCE)) {
93
107
  const shadcn = await readShadcnEntries();
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEzG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnI,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5F,O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AAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;AAC9I,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { AfterTarget } from "@g3nomaly/core/cli";
2
+ import type { FetchedComponentFields } from "../registry/adapters/shadcn.adapter";
3
+ import type { UiProject } from "./adapter";
4
+ /**
5
+ * @brief What runs after components are installed or updated, beside the files.
6
+ *
7
+ * @property install - Add missing npm packages with `bun add` instead of only reporting them.
8
+ * @property includeUnsafe - Also copy the files that stay in the package, such as stores, as unsafe copies.
9
+ */
10
+ export interface AfterInstallOptions {
11
+ install: boolean;
12
+ includeUnsafe: boolean;
13
+ }
14
+ /**
15
+ * @brief Hook for `add` and `update` that runs once a manifest is saved: records the fields of the
16
+ * shadcn components just fetched, then, for every component just installed or updated, checks its npm
17
+ * packages against the app's `package.json`, adds its theme tokens to the app's stylesheet, and with
18
+ * `includeUnsafe` copies the files it keeps in its package.
19
+ *
20
+ * @param project - The opened project, whose settings name the stylesheet.
21
+ * @param fetchedByKey - Fields per shadcn component key, filled while the files are fetched.
22
+ * @param options - Install and include-unsafe flags.
23
+ * @returns The hook to pass to `addFromSources` or `updateFromSources`.
24
+ */
25
+ export declare function afterComponentInstall(project: UiProject, fetchedByKey: ReadonlyMap<string, FetchedComponentFields>, options: AfterInstallOptions): AfterTarget;
26
+ //# sourceMappingURL=afterInstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"afterInstall.d.ts","sourceRoot":"","sources":["../../src/cli/afterInstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AAGtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAwB3C;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAQ,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAAE,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAc9J"}
@@ -0,0 +1,54 @@
1
+ import { installedEntries, saveInstallManifest } from "@g3nomaly/core/installer";
2
+ import { register } from "@g3nomaly/core/registry";
3
+ import { ComponentMetaSchema } from "../registry/types";
4
+ import { reportNpmDependencies } from "./npmDependencies";
5
+ import { copyPackageFiles } from "./packageFiles";
6
+ import { applyThemeTokens } from "./themeTokens";
7
+ /**
8
+ * @brief Writes what was fetched with shadcn components, their npm packages and theme tokens, into
9
+ * their manifest entries, since the shadcn index lacks both and the entries were recorded without them.
10
+ *
11
+ * @param target - Target whose manifest holds the entries.
12
+ * @param fetchedByKey - Fields per shadcn component key, as fetched during the install.
13
+ */
14
+ function recordFetchedFields(target, fetchedByKey) {
15
+ const installed = installedEntries(target.manifest, ComponentMetaSchema);
16
+ let changed = false;
17
+ for (const [key, fields] of fetchedByKey) {
18
+ const entry = installed[key];
19
+ if (entry === undefined)
20
+ continue;
21
+ register(target.manifest.store, key, { ...entry, ...fields });
22
+ changed = true;
23
+ }
24
+ if (changed)
25
+ saveInstallManifest(target.manifest, ComponentMetaSchema);
26
+ }
27
+ /**
28
+ * @brief Hook for `add` and `update` that runs once a manifest is saved: records the fields of the
29
+ * shadcn components just fetched, then, for every component just installed or updated, checks its npm
30
+ * packages against the app's `package.json`, adds its theme tokens to the app's stylesheet, and with
31
+ * `includeUnsafe` copies the files it keeps in its package.
32
+ *
33
+ * @param project - The opened project, whose settings name the stylesheet.
34
+ * @param fetchedByKey - Fields per shadcn component key, filled while the files are fetched.
35
+ * @param options - Install and include-unsafe flags.
36
+ * @returns The hook to pass to `addFromSources` or `updateFromSources`.
37
+ */
38
+ export function afterComponentInstall(project, fetchedByKey, options) {
39
+ return async (target, keys) => {
40
+ recordFetchedFields(target, fetchedByKey);
41
+ const installed = installedEntries(target.manifest, ComponentMetaSchema);
42
+ const touched = {};
43
+ for (const key of keys) {
44
+ const entry = installed[key];
45
+ if (entry !== undefined)
46
+ touched[key] = entry;
47
+ }
48
+ if (options.includeUnsafe)
49
+ copyPackageFiles(project, target, touched);
50
+ await reportNpmDependencies(project.projectRoot, touched, options.install);
51
+ applyThemeTokens(project.projectRoot, project.config.ui.settings.cssFile, touched);
52
+ };
53
+ }
54
+ //# sourceMappingURL=afterInstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"afterInstall.js","sourceRoot":"","sources":["../../src/cli/afterInstall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,MAAsB,EAAE,YAAyD;IAC5G,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;IACzE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAC9D,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,IAAI,OAAO;QAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACzE,CAAC;AAaD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAkB,EAAE,YAAyD,EAAE,OAA4B;IAC/I,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC5B,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QACzE,MAAM,OAAO,GAAkC,EAAE,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAChD,CAAC;QAED,IAAI,OAAO,CAAC,aAAa;YAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtE,MAAM,qBAAqB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3E,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC,CAAC;AACJ,CAAC"}
@@ -5,19 +5,25 @@ import type { ProjectDeps } from "../adapter";
5
5
  *
6
6
  * @property debug - Install `.debug.ts` files; the project setting when absent.
7
7
  * @property meta - Install `.meta.ts` files; the project setting when absent.
8
+ * @property install - Add the npm packages the components need with `bun add`, instead of only reporting them.
9
+ * @property includeUnsafe - Also copy the files the components keep in their package, such as stores, as unsafe copies they do not import.
8
10
  */
9
11
  export interface AddOptions extends InstallOptions {
10
12
  debug?: boolean;
11
13
  meta?: boolean;
14
+ install?: boolean;
15
+ includeUnsafe?: boolean;
12
16
  }
13
17
  /**
14
18
  * @brief Installs components or whole groups from the registered sources, each with
15
19
  * the components it depends on, keeping locally modified files. A name more
16
20
  * than one source offers is picked as `<name>@<source>`; with no names the
17
- * user picks from what the sources offer.
21
+ * user picks from what the sources offer. npm packages the components need and
22
+ * the app lacks are reported afterwards, or added with `install`, and their
23
+ * theme tokens are added to the app's stylesheet.
18
24
  *
19
25
  * @param names - Component keys or groups to install, e.g. `button`; empty to pick from the sources.
20
- * @param options - Force, debug and meta flags.
26
+ * @param options - Force, debug, meta, install and include-unsafe flags.
21
27
  * @param deps - Test injection.
22
28
  */
23
29
  export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAG,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjH"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;;;;GAOG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAU,OAAO,CAAC;IACxB,IAAI,CAAC,EAAW,OAAO,CAAC;IACxB,OAAO,CAAC,EAAQ,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAUjH"}
@@ -1,21 +1,26 @@
1
1
  // packages/ui/src/cli/commands/add.ts
2
2
  import { addFromSources } from "@g3nomaly/core/cli";
3
- import { UI_CONTEXT, fileFlags, openComponentRegistry, openUiProject } from "../adapter";
3
+ import { fileFlags, openComponentRegistry, openUiProject, uiInstallContext } from "../adapter";
4
+ import { afterComponentInstall } from "../afterInstall";
4
5
  /**
5
6
  * @brief Installs components or whole groups from the registered sources, each with
6
7
  * the components it depends on, keeping locally modified files. A name more
7
8
  * than one source offers is picked as `<name>@<source>`; with no names the
8
- * user picks from what the sources offer.
9
+ * user picks from what the sources offer. npm packages the components need and
10
+ * the app lacks are reported afterwards, or added with `install`, and their
11
+ * theme tokens are added to the app's stylesheet.
9
12
  *
10
13
  * @param names - Component keys or groups to install, e.g. `button`; empty to pick from the sources.
11
- * @param options - Force, debug and meta flags.
14
+ * @param options - Force, debug, meta, install and include-unsafe flags.
12
15
  * @param deps - Test injection.
13
16
  */
14
17
  export async function addCommand(names, options = {}, deps = {}) {
15
18
  const project = await openUiProject(deps);
16
- const registry = await openComponentRegistry(project, fileFlags(project, options));
19
+ const registry = await openComponentRegistry(project, fileFlags(project, options), { packLocal: true });
20
+ const fetchedByKey = new Map();
17
21
  try {
18
- await addFromSources([project.target], names, registry, options, UI_CONTEXT);
22
+ const check = afterComponentInstall(project, fetchedByKey, { install: options.install === true, includeUnsafe: options.includeUnsafe === true });
23
+ await addFromSources([project.target], names, registry, options, uiInstallContext(fetchedByKey), check);
19
24
  }
20
25
  finally {
21
26
  registry.dispose();
@@ -1 +1 @@
1
- {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAczF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,OAAO,GAAI,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAiBxD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,OAAO,GAAI,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxG,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC,CAAC;QACjJ,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1G,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -10,6 +10,7 @@ export { lsCommand } from "./ls";
10
10
  export type { LsOptions } from "./ls";
11
11
  export { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./source";
12
12
  export type { SourceAddOptions } from "./source";
13
+ export { sourceInitCommand } from "./sourceInit";
13
14
  export { manifestCommand } from "./manifest";
14
15
  export type { ManifestDeps } from "./manifest";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC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AAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -5,5 +5,6 @@ export { removeCommand } from "./remove";
5
5
  export { updateCommand } from "./update";
6
6
  export { lsCommand } from "./ls";
7
7
  export { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./source";
8
+ export { sourceInitCommand } from "./sourceInit";
8
9
  export { manifestCommand } from "./manifest";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}