centoui-cli 1.0.0-alpha.34 → 1.0.0-alpha.35
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/dist/index.d.mts +2 -1
- package/dist/index.mjs +21 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -49,7 +49,8 @@ type Registry = {
|
|
|
49
49
|
*/
|
|
50
50
|
type CentoUIConfig = {
|
|
51
51
|
/** Relative path (from project root) to the directory where components are installed. */componentsDir: string; /** Relative path (from project root) to the CSS file that receives theme and component styles. */
|
|
52
|
-
themeFilePath: string;
|
|
52
|
+
themeFilePath: string; /** Relative path (from project root) to the utils file. */
|
|
53
|
+
utilsFilePath: string;
|
|
53
54
|
/**
|
|
54
55
|
* Maps internal CentoUI icon slot names to Iconify icon IDs.
|
|
55
56
|
* Components reference icon slots by their internal name so you can swap icon libraries freely.
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { loadConfig } from "c12";
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/constants.ts
|
|
10
10
|
/** CentoUI current package version, sourced directly from package.json. */
|
|
11
|
-
const VERSION = "1.0.0-alpha.
|
|
11
|
+
const VERSION = "1.0.0-alpha.35";
|
|
12
12
|
/** File name for the user-side CentoUI config (created by `centoui init`). */
|
|
13
13
|
const CONFIG_FILE_NAME = "centoui.config.ts";
|
|
14
14
|
/**
|
|
@@ -26,6 +26,7 @@ const REGISTRY_INDEX_URL = `${`${CORE_SRC_BASE_URL}/registry`}/index.json`;
|
|
|
26
26
|
* This file is written to the user's project during `centoui init`.
|
|
27
27
|
*/
|
|
28
28
|
const THEME_CSS_URL = `${CORE_SRC_BASE_URL}/defaults/centoui.css`;
|
|
29
|
+
`${CORE_SRC_BASE_URL}`;
|
|
29
30
|
/**
|
|
30
31
|
* Full URL to the default values file for the CentoUI config.
|
|
31
32
|
* The contents of this file are written to the user's project during `centoui init`.
|
|
@@ -271,14 +272,16 @@ function extractInnerConfigContent(fileContent) {
|
|
|
271
272
|
*
|
|
272
273
|
* @param themeFilePath - Relative path (from project root) where the CSS theme file lives.
|
|
273
274
|
* @param componentsDir - Relative path (from project root) where components will be installed.
|
|
275
|
+
* @param utilsFilePath - Relative path (from project root) where the utils file lives.
|
|
274
276
|
* @returns A string containing the complete TypeScript source for the config file.
|
|
275
277
|
*/
|
|
276
|
-
async function buildUserDefaultConfigFileContent(themeFilePath, componentsDir) {
|
|
278
|
+
async function buildUserDefaultConfigFileContent(themeFilePath, componentsDir, utilsFilePath) {
|
|
277
279
|
return `import { defineConfig } from 'centoui'
|
|
278
280
|
|
|
279
281
|
export default defineConfig({
|
|
280
282
|
componentsDir: '${componentsDir}',
|
|
281
283
|
themeFilePath: '${themeFilePath}',
|
|
284
|
+
utilsFilePath: '${utilsFilePath}',
|
|
282
285
|
${extractInnerConfigContent(await fetchDefaultConfig())}
|
|
283
286
|
})
|
|
284
287
|
`;
|
|
@@ -410,6 +413,11 @@ function init() {
|
|
|
410
413
|
message: "Path for the theme CSS file",
|
|
411
414
|
initialValue: "src/assets/css/centoui.css",
|
|
412
415
|
validate: validateNonEmptyPath
|
|
416
|
+
}),
|
|
417
|
+
utilsFilePath: () => text({
|
|
418
|
+
message: "Path for the utils file",
|
|
419
|
+
initialValue: "src/utils/centoui-utils.ts",
|
|
420
|
+
validate: validateNonEmptyPath
|
|
413
421
|
})
|
|
414
422
|
}, { onCancel: () => {
|
|
415
423
|
cancel("Initialization cancelled.");
|
|
@@ -418,16 +426,18 @@ function init() {
|
|
|
418
426
|
const configPath = join(cwd, CONFIG_FILE_NAME);
|
|
419
427
|
const themePath = join(cwd, directories.themeFilePath);
|
|
420
428
|
const componentsPath = join(cwd, directories.componentDir);
|
|
429
|
+
const utilsPath = join(cwd, directories.utilsFilePath);
|
|
421
430
|
const shouldWriteConfig = await confirmOverwriteIfExists(CONFIG_FILE_NAME, configPath);
|
|
422
431
|
const shouldWriteTheme = await confirmOverwriteIfExists(directories.themeFilePath, themePath);
|
|
423
432
|
const shouldWriteComponentsDir = await confirmOverwriteIfExists(directories.componentDir, componentsPath);
|
|
433
|
+
const shouldWriteUtils = await confirmOverwriteIfExists(directories.utilsFilePath, utilsPath);
|
|
424
434
|
let registry;
|
|
425
435
|
await tasks([
|
|
426
436
|
{
|
|
427
437
|
title: "Fetching config defaults",
|
|
428
438
|
task: async () => {
|
|
429
439
|
if (!shouldWriteConfig) return `Skipped — "${CONFIG_FILE_NAME}" already exists`;
|
|
430
|
-
const userConfigContent = await buildUserDefaultConfigFileContent(directories.themeFilePath, directories.componentDir);
|
|
440
|
+
const userConfigContent = await buildUserDefaultConfigFileContent(directories.themeFilePath, directories.componentDir, directories.utilsFilePath);
|
|
431
441
|
await fsExtra.outputFile(configPath, userConfigContent, "utf-8");
|
|
432
442
|
return `${CONFIG_FILE_NAME} written`;
|
|
433
443
|
}
|
|
@@ -441,6 +451,14 @@ function init() {
|
|
|
441
451
|
return `${directories.themeFilePath} written`;
|
|
442
452
|
}
|
|
443
453
|
},
|
|
454
|
+
{
|
|
455
|
+
title: "Writing utils file",
|
|
456
|
+
task: async () => {
|
|
457
|
+
if (!shouldWriteUtils) return `Skipped — "${directories.utilsFilePath}" already exists`;
|
|
458
|
+
await fsExtra.outputFile(utilsPath, "", "utf-8");
|
|
459
|
+
return `${directories.utilsFilePath} written`;
|
|
460
|
+
}
|
|
461
|
+
},
|
|
444
462
|
{
|
|
445
463
|
title: "Preparing components directory",
|
|
446
464
|
task: async () => {
|