@konce-pt/ui 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -7
- package/dist/commands/init.js +14 -2
- package/dist/config.js +0 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,20 +16,46 @@ npx @konce-pt/ui add nip-lookup-field
|
|
|
16
16
|
|
|
17
17
|
| Komenda | Opis |
|
|
18
18
|
|---|---|
|
|
19
|
-
| `init` | Tworzy `konce.json` (`--registry --blocks-dir --alias --prefix --
|
|
19
|
+
| `init` | Tworzy `konce.json` (`--registry --blocks-dir --alias --prefix --force`) |
|
|
20
20
|
| `add <nazwa...>` | Instaluje blok(i) + zależności registry (`--overwrite --dry-run --path --registry`) |
|
|
21
|
-
| `list [--category=...]` | Lista dostępnych bloków |
|
|
21
|
+
| `list [--category=...]` | Lista dostępnych bloków (`--category --registry`); kategorie: `forms`, `forms-pl` |
|
|
22
|
+
|
|
23
|
+
Flagi przyjmują wartość wyłącznie jako `--klucz=wartość` (np. `--registry=https://ui.konce.pt/cli/`).
|
|
24
|
+
Wartość po spacji parser czyta jako osobny argument - w `add` zostałaby wzięta za nazwę bloku.
|
|
25
|
+
|
|
26
|
+
Po instalacji paczki (globalnie albo w devDependencies) ten sam CLI jest dostępny jako `konce`.
|
|
27
|
+
|
|
28
|
+
## `konce.json`
|
|
29
|
+
|
|
30
|
+
Domyślnie `init` zapisuje:
|
|
31
|
+
|
|
32
|
+
| Pole | Domyślnie |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `registry` | `https://ui.konce.pt/cli` ([spis bloków](https://ui.konce.pt/cli/)) |
|
|
35
|
+
| `blocksDir` | `src/app/shared/blocks` |
|
|
36
|
+
| `alias` | `@shared/blocks` |
|
|
37
|
+
| `prefix` | `kpt` |
|
|
38
|
+
|
|
39
|
+
Alias musisz sam zmapować w `tsconfig.json` -> `compilerOptions.paths`, np.
|
|
40
|
+
`"@shared/blocks/*": ["src/app/shared/blocks/*"]` - bloki importują się nawzajem przez alias
|
|
41
|
+
i bez tego wpisu się nie skompilują. `init` tsconfiga nie przepisuje (bywa z komentarzami), ale gdy
|
|
42
|
+
wpisu brakuje, wypisuje dokładnie ten, który trzeba dodać.
|
|
22
43
|
|
|
23
44
|
## Jak działa `add`
|
|
24
45
|
|
|
25
46
|
1. Rozwiązuje zależności registry rekurencyjnie (wykrywa cykle).
|
|
26
|
-
2.
|
|
27
|
-
3.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
2. Pomija bloki zapisane już w `installedBlocks` (`--overwrite` instaluje je ponownie).
|
|
48
|
+
3. Sprawdza zależności npm - brak: ostrzega, wersja spoza zakresu: przerywa. Zależności `peer`
|
|
49
|
+
(Angular, rxjs) dają wyłącznie ostrzeżenie.
|
|
50
|
+
4. Przepisuje `@/` -> `alias` oraz `kpt-` -> `prefix` w selektorach, klasach CSS i generowanych id
|
|
51
|
+
(tokeny `--kpt-*` i nazwy klas TS, np. `KptField`, zostają nietknięte).
|
|
52
|
+
5. Konflikt pliku: identyczny pomija, różny zapisuje jako `.new` (lub `--overwrite`).
|
|
53
|
+
6. Zapisuje dopiero po pobraniu wszystkich plików; odnotowuje `installedBlocks` (wersja biblioteki
|
|
54
|
+
i data).
|
|
55
|
+
7. Wypisuje: dodane pliki, przykład użycia, porty do podpięcia, uwagi.
|
|
31
56
|
|
|
32
57
|
`--dry-run` przechodzi całą ścieżkę bez zapisu - idealne dla agentów AI do podglądu skutków.
|
|
58
|
+
Sprawdzenie zależności npm działa także wtedy, więc niezgodna wersja przerwie również dry-run.
|
|
33
59
|
|
|
34
60
|
Pełny opis: [`llms.txt`](https://ui.konce.pt/llms/cli/llms.txt) (EN)
|
|
35
61
|
i [`llms-pl.txt`](https://ui.konce.pt/llms/cli/llms-pl.txt) (PL).
|
package/dist/commands/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { CONFIG_FILE, DEFAULT_CONFIG, writeConfig } from "../config.js";
|
|
4
4
|
import { flag, hasFlag, log, UserError } from "../util.js";
|
|
5
5
|
export function initCommand(args) {
|
|
@@ -14,7 +14,6 @@ export function initCommand(args) {
|
|
|
14
14
|
blocksDir: flag(args, 'blocks-dir') ?? DEFAULT_CONFIG.blocksDir,
|
|
15
15
|
alias: flag(args, 'alias') ?? DEFAULT_CONFIG.alias,
|
|
16
16
|
prefix: flag(args, 'prefix') ?? DEFAULT_CONFIG.prefix,
|
|
17
|
-
theme: flag(args, 'theme') ?? DEFAULT_CONFIG.theme,
|
|
18
17
|
installedBlocks: {},
|
|
19
18
|
};
|
|
20
19
|
writeConfig(configPath, config);
|
|
@@ -23,5 +22,18 @@ export function initCommand(args) {
|
|
|
23
22
|
log.step(`blocksDir: ${config.blocksDir}`);
|
|
24
23
|
log.step(`alias: ${config.alias}`);
|
|
25
24
|
log.step(`prefix: ${config.prefix}`);
|
|
25
|
+
// Bloki importują się nawzajem przez alias - bez wpisu w `paths` projekt się nie skompiluje.
|
|
26
|
+
// tsconfig.json bywa z komentarzami (Angular CLI), więc go nie przepisujemy, tylko podpowiadamy.
|
|
27
|
+
if (!tsconfigMapsAlias(cwd, config.alias)) {
|
|
28
|
+
log.info('\nMap the alias in tsconfig.json -> compilerOptions.paths:');
|
|
29
|
+
log.step(`"${config.alias}/*": ["${config.blocksDir}/*"]`);
|
|
30
|
+
}
|
|
26
31
|
log.info('\nAdd a block: npx @konce-pt/ui add <name>');
|
|
27
32
|
}
|
|
33
|
+
/** Czy tsconfig.json w katalogu projektu ma już wpis aliasu bloków (sprawdzenie tekstowe). */
|
|
34
|
+
function tsconfigMapsAlias(cwd, alias) {
|
|
35
|
+
const tsconfig = path.join(cwd, 'tsconfig.json');
|
|
36
|
+
if (!existsSync(tsconfig))
|
|
37
|
+
return false;
|
|
38
|
+
return readFileSync(tsconfig, 'utf8').includes(`"${alias}/*"`);
|
|
39
|
+
}
|
package/dist/config.js
CHANGED
|
@@ -3,7 +3,6 @@ import path from 'node:path';
|
|
|
3
3
|
import { UserError } from "./util.js";
|
|
4
4
|
export const CONFIG_FILE = 'konce.json';
|
|
5
5
|
export const DEFAULT_CONFIG = {
|
|
6
|
-
$schema: 'https://ui.konce.pt/cli/konce-config-schema.json',
|
|
7
6
|
registry: 'https://ui.konce.pt/cli',
|
|
8
7
|
blocksDir: 'src/app/shared/blocks',
|
|
9
8
|
alias: '@shared/blocks',
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
npx @konce-pt/ui <command> [options]
|
|
10
10
|
|
|
11
11
|
Commands:
|
|
12
|
-
init create konce.json (--registry --blocks-dir --alias --prefix --
|
|
12
|
+
init create konce.json (--registry --blocks-dir --alias --prefix --force)
|
|
13
13
|
add <name...> install block(s) + their dependencies (--overwrite --dry-run --path --registry)
|
|
14
14
|
list [--category=...] show the available blocks (--registry)
|
|
15
15
|
|