@rokkit/cli 1.0.2 → 1.0.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/LICENSE +21 -0
- package/dist/src/config.d.ts +10 -0
- package/dist/src/convert.d.ts +58 -0
- package/dist/src/doctor.d.ts +24 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/init.d.ts +70 -0
- package/dist/src/skin.d.ts +28 -0
- package/dist/src/theme.d.ts +21 -0
- package/dist/src/types.d.ts +24 -0
- package/dist/src/upgrade.d.ts +33 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jerry Thomas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load rokkit.config.js using injected adapter or real filesystem.
|
|
3
|
+
* Returns null (not an error) if config is absent or fails to load.
|
|
4
|
+
* @param {{ readConfig?: () => Record<string, unknown>, cwd?: string }} adapters
|
|
5
|
+
* @returns {Promise<Record<string, unknown> | null>}
|
|
6
|
+
*/
|
|
7
|
+
export function loadConfig(adapters: {
|
|
8
|
+
readConfig?: () => Record<string, unknown>;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
}): Promise<Record<string, unknown> | null>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean up and optimise SVG icon
|
|
3
|
+
*
|
|
4
|
+
* @param {string} svg SVG code
|
|
5
|
+
* @param {boolean} color True if color should be preserved
|
|
6
|
+
*/
|
|
7
|
+
export function cleanAndOptimizeIcon(svg: string, color: boolean): void;
|
|
8
|
+
/**
|
|
9
|
+
* Process icons
|
|
10
|
+
*
|
|
11
|
+
* @param {IconifyTools} iconSet Icon set
|
|
12
|
+
* @param {boolean} color True if color should be preserved
|
|
13
|
+
*/
|
|
14
|
+
export function processIcons(iconSet: IconifyTools, color: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Convert individual icons into a json bundle
|
|
17
|
+
*
|
|
18
|
+
* @param {string} folder Folder with icons
|
|
19
|
+
* @param {import('./types').IconBuilderOptions} options Options for conversion
|
|
20
|
+
* @returns {Promise<object>} The generated icon set
|
|
21
|
+
*/
|
|
22
|
+
export function bundle(folder: string, options: import("./types").IconBuilderOptions): Promise<object>;
|
|
23
|
+
/**
|
|
24
|
+
* Convert icons to an iconify package
|
|
25
|
+
*
|
|
26
|
+
* @param {string} folder Folder with icons
|
|
27
|
+
* @param {import('./types').IconBuilderOptions} options Options for conversion
|
|
28
|
+
* @returns {Promise<object>} The generated icon set
|
|
29
|
+
*/
|
|
30
|
+
export function convert(folder: string, options: import("./types").IconBuilderOptions): Promise<object>;
|
|
31
|
+
/**
|
|
32
|
+
* Read config file from path
|
|
33
|
+
*
|
|
34
|
+
* @param {string} configPath Path to config file
|
|
35
|
+
* @returns {object} Parsed config object
|
|
36
|
+
*/
|
|
37
|
+
export function readConfigFile(configPath: string): object;
|
|
38
|
+
/**
|
|
39
|
+
* Get folders from directory
|
|
40
|
+
*
|
|
41
|
+
* @param {string} dir Directory to scan for folders
|
|
42
|
+
* @returns {string[]} List of folder names
|
|
43
|
+
*/
|
|
44
|
+
export function getFolderNames(dir: string): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Converts a folder of icons into an icon bundle
|
|
47
|
+
* @param {string[]} folders
|
|
48
|
+
* @param {import('./types').IconBuilderOptions} config
|
|
49
|
+
* @param {import('./types').FolderOptions} opts
|
|
50
|
+
*/
|
|
51
|
+
export function bundleFolders(folders: string[], config: import("./types").IconBuilderOptions, opts: import("./types").FolderOptions): void;
|
|
52
|
+
/**
|
|
53
|
+
* Converts a folder of icons into individual SVG files
|
|
54
|
+
* @param {string[]} folders
|
|
55
|
+
* @param {import('./types').IconBuilderOptions} config
|
|
56
|
+
* @param {import('./types').FolderOptions} opts
|
|
57
|
+
*/
|
|
58
|
+
export function convertFolders(folders: string[], config: import("./types").IconBuilderOptions, opts: import("./types").FolderOptions): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run all doctor checks against the given filesystem adapter.
|
|
3
|
+
* @param {{ exists: (p: string) => boolean, read: (p: string) => string, resolve: (p: string) => string }} fs
|
|
4
|
+
* @returns {Array<{ id: string, label: string, status: 'pass'|'fail', fixable: boolean, fix: string, autoFix?: string }>}
|
|
5
|
+
*/
|
|
6
|
+
export function runChecks(fs: {
|
|
7
|
+
exists: (p: string) => boolean;
|
|
8
|
+
read: (p: string) => string;
|
|
9
|
+
resolve: (p: string) => string;
|
|
10
|
+
}): Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
status: "pass" | "fail";
|
|
14
|
+
fixable: boolean;
|
|
15
|
+
fix: string;
|
|
16
|
+
autoFix?: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Interactive doctor command — validates project setup.
|
|
20
|
+
* @param {{ fix?: boolean }} [opts]
|
|
21
|
+
*/
|
|
22
|
+
export function doctor(opts?: {
|
|
23
|
+
fix?: boolean;
|
|
24
|
+
}): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect if the current directory is a SvelteKit project.
|
|
3
|
+
* @param {string} cwd
|
|
4
|
+
* @returns {boolean}
|
|
5
|
+
*/
|
|
6
|
+
export function detectSvelteKit(cwd: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Install Rokkit packages via the detected package manager.
|
|
9
|
+
* Skips packages already in package.json.
|
|
10
|
+
* @param {string} cwd
|
|
11
|
+
* @param {{ runInstall?: (bin: string, args: string[]) => void }} [adapters]
|
|
12
|
+
*/
|
|
13
|
+
export function installPackages(cwd: string, adapters?: {
|
|
14
|
+
runInstall?: (bin: string, args: string[]) => void;
|
|
15
|
+
}): void;
|
|
16
|
+
/**
|
|
17
|
+
* Build the chart config section from user prompt answers.
|
|
18
|
+
* @param {{ chartColors: string, chartShades: string }} opts
|
|
19
|
+
* @returns {Record<string, unknown>}
|
|
20
|
+
*/
|
|
21
|
+
export function generateChartConfig({ chartColors, chartShades }: {
|
|
22
|
+
chartColors: string;
|
|
23
|
+
chartShades: string;
|
|
24
|
+
}): Record<string, unknown>;
|
|
25
|
+
export function generateConfig({ palette, customColors, icons, iconPath, iconStyle, themes, defaultTheme, switcher, includeChart, chartColors, chartShades }: {
|
|
26
|
+
palette: any;
|
|
27
|
+
customColors: any;
|
|
28
|
+
icons: any;
|
|
29
|
+
iconPath: any;
|
|
30
|
+
iconStyle: any;
|
|
31
|
+
themes: any;
|
|
32
|
+
defaultTheme: any;
|
|
33
|
+
switcher: any;
|
|
34
|
+
includeChart: any;
|
|
35
|
+
chartColors: any;
|
|
36
|
+
chartShades: any;
|
|
37
|
+
}): {
|
|
38
|
+
colors: Record<string, unknown>;
|
|
39
|
+
themes: any;
|
|
40
|
+
defaultTheme: any;
|
|
41
|
+
switcher: any;
|
|
42
|
+
storageKey: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Generate the content for uno.config.js.
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
export function generateUnoConfig(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Generate an array of CSS @import lines for app.css.
|
|
51
|
+
* @param {string[]} themes
|
|
52
|
+
* @returns {string[]}
|
|
53
|
+
*/
|
|
54
|
+
export function generateAppCssImports(themes: string[]): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Generate the flash-prevention script for app.html.
|
|
57
|
+
* Returns null when no script is needed (system switcher).
|
|
58
|
+
* @param {string} switcher — 'system' | 'manual' | 'full'
|
|
59
|
+
* @param {string} [storageKey='rokkit-theme']
|
|
60
|
+
* @returns {string | null}
|
|
61
|
+
*/
|
|
62
|
+
export function generateInitScript(switcher: string, storageKey?: string, defaultStyle?: string): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Interactive init command — prompts the user, writes config files.
|
|
65
|
+
* @param {Record<string, unknown>} [_opts]
|
|
66
|
+
* @param {{ runInstall?: (bin: string, args: string[]) => void }} [adapters] — injectable for testing
|
|
67
|
+
*/
|
|
68
|
+
export function init(_opts?: Record<string, unknown>, adapters?: {
|
|
69
|
+
runInstall?: (bin: string, args: string[]) => void;
|
|
70
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a skin scaffold object with all token keys set to default color names.
|
|
3
|
+
* @returns {Record<string, string>}
|
|
4
|
+
*/
|
|
5
|
+
export function generateSkinScaffold(): Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Add a new skin entry to a config object (pure, no side effects).
|
|
8
|
+
* @param {Record<string, unknown>} config
|
|
9
|
+
* @param {string} name
|
|
10
|
+
* @returns {Record<string, unknown>}
|
|
11
|
+
*/
|
|
12
|
+
export function addSkinToConfig(config: Record<string, unknown>, name: string): Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Serialize a rokkit config back to a JS module string.
|
|
15
|
+
* @param {Record<string, unknown>} config
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
export function serializeConfig(config: Record<string, unknown>): string;
|
|
19
|
+
export function runSkinList(adapters?: {}): Promise<void>;
|
|
20
|
+
export function runSkinCreate(name: any, adapters?: {}): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* CLI entry point for `rokkit skin` subcommands.
|
|
23
|
+
* @param {string} sub — 'list' | 'create'
|
|
24
|
+
* @param {{ name?: string }} opts
|
|
25
|
+
*/
|
|
26
|
+
export function skin(sub: string, opts?: {
|
|
27
|
+
name?: string;
|
|
28
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a full CSS theme stub for the given style name.
|
|
3
|
+
* Produces one `[data-style='<name>']` block per component.
|
|
4
|
+
* @param {string} name
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function generateThemeStub(name: string): string;
|
|
8
|
+
export function runThemeList(adapters?: {}): Promise<void>;
|
|
9
|
+
export function runThemeCreate(name: any, adapters?: {}): void;
|
|
10
|
+
/**
|
|
11
|
+
* CLI entry point for `rokkit theme` subcommands.
|
|
12
|
+
* @param {string} sub — 'list' | 'create'
|
|
13
|
+
* @param {{ name?: string }} opts
|
|
14
|
+
*/
|
|
15
|
+
export function theme(sub: string, opts?: {
|
|
16
|
+
name?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* All component names that ship with Rokkit — one CSS block will be generated for each.
|
|
20
|
+
*/
|
|
21
|
+
export const THEME_COMPONENTS: string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type IconPackageInfo = {
|
|
2
|
+
namespace?: string | undefined;
|
|
3
|
+
version?: string | undefined;
|
|
4
|
+
homepage?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export type BundleConfig = {
|
|
7
|
+
color?: boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type BundleConfiguration = {
|
|
10
|
+
package?: IconPackageInfo | undefined;
|
|
11
|
+
bundles?: {
|
|
12
|
+
[x: string]: BundleConfig;
|
|
13
|
+
} | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type IconBuilderOptions = {
|
|
16
|
+
target: string;
|
|
17
|
+
prefix: string;
|
|
18
|
+
color: boolean;
|
|
19
|
+
package?: IconPackageInfo | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type FolderOptions = {
|
|
22
|
+
input: string;
|
|
23
|
+
output: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract @rokkit/* packages from a parsed package.json object.
|
|
3
|
+
* @param {Record<string, unknown>} pkgJson
|
|
4
|
+
* @returns {{ name: string, current: string }[]}
|
|
5
|
+
*/
|
|
6
|
+
export function getRokkitPackages(pkgJson: Record<string, unknown>): {
|
|
7
|
+
name: string;
|
|
8
|
+
current: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* Detect the package manager from lockfile presence.
|
|
12
|
+
* @param {string[]} lockfiles — list of lockfile names that exist in cwd
|
|
13
|
+
* @returns {'bun' | 'pnpm' | 'yarn' | 'npm'}
|
|
14
|
+
*/
|
|
15
|
+
export function detectPackageManager(lockfiles: string[]): "bun" | "pnpm" | "yarn" | "npm";
|
|
16
|
+
/**
|
|
17
|
+
* Build the install command for the given package manager.
|
|
18
|
+
* @param {'bun' | 'pnpm' | 'yarn' | 'npm'} pm
|
|
19
|
+
* @param {string[]} packages — package specs like `@rokkit/ui@1.2.3`
|
|
20
|
+
* @returns {{ bin: string, args: string[] }}
|
|
21
|
+
*/
|
|
22
|
+
export function buildInstallCommand(pm: "bun" | "pnpm" | "yarn" | "npm", packages: string[]): {
|
|
23
|
+
bin: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
};
|
|
26
|
+
export function runUpgrade(opts?: {}, adapters?: {}): void;
|
|
27
|
+
/**
|
|
28
|
+
* CLI entry point for `rokkit upgrade`
|
|
29
|
+
* @param {{ apply?: boolean }} opts
|
|
30
|
+
*/
|
|
31
|
+
export function upgrade(opts?: {
|
|
32
|
+
apply?: boolean;
|
|
33
|
+
}): void;
|