@g3nomaly/ui 0.3.1 → 0.3.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.
- package/README.md +123 -0
- package/dist/cli/adapter.d.ts +48 -10
- package/dist/cli/adapter.d.ts.map +1 -1
- package/dist/cli/adapter.js +34 -7
- package/dist/cli/adapter.js.map +1 -1
- package/dist/cli/commands/add.d.ts +11 -3
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +5 -1
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/init.d.ts +25 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +23 -4
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +12 -3
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +6 -1
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/manifest.d.ts +8 -1
- package/dist/cli/commands/manifest.d.ts.map +1 -1
- package/dist/cli/commands/manifest.js +15 -3
- package/dist/cli/commands/manifest.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +6 -1
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +5 -1
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/source.d.ts +24 -5
- package/dist/cli/commands/source.d.ts.map +1 -1
- package/dist/cli/commands/source.js +18 -3
- package/dist/cli/commands/source.js.map +1 -1
- package/dist/cli/commands/update.d.ts +6 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +5 -1
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/components/basic/Card.debug.ts +1 -1
- package/dist/components/basic/Card.tsx +8 -3
- package/dist/components/basic/CardFooter.debug.ts +1 -1
- package/dist/components/basic/CardFooter.tsx +7 -3
- package/dist/components/basic/CardHeader.debug.ts +1 -1
- package/dist/components/basic/CardHeader.tsx +7 -3
- package/dist/components/basic/card.meta.ts +1 -0
- package/dist/components/basic/cardfooter.meta.ts +1 -0
- package/dist/components/basic/cardheader.meta.ts +1 -0
- package/dist/components/input/Button.debug.ts +1 -1
- package/dist/components/input/Button.tsx +6 -3
- package/dist/components/input/button.meta.ts +1 -0
- package/dist/components.json +32 -32
- package/dist/registry/adapters/shadcn.adapter.d.ts +14 -8
- package/dist/registry/adapters/shadcn.adapter.d.ts.map +1 -1
- package/dist/registry/adapters/shadcn.adapter.js +23 -7
- package/dist/registry/adapters/shadcn.adapter.js.map +1 -1
- package/dist/registry/componentsJson.d.ts +6 -5
- package/dist/registry/componentsJson.d.ts.map +1 -1
- package/dist/registry/componentsJson.js +6 -5
- package/dist/registry/componentsJson.js.map +1 -1
- package/dist/registry/manifest.d.ts +5 -3
- package/dist/registry/manifest.d.ts.map +1 -1
- package/dist/registry/manifest.js +17 -5
- package/dist/registry/manifest.js.map +1 -1
- package/dist/registry/readSource.d.ts +23 -6
- package/dist/registry/readSource.d.ts.map +1 -1
- package/dist/registry/readSource.js +17 -3
- package/dist/registry/readSource.js.map +1 -1
- package/dist/registry/types.d.ts +16 -4
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +10 -6
- package/dist/registry/types.js.map +1 -1
- package/dist/sources/builtins.d.ts +1 -1
- package/dist/sources/builtins.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @g3nomaly/ui
|
|
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.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
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.
|
|
10
|
+
|
|
11
|
+
For shadcn components you also need:
|
|
12
|
+
|
|
13
|
+
- the `shadcn` package next to `@g3nomaly/ui` in your project: `bun add -d @g3nomaly/ui shadcn@latest`
|
|
14
|
+
- Tailwind CSS, because shadcn components are styled with Tailwind classes
|
|
15
|
+
- network access, since `g3nui` reads the component list from `ui.shadcn.com`
|
|
16
|
+
|
|
17
|
+
No `components.json` is needed. `g3nui` keeps its own config.
|
|
18
|
+
|
|
19
|
+
## Install components
|
|
20
|
+
|
|
21
|
+
Run these from the root of your project:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
bunx @g3nomaly/ui init # writes .g3n.config.json and asks where components go
|
|
25
|
+
bunx @g3nomaly/ui ls # lists the components you can install
|
|
26
|
+
bunx @g3nomaly/ui add button # installs one component
|
|
27
|
+
bunx @g3nomaly/ui add basic # or every component in the basic group
|
|
28
|
+
bunx @g3nomaly/ui add # or pick from a list
|
|
29
|
+
```
|
|
30
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
37
|
+
## The g3n components
|
|
38
|
+
|
|
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` |
|
|
45
|
+
|
|
46
|
+
The CSS of every component sits under the `.g3nui` class, so it does not leak into the rest of your styles.
|
|
47
|
+
|
|
48
|
+
## shadcn components
|
|
49
|
+
|
|
50
|
+
shadcn is off until you turn it on. Add `"shadcn"` to `registeredPackages` in `.g3n.config.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"g3nui": {
|
|
55
|
+
"settings": {
|
|
56
|
+
"registeredPackages": ["shadcn"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
shadcn components then show up in `ls` with an `@shadcn/` prefix:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
bunx @g3nomaly/ui ls --source shadcn
|
|
66
|
+
bunx @g3nomaly/ui add @shadcn/button @shadcn/dialog
|
|
67
|
+
```
|
|
68
|
+
|
|
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`.
|
|
70
|
+
|
|
71
|
+
## Keep components up to date
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
bunx @g3nomaly/ui update # every installed component
|
|
75
|
+
bunx @g3nomaly/ui update button # one component
|
|
76
|
+
bunx @g3nomaly/ui update --dry-run # shows what would change
|
|
77
|
+
bunx @g3nomaly/ui remove cardheader
|
|
78
|
+
bunx @g3nomaly/ui ls --installed
|
|
79
|
+
```
|
|
80
|
+
|
|
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.
|
|
82
|
+
|
|
83
|
+
`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
|
+
|
|
85
|
+
If the manifest is lost or out of date, `manifest` scans the install directory and records every component it finds there that a source offers:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
bunx @g3nomaly/ui manifest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Other sources
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
bunx @g3nomaly/ui source add owner/repo # a GitHub repository
|
|
95
|
+
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
|
|
97
|
+
bunx @g3nomaly/ui source add ./my-components --name mine # a local folder
|
|
98
|
+
bunx @g3nomaly/ui source ls
|
|
99
|
+
bunx @g3nomaly/ui add card@mine # a component from one source
|
|
100
|
+
bunx @g3nomaly/ui source remove mine
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The built-in `g3nui` source cannot be removed. `source remove` also refuses a source that installed components came from, unless you pass `-f`.
|
|
104
|
+
|
|
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.
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
Run `bun install` at the repository root first, then every command from this directory.
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
bun run g3nui -- ls # the CLI from source
|
|
113
|
+
bun run typecheck
|
|
114
|
+
bun run lint
|
|
115
|
+
bun test tests/unit
|
|
116
|
+
bun run build # types, components and dist/components.json into dist/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`@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).
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
Elastic License 2.0. The full text is in the `LICENSE` file of this package.
|
package/dist/cli/adapter.d.ts
CHANGED
|
@@ -5,13 +5,24 @@ import type { SourceRegistry } from "@g3nomaly/core/installer";
|
|
|
5
5
|
import type { RegisteredSource, SourceRecord } from "@g3nomaly/core/sources";
|
|
6
6
|
import type { ComponentFileFlags } from "../registry/readSource";
|
|
7
7
|
import type { ComponentMeta, ComponentRegistry } from "../registry/types";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @brief Injection points for tests; the real project root comes from git discovery, the components from this package.
|
|
10
|
+
*
|
|
11
|
+
* @property resolveProjectRoot - Replaces git discovery, e.g. `() => "/tmp/project"`.
|
|
12
|
+
* @property builtins - Built-in sources in place of this package's own folder.
|
|
13
|
+
*/
|
|
9
14
|
export interface ProjectDeps {
|
|
10
15
|
resolveProjectRoot?: typeof resolveProjectRoot;
|
|
11
|
-
/** Built-in sources in place of this package's own folder */
|
|
12
16
|
builtins?: SourceRecord;
|
|
13
17
|
}
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @brief A project opened for a g3nui command: its root, config, the one install target and the built-in sources.
|
|
20
|
+
*
|
|
21
|
+
* @property projectRoot - Absolute project root.
|
|
22
|
+
* @property config - Loaded g3n config.
|
|
23
|
+
* @property target - The install target of the components, whose manifest records what is installed.
|
|
24
|
+
* @property builtins - Built-in sources.
|
|
25
|
+
*/
|
|
15
26
|
export interface UiProject {
|
|
16
27
|
projectRoot: string;
|
|
17
28
|
config: G3nConfig;
|
|
@@ -21,28 +32,55 @@ export interface UiProject {
|
|
|
21
32
|
/** What the core install commands print, check and fetch for components. */
|
|
22
33
|
export declare const UI_CONTEXT: InstallCommandContext<ComponentMeta>;
|
|
23
34
|
/**
|
|
24
|
-
* Anchors the command to the git project, loads its config, migrates a
|
|
35
|
+
* @brief Anchors the command to the git project, loads its config, migrates a
|
|
25
36
|
* manifest from before the shared shape, and opens the manifest; exits when
|
|
26
37
|
* outside a repo or when the manifest cannot be read.
|
|
38
|
+
*
|
|
39
|
+
* @param deps - Test injection.
|
|
40
|
+
* @returns The opened project.
|
|
27
41
|
*/
|
|
28
42
|
export declare function openUiProject(deps?: ProjectDeps): Promise<UiProject>;
|
|
29
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* @brief Built-in sources plus those registered in the project's manifest.
|
|
45
|
+
*
|
|
46
|
+
* @param project - The opened project.
|
|
47
|
+
* @returns The sources, built-in ones first.
|
|
48
|
+
*/
|
|
30
49
|
export declare function uiSources(project: UiProject): RegisteredSource[];
|
|
31
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @brief Installed components of the project.
|
|
52
|
+
*
|
|
53
|
+
* @param project - The opened project.
|
|
54
|
+
* @returns The installed components keyed by component key.
|
|
55
|
+
*/
|
|
32
56
|
export declare function installedComponents(project: UiProject): ComponentRegistry;
|
|
33
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* @brief Optional files to install: the command's flags, else the project's settings.
|
|
59
|
+
*
|
|
60
|
+
* @param project - The opened project, whose settings are the fallback.
|
|
61
|
+
* @param options - `debug` and `meta` flags of the command; an absent one falls back to the setting.
|
|
62
|
+
* @returns Which optional file kinds to include.
|
|
63
|
+
*/
|
|
34
64
|
export declare function fileFlags(project: UiProject, options?: {
|
|
35
65
|
debug?: boolean;
|
|
36
66
|
meta?: boolean;
|
|
37
67
|
}): ComponentFileFlags;
|
|
38
68
|
/**
|
|
39
|
-
* Reads the components of the project's sources, plus shadcn's when it is in
|
|
69
|
+
* @brief Reads the components of the project's sources, plus shadcn's when it is in
|
|
40
70
|
* `g3nui.settings.registeredPackages`, and prints what could not be read;
|
|
41
71
|
* the caller disposes the result.
|
|
42
72
|
*
|
|
43
|
-
* @param
|
|
73
|
+
* @param project - The opened project.
|
|
74
|
+
* @param flags - Which optional file kinds to read.
|
|
75
|
+
* @param only - Source name to read alone; exits when no such source is registered.
|
|
76
|
+
* @returns The components per source; dispose it once read.
|
|
44
77
|
*/
|
|
45
78
|
export declare function openComponentRegistry(project: UiProject, flags: ComponentFileFlags, only?: string): Promise<SourceRegistry<ComponentMeta>>;
|
|
46
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* @brief What the core source commands need to know about components in one project.
|
|
81
|
+
*
|
|
82
|
+
* @param project - The opened project.
|
|
83
|
+
* @returns The component context with the built-in sources and the component reader.
|
|
84
|
+
*/
|
|
47
85
|
export declare function uiSourceContext(project: UiProject): SourceCommandContext<ComponentMeta>;
|
|
48
86
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -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,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E
|
|
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,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0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ED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAEvF"}
|
package/dist/cli/adapter.js
CHANGED
|
@@ -17,9 +17,12 @@ export const UI_CONTEXT = {
|
|
|
17
17
|
fileSource: (registry) => shadcnFileSource(entrySource(registry)),
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Anchors the command to the git project, loads its config, migrates a
|
|
20
|
+
* @brief Anchors the command to the git project, loads its config, migrates a
|
|
21
21
|
* manifest from before the shared shape, and opens the manifest; exits when
|
|
22
22
|
* outside a repo or when the manifest cannot be read.
|
|
23
|
+
*
|
|
24
|
+
* @param deps - Test injection.
|
|
25
|
+
* @returns The opened project.
|
|
23
26
|
*/
|
|
24
27
|
export async function openUiProject(deps = {}) {
|
|
25
28
|
const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
|
|
@@ -39,15 +42,31 @@ export async function openUiProject(deps = {}) {
|
|
|
39
42
|
builtins: deps.builtins ?? BUILTIN_SOURCES,
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @brief Built-in sources plus those registered in the project's manifest.
|
|
47
|
+
*
|
|
48
|
+
* @param project - The opened project.
|
|
49
|
+
* @returns The sources, built-in ones first.
|
|
50
|
+
*/
|
|
43
51
|
export function uiSources(project) {
|
|
44
52
|
return manifestSources([project.target.manifest], project.builtins);
|
|
45
53
|
}
|
|
46
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @brief Installed components of the project.
|
|
56
|
+
*
|
|
57
|
+
* @param project - The opened project.
|
|
58
|
+
* @returns The installed components keyed by component key.
|
|
59
|
+
*/
|
|
47
60
|
export function installedComponents(project) {
|
|
48
61
|
return installedEntries(project.target.manifest, ComponentMetaSchema);
|
|
49
62
|
}
|
|
50
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* @brief Optional files to install: the command's flags, else the project's settings.
|
|
65
|
+
*
|
|
66
|
+
* @param project - The opened project, whose settings are the fallback.
|
|
67
|
+
* @param options - `debug` and `meta` flags of the command; an absent one falls back to the setting.
|
|
68
|
+
* @returns Which optional file kinds to include.
|
|
69
|
+
*/
|
|
51
70
|
export function fileFlags(project, options = {}) {
|
|
52
71
|
return {
|
|
53
72
|
includeDebug: options.debug ?? project.config.g3nui.settings.includeDebugFiles,
|
|
@@ -55,11 +74,14 @@ export function fileFlags(project, options = {}) {
|
|
|
55
74
|
};
|
|
56
75
|
}
|
|
57
76
|
/**
|
|
58
|
-
* Reads the components of the project's sources, plus shadcn's when it is in
|
|
77
|
+
* @brief Reads the components of the project's sources, plus shadcn's when it is in
|
|
59
78
|
* `g3nui.settings.registeredPackages`, and prints what could not be read;
|
|
60
79
|
* the caller disposes the result.
|
|
61
80
|
*
|
|
62
|
-
* @param
|
|
81
|
+
* @param project - The opened project.
|
|
82
|
+
* @param flags - Which optional file kinds to read.
|
|
83
|
+
* @param only - Source name to read alone; exits when no such source is registered.
|
|
84
|
+
* @returns The components per source; dispose it once read.
|
|
63
85
|
*/
|
|
64
86
|
export async function openComponentRegistry(project, flags, only) {
|
|
65
87
|
const packages = project.config.g3nui.settings.registeredPackages;
|
|
@@ -80,7 +102,12 @@ export async function openComponentRegistry(project, flags, only) {
|
|
|
80
102
|
reportSourceRegistry(registry);
|
|
81
103
|
return registry;
|
|
82
104
|
}
|
|
83
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* @brief What the core source commands need to know about components in one project.
|
|
107
|
+
*
|
|
108
|
+
* @param project - The opened project.
|
|
109
|
+
* @returns The component context with the built-in sources and the component reader.
|
|
110
|
+
*/
|
|
84
111
|
export function uiSourceContext(project) {
|
|
85
112
|
return { ...UI_CONTEXT, builtins: project.builtins, readSource: readComponentSource(fileFlags(project)), projectRoot: project.projectRoot };
|
|
86
113
|
}
|
package/dist/cli/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter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AI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC;QAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,6BAA6B,IAAI,YAAY,CAAC,CAAC;IAEtI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkB;IAChD,OAAO,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;AAC9I,CAAC"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
2
|
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Options of `addCommand`, on top of the core install options.
|
|
5
|
+
*
|
|
6
|
+
* @property debug - Install `.debug.ts` files; the project setting when absent.
|
|
7
|
+
* @property meta - Install `.meta.ts` files; the project setting when absent.
|
|
8
|
+
*/
|
|
3
9
|
export interface AddOptions extends InstallOptions {
|
|
4
|
-
/** Install `.debug.ts` files; the project setting when absent */
|
|
5
10
|
debug?: boolean;
|
|
6
|
-
/** Install `.meta.ts` files; the project setting when absent */
|
|
7
11
|
meta?: boolean;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
|
-
* Installs components or whole groups from the registered sources, each with
|
|
14
|
+
* @brief Installs components or whole groups from the registered sources, each with
|
|
11
15
|
* the components it depends on, keeping locally modified files. A name more
|
|
12
16
|
* than one source offers is picked as `<name>@<source>`; with no names the
|
|
13
17
|
* user picks from what the sources offer.
|
|
18
|
+
*
|
|
19
|
+
* @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.
|
|
21
|
+
* @param deps - Test injection.
|
|
14
22
|
*/
|
|
15
23
|
export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
|
|
16
24
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -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,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,
|
|
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"}
|
package/dist/cli/commands/add.js
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
import { addFromSources } from "@g3nomaly/core/cli";
|
|
3
3
|
import { UI_CONTEXT, fileFlags, openComponentRegistry, openUiProject } from "../adapter";
|
|
4
4
|
/**
|
|
5
|
-
* Installs components or whole groups from the registered sources, each with
|
|
5
|
+
* @brief Installs components or whole groups from the registered sources, each with
|
|
6
6
|
* the components it depends on, keeping locally modified files. A name more
|
|
7
7
|
* than one source offers is picked as `<name>@<source>`; with no names the
|
|
8
8
|
* user picks from what the sources offer.
|
|
9
|
+
*
|
|
10
|
+
* @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.
|
|
12
|
+
* @param deps - Test injection.
|
|
9
13
|
*/
|
|
10
14
|
export async function addCommand(names, options = {}, deps = {}) {
|
|
11
15
|
const project = await openUiProject(deps);
|
|
@@ -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;
|
|
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"}
|
|
@@ -2,10 +2,16 @@ import { z } from "zod";
|
|
|
2
2
|
import type { G3nuiSettings } from "@g3nomaly/core/config";
|
|
3
3
|
import type { Dialogue, DialogueAnswers } from "@g3nomaly/core/cli";
|
|
4
4
|
import type { ProjectDeps } from "../adapter";
|
|
5
|
+
/**
|
|
6
|
+
* @brief Options of `initCommand`; an install dir preset skips the prompts.
|
|
7
|
+
*
|
|
8
|
+
* @property force - Reconfigure without asking when a config already exists.
|
|
9
|
+
* @property installDir - Components install directory; skips the directory prompt when given.
|
|
10
|
+
* @property answers - Preset dialogue answers by step id; skips the terminal prompt.
|
|
11
|
+
*/
|
|
5
12
|
export interface InitOptions {
|
|
6
13
|
force?: boolean;
|
|
7
14
|
installDir?: string;
|
|
8
|
-
/** Preset dialogue answers by step id; skips the terminal prompt. */
|
|
9
15
|
answers?: DialogueAnswers;
|
|
10
16
|
}
|
|
11
17
|
declare const UiInitAnswersSchema: z.ZodObject<{
|
|
@@ -13,13 +19,30 @@ declare const UiInitAnswersSchema: z.ZodObject<{
|
|
|
13
19
|
includeDebugFiles: z.ZodBoolean;
|
|
14
20
|
includeMetaFiles: z.ZodBoolean;
|
|
15
21
|
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* @brief Answers of the init dialogue, parsed into the g3nui settings.
|
|
24
|
+
*
|
|
25
|
+
* @property componentsDir - Install directory, relative to the project root, e.g. `src/components`.
|
|
26
|
+
* @property includeDebugFiles - Whether `.debug.ts` files are installed with components.
|
|
27
|
+
* @property includeMetaFiles - Whether `.meta.ts` files are installed with components.
|
|
28
|
+
*/
|
|
16
29
|
export type UiInitAnswers = z.infer<typeof UiInitAnswersSchema>;
|
|
30
|
+
/**
|
|
31
|
+
* @brief Input of the init dialogue: the settings its steps start from.
|
|
32
|
+
*
|
|
33
|
+
* @property settings - Current g3nui settings, the initial value of each step.
|
|
34
|
+
*/
|
|
17
35
|
interface UiInitInput extends Record<string, unknown> {
|
|
18
36
|
settings: G3nuiSettings;
|
|
19
37
|
}
|
|
20
38
|
export declare const orphanDialogue: Dialogue;
|
|
21
39
|
export declare const initDialogue: Dialogue<UiInitInput>;
|
|
22
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @brief Initializes the g3nui config in this project.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Force flag, install dir and preset answers.
|
|
44
|
+
* @param deps - Test injection.
|
|
45
|
+
*/
|
|
23
46
|
export declare function initCommand(options?: InitOptions, deps?: ProjectDeps): Promise<void>;
|
|
24
47
|
export {};
|
|
25
48
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAO,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAO,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,QAAA,MAAM,mBAAmB;;;;iBAIvB,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,UAAU,WAAY,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,QAAQ,EAAE,aAAa,CAAC;CACzB;AAYD,eAAO,MAAM,cAAc,EAAE,QAQ5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC;AAuCF;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyElG"}
|
|
@@ -55,11 +55,20 @@ export const initDialogue = {
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @brief `true` in green or `false` dimmed, for the settings summary.
|
|
60
|
+
*
|
|
61
|
+
* @param v - The flag to label.
|
|
62
|
+
* @returns The colored label.
|
|
63
|
+
*/
|
|
59
64
|
function boolLabel(v) {
|
|
60
65
|
return v ? chalk.green("true") : chalk.dim("false");
|
|
61
66
|
}
|
|
62
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* @brief One printed line per g3nui setting.
|
|
69
|
+
*
|
|
70
|
+
* @param answers - The settings to print.
|
|
71
|
+
*/
|
|
63
72
|
function settingsLines(answers) {
|
|
64
73
|
return [
|
|
65
74
|
` componentsDir: ${c.dir(answers.componentsDir)}`,
|
|
@@ -67,7 +76,12 @@ function settingsLines(answers) {
|
|
|
67
76
|
` includeMetaFiles: ${boolLabel(answers.includeMetaFiles)}`,
|
|
68
77
|
];
|
|
69
78
|
}
|
|
70
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* @brief The init answers that keep the current settings.
|
|
81
|
+
*
|
|
82
|
+
* @param settings - The current g3nui settings.
|
|
83
|
+
* @returns Answers equal to the current settings.
|
|
84
|
+
*/
|
|
71
85
|
function currentAnswers(settings) {
|
|
72
86
|
return {
|
|
73
87
|
componentsDir: settings.componentsDir,
|
|
@@ -75,7 +89,12 @@ function currentAnswers(settings) {
|
|
|
75
89
|
includeMetaFiles: settings.includeMetaFiles,
|
|
76
90
|
};
|
|
77
91
|
}
|
|
78
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @brief Initializes the g3nui config in this project.
|
|
94
|
+
*
|
|
95
|
+
* @param options - Force flag, install dir and preset answers.
|
|
96
|
+
* @param deps - Test injection.
|
|
97
|
+
*/
|
|
79
98
|
export async function initCommand(options = {}, deps = {}) {
|
|
80
99
|
p.intro(chalk.bold.cyan("g3nui init"));
|
|
81
100
|
const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,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C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAElE,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { LSOptions } from "@g3nomaly/core/cli";
|
|
2
2
|
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Options of `lsCommand`, on top of the core list options.
|
|
5
|
+
*
|
|
6
|
+
* @property installed - List what the manifest records instead of what the sources offer.
|
|
7
|
+
* @property source - Only the components of this source, e.g. `g3nui`.
|
|
8
|
+
*/
|
|
3
9
|
export interface LsOptions extends LSOptions {
|
|
4
|
-
/** List what the manifest records instead of what the sources offer */
|
|
5
10
|
installed?: boolean;
|
|
6
|
-
/** Only the components of this source */
|
|
7
11
|
source?: string;
|
|
8
12
|
}
|
|
9
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @brief Lists the components the sources offer, `●` marking installed ones, or with `installed` only what is installed.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Output and filter options.
|
|
17
|
+
* @param deps - Test injection.
|
|
18
|
+
*/
|
|
10
19
|
export declare function lsCommand(options?: LsOptions, deps?: ProjectDeps): Promise<void>;
|
|
11
20
|
//# sourceMappingURL=ls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAK,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9F"}
|
package/dist/cli/commands/ls.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// packages/ui/src/cli/commands/ls.ts
|
|
2
2
|
import { lsEntries, lsSourceRegistry } from "@g3nomaly/core/cli";
|
|
3
3
|
import { fileFlags, installedComponents, openComponentRegistry, openUiProject, uiSources } from "../adapter";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @brief Lists the components the sources offer, `●` marking installed ones, or with `installed` only what is installed.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Output and filter options.
|
|
8
|
+
* @param deps - Test injection.
|
|
9
|
+
*/
|
|
5
10
|
export async function lsCommand(options = {}, deps = {}) {
|
|
6
11
|
const project = await openUiProject(deps);
|
|
7
12
|
const installed = installedComponents(project);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAc7G;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAO,GAAc,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC7E,MAAM,OAAO,GAAK,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAC/B,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1F,IAAI,CAAC;QACH,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { glob as _glob } from "glob";
|
|
2
2
|
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Injection points for `manifestCommand`, on top of the project ones.
|
|
5
|
+
*
|
|
6
|
+
* @property glob - Glob used to list the install directory, in place of the `glob` package.
|
|
7
|
+
*/
|
|
3
8
|
export interface ManifestDeps extends ProjectDeps {
|
|
4
9
|
glob?: typeof _glob;
|
|
5
10
|
}
|
|
6
11
|
/**
|
|
7
|
-
* Scans the install directory and rebuilds the manifest from what is on
|
|
12
|
+
* @brief Scans the install directory and rebuilds the manifest from what is on
|
|
8
13
|
* disk: every component the sources offer with at least one file present is
|
|
9
14
|
* recorded, the first source offering a key winning.
|
|
15
|
+
*
|
|
16
|
+
* @param deps - Test injection, including the glob.
|
|
10
17
|
*/
|
|
11
18
|
export declare function manifestCommand(deps?: ManifestDeps): Promise<void>;
|
|
12
19
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,MAAM,CAAC;AAQrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,MAAM,CAAC;AAQrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB;AAqCD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqE5E"}
|
|
@@ -9,18 +9,30 @@ import { hashFile } from "@g3nomaly/core/hash";
|
|
|
9
9
|
import { c, sym, lineError } from "@g3nomaly/core/cli";
|
|
10
10
|
import { ComponentMetaSchema } from "../../registry/types";
|
|
11
11
|
import { fileFlags, openComponentRegistry, openUiProject } from "../adapter";
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @brief A path with forward slashes only.
|
|
14
|
+
*
|
|
15
|
+
* @param p - Path with any separators.
|
|
16
|
+
* @returns The same path with `/` separators.
|
|
17
|
+
*/
|
|
13
18
|
function normalisePath(p) {
|
|
14
19
|
return p.replace(/\\/g, "/");
|
|
15
20
|
}
|
|
16
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @brief Whether a file found on disk is the registry file, compared by path ending.
|
|
23
|
+
*
|
|
24
|
+
* @param diskPath - Path found by the disk scan, relative to the install directory.
|
|
25
|
+
* @param registryPath - Path recorded in the registry, relative to the install directory.
|
|
26
|
+
*/
|
|
17
27
|
function matchesRegistryPath(diskPath, registryPath) {
|
|
18
28
|
return normalisePath(diskPath).endsWith(normalisePath(registryPath));
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
|
-
* Scans the install directory and rebuilds the manifest from what is on
|
|
31
|
+
* @brief Scans the install directory and rebuilds the manifest from what is on
|
|
22
32
|
* disk: every component the sources offer with at least one file present is
|
|
23
33
|
* recorded, the first source offering a key winning.
|
|
34
|
+
*
|
|
35
|
+
* @param deps - Test injection, including the glob.
|
|
24
36
|
*/
|
|
25
37
|
export async function manifestCommand(deps = {}) {
|
|
26
38
|
const { glob = _glob } = deps;
|