@yahoo/uds 3.108.1 → 3.109.0-beta.1
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/automated-config/dist/mapTextVariantFixtureToValue.cjs +12 -1
- package/dist/automated-config/dist/mapTextVariantFixtureToValue.js +12 -1
- package/dist/automated-config/dist/properties.cjs +1 -1
- package/dist/automated-config/dist/properties.js +1 -1
- package/dist/cli/commands/sync.cjs +5 -3
- package/dist/cli/commands/sync.d.cts +1 -1
- package/dist/cli/commands/sync.d.ts +1 -1
- package/dist/cli/commands/sync.js +6 -4
- package/dist/cli/commands/version.cjs +0 -2
- package/dist/cli/commands/version.d.cts +1 -1
- package/dist/cli/commands/version.d.ts +1 -1
- package/dist/cli/commands/version.js +0 -2
- package/dist/cli/dist/cli.cjs +1 -1
- package/dist/cli/dist/cli.js +1 -1
- package/dist/cli/dist/commands/editor-rules.cjs +21 -18
- package/dist/cli/dist/commands/editor-rules.js +21 -18
- package/dist/cli/dist/lib/box.cjs +44 -0
- package/dist/cli/dist/lib/box.js +44 -0
- package/dist/cli/dist/lib/colors.cjs +2 -0
- package/dist/cli/dist/lib/colors.js +2 -1
- package/dist/cli/dist/lib/logger.cjs +66 -0
- package/dist/cli/dist/lib/logger.js +66 -0
- package/dist/cli/dist/utils/rules/config.cjs +137 -53
- package/dist/cli/dist/utils/rules/config.js +137 -54
- package/dist/cli/rules/claude/uds/components.md +50 -0
- package/dist/cli/rules/claude/uds/elevation.md +33 -0
- package/dist/cli/rules/claude/uds/icons.md +4 -0
- package/dist/cli/rules/claude/uds/styling.md +18 -0
- package/dist/cli/rules/claude/uds/tailwind.md +5 -0
- package/dist/cli/runner.cjs +11 -2
- package/dist/cli/runner.js +11 -2
- package/dist/components/client/Avatar/AvatarImage.cjs +1 -0
- package/dist/components/client/Avatar/AvatarImage.js +1 -0
- package/dist/components/client/Chip/ChipDismissible.cjs +1 -1
- package/dist/components/client/Chip/ChipDismissible.js +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Toast/Toast.cjs +1 -1
- package/dist/components/client/Toast/Toast.js +1 -1
- package/dist/components/client/Toast/ToastContainer.cjs +5 -1
- package/dist/components/client/Toast/ToastContainer.js +5 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +7 -0
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +7 -0
- package/dist/components/experimental/Table.cjs +2 -2
- package/dist/components/experimental/Table.js +2 -2
- package/dist/config/dist/index.cjs +22687 -19487
- package/dist/config/dist/index.js +22687 -19487
- package/dist/css-tokens/dist/index.cjs +2 -0
- package/dist/css-tokens/dist/index.d.cts +2 -1
- package/dist/css-tokens/dist/index.d.ts +2 -1
- package/dist/css-tokens/dist/index.js +2 -1
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +4 -2
- package/dist/runtime/toastConfig.cjs +2 -1
- package/dist/runtime/toastConfig.d.cts +3 -0
- package/dist/runtime/toastConfig.d.ts +3 -0
- package/dist/runtime/toastConfig.js +2 -1
- package/dist/styles/styler.d.cts +50 -50
- package/dist/styles/styler.d.ts +50 -50
- package/dist/styles/variants.cjs +278 -278
- package/dist/styles/variants.js +278 -278
- package/dist/tailwind/dist/commands/css.cjs +79 -0
- package/dist/tailwind/dist/commands/css.d.ts +3 -0
- package/dist/tailwind/dist/commands/css.helpers.cjs +32 -0
- package/dist/tailwind/dist/commands/css.helpers.js +28 -0
- package/dist/tailwind/dist/commands/css.js +79 -0
- package/dist/tailwind/dist/commands/generateComponentData.cjs +33 -31
- package/dist/tailwind/dist/commands/generateComponentData.d.ts +1 -1
- package/dist/tailwind/dist/commands/generateComponentData.js +33 -31
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts +1 -1
- package/dist/tailwind/dist/commands/purge.cjs +3 -4
- package/dist/tailwind/dist/commands/purge.d.ts +1 -1
- package/dist/tailwind/dist/commands/purge.js +3 -4
- package/dist/tailwind/dist/css/generate.cjs +116 -0
- package/dist/tailwind/dist/css/generate.d.cts +28 -0
- package/dist/tailwind/dist/css/generate.d.ts +29 -0
- package/dist/tailwind/dist/css/generate.helpers.cjs +112 -0
- package/dist/tailwind/dist/css/generate.helpers.js +100 -0
- package/dist/tailwind/dist/css/generate.js +111 -0
- package/dist/tailwind/dist/css/postcss.cjs +35 -0
- package/dist/tailwind/dist/css/postcss.helpers.cjs +27 -0
- package/dist/tailwind/dist/css/postcss.helpers.js +26 -0
- package/dist/tailwind/dist/css/postcss.js +35 -0
- package/dist/tailwind/dist/css/runner.cjs +280 -0
- package/dist/tailwind/dist/css/runner.helpers.cjs +26 -0
- package/dist/tailwind/dist/css/runner.helpers.js +23 -0
- package/dist/tailwind/dist/css/runner.js +277 -0
- package/dist/tailwind/dist/css/theme.cjs +12 -0
- package/dist/tailwind/dist/css/theme.d.cts +66 -0
- package/dist/tailwind/dist/css/theme.d.ts +66 -0
- package/dist/tailwind/dist/css/theme.js +11 -0
- package/dist/tailwind/dist/css/utils.cjs +234 -0
- package/dist/tailwind/dist/css/utils.js +223 -0
- package/dist/tailwind/dist/index.d.cts +1 -0
- package/dist/tailwind/dist/index.d.ts +5 -3
- package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +4 -3
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js +4 -3
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +122 -125
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +122 -125
- package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +1 -8
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js +1 -8
- package/dist/tailwind/dist/purger/optimized/purge.cjs +11 -10
- package/dist/tailwind/dist/purger/optimized/purge.js +10 -9
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +232 -127
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +232 -127
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +313 -251
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +313 -251
- package/dist/tailwind/dist/purger/optimized/utils/files.cjs +4 -3
- package/dist/tailwind/dist/purger/optimized/utils/files.js +4 -3
- package/dist/tailwind/dist/purger/optimized/utils/safelist.cjs +13 -21
- package/dist/tailwind/dist/purger/optimized/utils/safelist.js +13 -21
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.cjs +3 -8
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.js +3 -8
- package/dist/tailwind/dist/tailwind/plugins/a11y.cjs +2 -2
- package/dist/tailwind/dist/tailwind/plugins/a11y.js +2 -2
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.cjs +16 -11
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js +16 -11
- package/dist/tailwind/dist/tailwind/plugins/typography.cjs +41 -13
- package/dist/tailwind/dist/tailwind/plugins/typography.js +41 -13
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.cjs +4 -2
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts +10 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts +10 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js +4 -2
- package/dist/tailwind/dist/utils/optimizeCSS.cjs +405 -0
- package/dist/tailwind/dist/utils/optimizeCSS.js +403 -0
- package/dist/tailwind/dist/utils/parseTokens.cjs +21 -4
- package/dist/tailwind/dist/utils/parseTokens.d.cts +2 -2
- package/dist/tailwind/dist/utils/parseTokens.d.ts +2 -2
- package/dist/tailwind/dist/utils/parseTokens.js +22 -5
- package/dist/tailwind/dist/utils/postcssPreserveVars.cjs +67 -0
- package/dist/tailwind/dist/utils/postcssPreserveVars.js +65 -0
- package/dist/tailwind/dist/utils/tsMorph.cjs +1 -1
- package/dist/tokens/consts/cssTokens.cjs +1 -0
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +5 -0
- package/dist/tokens/index.d.cts +4 -3
- package/dist/tokens/index.d.ts +4 -3
- package/dist/tokens/index.js +3 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/tokens/utils/spectrum.cjs +72 -0
- package/dist/tokens/utils/spectrum.d.cts +37 -0
- package/dist/tokens/utils/spectrum.d.ts +37 -0
- package/dist/tokens/utils/spectrum.js +68 -0
- package/dist/types/dist/index.d.cts +33 -2
- package/dist/types/dist/index.d.ts +33 -2
- package/dist/uds/generated/componentData.cjs +33 -14
- package/dist/uds/generated/componentData.js +33 -14
- package/dist/uds/generated/tailwindPurge.cjs +93 -63
- package/dist/uds/generated/tailwindPurge.js +93 -63
- package/dist/uds/package.cjs +12 -6
- package/dist/uds/package.js +12 -6
- package/dist/utils/isElevationAlias.cjs +12 -0
- package/dist/utils/isElevationAlias.d.cts +7 -0
- package/dist/utils/isElevationAlias.d.ts +7 -0
- package/dist/utils/isElevationAlias.js +11 -0
- package/generated/componentData.json +2397 -0
- package/generated/tailwindPurge.ts +4560 -0
- package/package.json +9 -6
- package/dist/tailwind/dist/tailwind/utils/flattenColorPalette.cjs +0 -8
- package/dist/tailwind/dist/tailwind/utils/flattenColorPalette.js +0 -7
- package/dist/tokens/configs/spectrum.cjs +0 -732
- package/dist/tokens/configs/spectrum.d.cts +0 -9
- package/dist/tokens/configs/spectrum.d.ts +0 -9
- package/dist/tokens/configs/spectrum.js +0 -729
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_index = require('../../css-tokens/dist/index.cjs');
|
|
3
|
+
const require_assertUnreachable = require('./utils/assertUnreachable.cjs');
|
|
3
4
|
|
|
4
5
|
//#region ../automated-config/dist/mapTextVariantFixtureToValue.js
|
|
5
6
|
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
-
const mapTextVariantFixtureToValue = (key) => (selected, value) =>
|
|
7
|
+
const mapTextVariantFixtureToValue = (key) => (selected, value) => {
|
|
8
|
+
switch (key) {
|
|
9
|
+
case "fontFamily": return `udsFontFamily[${require_index.textVariantsSafe(value)}]`;
|
|
10
|
+
case "fontSize": return `udsFontSize[${require_index.textVariantsSafe(value)}]`;
|
|
11
|
+
case "lineHeight": return `udsLineHeight[${require_index.textVariantsSafe(value)}]`;
|
|
12
|
+
case "letterSpacing": return `udsLetterSpacing[${require_index.textVariantsSafe(value)}]`;
|
|
13
|
+
case "textTransform": return `udsTextTransform[${require_index.textVariantsSafe(value)}]`;
|
|
14
|
+
case "fontWeight": return `udsFontWeight[${require_index.textVariantsSafe(value)}]`;
|
|
15
|
+
}
|
|
16
|
+
return require_assertUnreachable.assertUnreachable(key);
|
|
17
|
+
};
|
|
7
18
|
|
|
8
19
|
//#endregion
|
|
9
20
|
exports.mapTextVariantFixtureToValue = mapTextVariantFixtureToValue;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { textVariantsSafe } from "../../css-tokens/dist/index.js";
|
|
3
|
+
import { assertUnreachable } from "./utils/assertUnreachable.js";
|
|
3
4
|
|
|
4
5
|
//#region ../automated-config/dist/mapTextVariantFixtureToValue.js
|
|
5
6
|
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
-
const mapTextVariantFixtureToValue = (key) => (selected, value) =>
|
|
7
|
+
const mapTextVariantFixtureToValue = (key) => (selected, value) => {
|
|
8
|
+
switch (key) {
|
|
9
|
+
case "fontFamily": return `udsFontFamily[${textVariantsSafe(value)}]`;
|
|
10
|
+
case "fontSize": return `udsFontSize[${textVariantsSafe(value)}]`;
|
|
11
|
+
case "lineHeight": return `udsLineHeight[${textVariantsSafe(value)}]`;
|
|
12
|
+
case "letterSpacing": return `udsLetterSpacing[${textVariantsSafe(value)}]`;
|
|
13
|
+
case "textTransform": return `udsTextTransform[${textVariantsSafe(value)}]`;
|
|
14
|
+
case "fontWeight": return `udsFontWeight[${textVariantsSafe(value)}]`;
|
|
15
|
+
}
|
|
16
|
+
return assertUnreachable(key);
|
|
17
|
+
};
|
|
7
18
|
|
|
8
19
|
//#endregion
|
|
9
20
|
export { mapTextVariantFixtureToValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_index = require('../../css-tokens/dist/index.cjs');
|
|
3
|
-
const require_mapTextVariantFixtureToValue = require('./mapTextVariantFixtureToValue.cjs');
|
|
4
3
|
const require_assertUnreachable = require('./utils/assertUnreachable.cjs');
|
|
4
|
+
const require_mapTextVariantFixtureToValue = require('./mapTextVariantFixtureToValue.cjs');
|
|
5
5
|
const require_mapColorFixtureToValue = require('./utils/mapColorFixtureToValue.cjs');
|
|
6
6
|
const require_index$1 = require('../../motion-tokens/dist/index.cjs');
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { BACKGROUND_BLUR_COLOR_PREFIX, BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX, BORDER_RADIUS_PREFIX, BUTTON_SCALE_EFFECT, DROP_SHADOW_PREFIX, getShadowLayerValue, textVariantsSafe } from "../../css-tokens/dist/index.js";
|
|
3
|
-
import { mapTextVariantFixtureToValue } from "./mapTextVariantFixtureToValue.js";
|
|
4
3
|
import { assertUnreachable } from "./utils/assertUnreachable.js";
|
|
4
|
+
import { mapTextVariantFixtureToValue } from "./mapTextVariantFixtureToValue.js";
|
|
5
5
|
import { mapColorFixtureToValue } from "./utils/mapColorFixtureToValue.js";
|
|
6
6
|
import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
|
|
7
7
|
|
|
@@ -5,13 +5,14 @@ const require_defaultTokensConfig = require('../../defaultTokensConfig.cjs');
|
|
|
5
5
|
const require_runtime_breakpointsConfig = require('../../runtime/breakpointsConfig.cjs');
|
|
6
6
|
const require_runtime_toastConfig = require('../../runtime/toastConfig.cjs');
|
|
7
7
|
const require_runtime_tooltipConfig = require('../../runtime/tooltipConfig.cjs');
|
|
8
|
-
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
9
8
|
const require_colors = require('../dist/lib/colors.cjs');
|
|
10
9
|
const require_print = require('../dist/lib/print.cjs');
|
|
10
|
+
const require_box = require('../dist/lib/box.cjs');
|
|
11
|
+
const require_config = require('../dist/utils/rules/config.cjs');
|
|
11
12
|
const require_cli_commands_utils_sortKeys = require('./utils/sortKeys.cjs');
|
|
13
|
+
let node_fs = require("node:fs");
|
|
12
14
|
let node_path = require("node:path");
|
|
13
15
|
node_path = require_runtime.__toESM(node_path);
|
|
14
|
-
let node_fs = require("node:fs");
|
|
15
16
|
|
|
16
17
|
//#region src/cli/commands/sync.ts
|
|
17
18
|
const PRODUCTION_ENDPOINT = "https://config.uds.build/api/config";
|
|
@@ -87,7 +88,8 @@ const syncCommand = {
|
|
|
87
88
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
88
89
|
(0, node_fs.writeFileSync)(fullPath, outFileExtension === "js" ? configContentJs : configContentTs);
|
|
89
90
|
require_print.print(require_colors.green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
90
|
-
|
|
91
|
+
const staleEditors = require_config.getEditorsWithStaleRules(process.cwd());
|
|
92
|
+
if (staleEditors.length > 0) require_box.printBox([require_colors.bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${require_colors.cyan("`uds editor-rules`")} to update.`]);
|
|
91
93
|
} catch (error) {
|
|
92
94
|
require_print.print(require_colors.red(`❌ ${error.message}`));
|
|
93
95
|
require_print.print(require_colors.yellow("Please reach out to #uds-ask channel for support."));
|
|
@@ -3,12 +3,13 @@ import { defaultTokensConfig } from "../../defaultTokensConfig.js";
|
|
|
3
3
|
import { configToBreakpointsConfigContext } from "../../runtime/breakpointsConfig.js";
|
|
4
4
|
import { configToToastConfigContext } from "../../runtime/toastConfig.js";
|
|
5
5
|
import { configToTooltipConfigContext } from "../../runtime/tooltipConfig.js";
|
|
6
|
-
import {
|
|
7
|
-
import { green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
6
|
+
import { bold, cyan, green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
8
7
|
import { print } from "../dist/lib/print.js";
|
|
8
|
+
import { printBox } from "../dist/lib/box.js";
|
|
9
|
+
import { getEditorsWithStaleRules } from "../dist/utils/rules/config.js";
|
|
9
10
|
import { sortKeys } from "./utils/sortKeys.js";
|
|
10
|
-
import path from "node:path";
|
|
11
11
|
import { writeFileSync } from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
12
13
|
|
|
13
14
|
//#region src/cli/commands/sync.ts
|
|
14
15
|
const PRODUCTION_ENDPOINT = "https://config.uds.build/api/config";
|
|
@@ -84,7 +85,8 @@ const syncCommand = {
|
|
|
84
85
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
85
86
|
writeFileSync(fullPath, outFileExtension === "js" ? configContentJs : configContentTs);
|
|
86
87
|
print(green(`✅ Synced UDS config ${id} to ${fullPath}`));
|
|
87
|
-
|
|
88
|
+
const staleEditors = getEditorsWithStaleRules(process.cwd());
|
|
89
|
+
if (staleEditors.length > 0) printBox([bold(`Updated UDS rules are available for ${staleEditors.join(" and ")}.`), `Run ${cyan("`uds editor-rules`")} to update.`]);
|
|
88
90
|
} catch (error) {
|
|
89
91
|
print(red(`❌ ${error.message}`));
|
|
90
92
|
print(yellow("Please reach out to #uds-ask channel for support."));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
3
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
-
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
5
4
|
const require_print = require('../dist/lib/print.cjs');
|
|
6
5
|
let _yahoo_uds_package_json = require("@yahoo/uds/package.json");
|
|
7
6
|
_yahoo_uds_package_json = require_runtime.__toESM(_yahoo_uds_package_json);
|
|
@@ -13,7 +12,6 @@ const versionCommand = {
|
|
|
13
12
|
description: `Display CLI version (${version})`,
|
|
14
13
|
run: async () => {
|
|
15
14
|
require_print.print(version);
|
|
16
|
-
await require_analytics.trackEvent("version", { version });
|
|
17
15
|
}
|
|
18
16
|
};
|
|
19
17
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { trackEvent } from "../dist/utils/analytics.js";
|
|
3
2
|
import { print } from "../dist/lib/print.js";
|
|
4
3
|
import pkg from "@yahoo/uds/package.json" with { type: "json" };
|
|
5
4
|
|
|
@@ -10,7 +9,6 @@ const versionCommand = {
|
|
|
10
9
|
description: `Display CLI version (${version})`,
|
|
11
10
|
run: async () => {
|
|
12
11
|
print(version);
|
|
13
|
-
await trackEvent("version", { version });
|
|
14
12
|
}
|
|
15
13
|
};
|
|
16
14
|
|
package/dist/cli/dist/cli.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
const require_analytics = require('./utils/analytics.cjs');
|
|
3
2
|
const require_args = require('./lib/args.cjs');
|
|
4
3
|
const require_colors = require('./lib/colors.cjs');
|
|
5
4
|
const require_print = require('./lib/print.cjs');
|
|
5
|
+
const require_analytics = require('./utils/analytics.cjs');
|
|
6
6
|
const require_getCommandHelp = require('./utils/getCommandHelp.cjs');
|
|
7
7
|
const require_codemod = require('./commands/codemod/codemod.cjs');
|
|
8
8
|
const require_editor_rules = require('./commands/editor-rules.cjs');
|
package/dist/cli/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { trackEvent } from "./utils/analytics.js";
|
|
3
2
|
import { parseArgs } from "./lib/args.js";
|
|
4
3
|
import { cyan, gray, green, magenta, red, white } from "./lib/colors.js";
|
|
5
4
|
import { print } from "./lib/print.js";
|
|
5
|
+
import { trackEvent } from "./utils/analytics.js";
|
|
6
6
|
import { CODEMOD_SUBCOMMANDS } from "./utils/getCommandHelp.js";
|
|
7
7
|
import { codemod_default } from "./commands/codemod/codemod.js";
|
|
8
8
|
import { editor_rules_default } from "./commands/editor-rules.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_analytics = require('../utils/analytics.cjs');
|
|
4
3
|
const require_colors = require('../lib/colors.cjs');
|
|
5
4
|
const require_print = require('../lib/print.cjs');
|
|
5
|
+
const require_analytics = require('../utils/analytics.cjs');
|
|
6
6
|
const require_config = require('../utils/rules/config.cjs');
|
|
7
|
-
let node_path = require("node:path");
|
|
8
7
|
let node_fs = require("node:fs");
|
|
8
|
+
let node_path = require("node:path");
|
|
9
9
|
|
|
10
10
|
//#region ../cli/dist/commands/editor-rules.mjs
|
|
11
11
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
@@ -20,7 +20,6 @@ var editor_rules_default = {
|
|
|
20
20
|
require_print.print(require_colors.green("Description: Generate editor rules for various code editors and AI tools"));
|
|
21
21
|
require_print.print("");
|
|
22
22
|
require_print.print(require_colors.yellow("Options:"));
|
|
23
|
-
require_print.print(" --force, -f Force overwrite existing rules directory");
|
|
24
23
|
require_print.print(" --output, -o Output directory (defaults to workspace root)");
|
|
25
24
|
require_print.print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
26
25
|
require_print.print("");
|
|
@@ -34,17 +33,17 @@ var editor_rules_default = {
|
|
|
34
33
|
require_print.print(require_colors.blue("Examples:"));
|
|
35
34
|
require_print.print(" uds editor-rules # Generate all rules in current directory");
|
|
36
35
|
require_print.print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
36
|
+
require_print.print(" uds editor-rules --editor claude # Generate only Claude Code rules");
|
|
37
37
|
require_print.print(" uds editor-rules --output /path # Generate rules in specific directory");
|
|
38
|
-
require_print.print(" uds editor-rules --force # Force overwrite existing rules");
|
|
39
38
|
require_print.print("");
|
|
40
39
|
require_print.print(require_colors.green("What it generates:"));
|
|
41
|
-
require_print.print(" • Cursor Rules (.cursor/uds/)");
|
|
40
|
+
require_print.print(" • Cursor Rules (.cursor/rules/uds/)");
|
|
41
|
+
require_print.print(" • Claude Code Rules (.claude/rules/uds/)");
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
45
|
const outputDir = options.output || process.cwd();
|
|
46
46
|
const selectedEditor = options.editor?.toLowerCase();
|
|
47
|
-
const force = options.force === "true" || options.force === true;
|
|
48
47
|
require_print.print(require_colors.blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
49
48
|
if (selectedEditor) {
|
|
50
49
|
const editorConfig = require_config.getEditorConfig(selectedEditor);
|
|
@@ -58,19 +57,18 @@ var editor_rules_default = {
|
|
|
58
57
|
}
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
|
-
await generateEditorRules(outputDir,
|
|
60
|
+
await generateEditorRules(outputDir, editorConfig);
|
|
62
61
|
} else {
|
|
63
62
|
const editors = require_config.getAvailableEditors();
|
|
64
63
|
for (const editor of editors) {
|
|
65
64
|
const editorConfig = require_config.getEditorConfig(editor);
|
|
66
|
-
if (editorConfig) await generateEditorRules(outputDir,
|
|
65
|
+
if (editorConfig) await generateEditorRules(outputDir, editorConfig);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
require_print.print(require_colors.green("🎉 Editor rules generated successfully!"));
|
|
70
69
|
require_print.print(require_colors.blue("📝 Rules are now available for your development environment"));
|
|
71
70
|
await require_analytics.trackEvent("editor_rules_generated", {
|
|
72
71
|
output_dir: outputDir,
|
|
73
|
-
force: force || false,
|
|
74
72
|
editor: selectedEditor || "all"
|
|
75
73
|
});
|
|
76
74
|
} catch (error) {
|
|
@@ -79,7 +77,7 @@ var editor_rules_default = {
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
|
-
async function generateEditorRules(outputDir,
|
|
80
|
+
async function generateEditorRules(outputDir, editorConfig) {
|
|
83
81
|
require_print.print(require_colors.blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
84
82
|
for (const rule of editorConfig.rules) {
|
|
85
83
|
require_print.print(require_colors.yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
@@ -87,15 +85,20 @@ async function generateEditorRules(outputDir, editorName, editorConfig, force =
|
|
|
87
85
|
const targetPath = (0, node_path.join)(outputDir, file.target);
|
|
88
86
|
const targetDir = (0, node_path.join)(targetPath, "..");
|
|
89
87
|
if (!(0, node_fs.existsSync)(targetDir)) (0, node_fs.mkdirSync)(targetDir, { recursive: true });
|
|
90
|
-
|
|
91
|
-
else {
|
|
92
|
-
require_print.print(require_colors.red(` ❌ File already exists: ${file.target}`));
|
|
93
|
-
require_print.print(require_colors.yellow(" Use --force to overwrite existing files"));
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
88
|
+
const exists = (0, node_fs.existsSync)(targetPath);
|
|
96
89
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
const content = require_config.getRuleContent(file.source);
|
|
91
|
+
if (exists) {
|
|
92
|
+
if ((0, node_fs.readFileSync)(targetPath, "utf-8") === content) {
|
|
93
|
+
require_print.print(require_colors.green(` ✅ Up to date: ${file.target}`));
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
(0, node_fs.writeFileSync)(targetPath, content);
|
|
97
|
+
require_print.print(require_colors.green(` ✅ Updated: ${file.target}`));
|
|
98
|
+
} else {
|
|
99
|
+
(0, node_fs.writeFileSync)(targetPath, content);
|
|
100
|
+
require_print.print(require_colors.green(` ✅ Created: ${file.target}`));
|
|
101
|
+
}
|
|
99
102
|
} catch (error) {
|
|
100
103
|
require_print.print(require_colors.red(` ❌ Error creating ${file.target}: ${error}`));
|
|
101
104
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { trackEvent } from "../utils/analytics.js";
|
|
3
2
|
import { blue, green, red, yellow } from "../lib/colors.js";
|
|
4
3
|
import { print } from "../lib/print.js";
|
|
4
|
+
import { trackEvent } from "../utils/analytics.js";
|
|
5
5
|
import { getAvailableEditors, getEditorConfig, getRuleContent } from "../utils/rules/config.js";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
7
|
import { join } from "node:path";
|
|
7
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
8
8
|
|
|
9
9
|
//#region ../cli/dist/commands/editor-rules.mjs
|
|
10
10
|
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
@@ -19,7 +19,6 @@ var editor_rules_default = {
|
|
|
19
19
|
print(green("Description: Generate editor rules for various code editors and AI tools"));
|
|
20
20
|
print("");
|
|
21
21
|
print(yellow("Options:"));
|
|
22
|
-
print(" --force, -f Force overwrite existing rules directory");
|
|
23
22
|
print(" --output, -o Output directory (defaults to workspace root)");
|
|
24
23
|
print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
25
24
|
print("");
|
|
@@ -33,17 +32,17 @@ var editor_rules_default = {
|
|
|
33
32
|
print(blue("Examples:"));
|
|
34
33
|
print(" uds editor-rules # Generate all rules in current directory");
|
|
35
34
|
print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
35
|
+
print(" uds editor-rules --editor claude # Generate only Claude Code rules");
|
|
36
36
|
print(" uds editor-rules --output /path # Generate rules in specific directory");
|
|
37
|
-
print(" uds editor-rules --force # Force overwrite existing rules");
|
|
38
37
|
print("");
|
|
39
38
|
print(green("What it generates:"));
|
|
40
|
-
print(" • Cursor Rules (.cursor/uds/)");
|
|
39
|
+
print(" • Cursor Rules (.cursor/rules/uds/)");
|
|
40
|
+
print(" • Claude Code Rules (.claude/rules/uds/)");
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
44
|
const outputDir = options.output || process.cwd();
|
|
45
45
|
const selectedEditor = options.editor?.toLowerCase();
|
|
46
|
-
const force = options.force === "true" || options.force === true;
|
|
47
46
|
print(blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
48
47
|
if (selectedEditor) {
|
|
49
48
|
const editorConfig = getEditorConfig(selectedEditor);
|
|
@@ -57,19 +56,18 @@ var editor_rules_default = {
|
|
|
57
56
|
}
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
await generateEditorRules(outputDir,
|
|
59
|
+
await generateEditorRules(outputDir, editorConfig);
|
|
61
60
|
} else {
|
|
62
61
|
const editors = getAvailableEditors();
|
|
63
62
|
for (const editor of editors) {
|
|
64
63
|
const editorConfig = getEditorConfig(editor);
|
|
65
|
-
if (editorConfig) await generateEditorRules(outputDir,
|
|
64
|
+
if (editorConfig) await generateEditorRules(outputDir, editorConfig);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
print(green("🎉 Editor rules generated successfully!"));
|
|
69
68
|
print(blue("📝 Rules are now available for your development environment"));
|
|
70
69
|
await trackEvent("editor_rules_generated", {
|
|
71
70
|
output_dir: outputDir,
|
|
72
|
-
force: force || false,
|
|
73
71
|
editor: selectedEditor || "all"
|
|
74
72
|
});
|
|
75
73
|
} catch (error) {
|
|
@@ -78,7 +76,7 @@ var editor_rules_default = {
|
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
};
|
|
81
|
-
async function generateEditorRules(outputDir,
|
|
79
|
+
async function generateEditorRules(outputDir, editorConfig) {
|
|
82
80
|
print(blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
83
81
|
for (const rule of editorConfig.rules) {
|
|
84
82
|
print(yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
@@ -86,15 +84,20 @@ async function generateEditorRules(outputDir, editorName, editorConfig, force =
|
|
|
86
84
|
const targetPath = join(outputDir, file.target);
|
|
87
85
|
const targetDir = join(targetPath, "..");
|
|
88
86
|
if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
|
|
89
|
-
|
|
90
|
-
else {
|
|
91
|
-
print(red(` ❌ File already exists: ${file.target}`));
|
|
92
|
-
print(yellow(" Use --force to overwrite existing files"));
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
87
|
+
const exists = existsSync(targetPath);
|
|
95
88
|
try {
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
const content = getRuleContent(file.source);
|
|
90
|
+
if (exists) {
|
|
91
|
+
if (readFileSync(targetPath, "utf-8") === content) {
|
|
92
|
+
print(green(` ✅ Up to date: ${file.target}`));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
writeFileSync(targetPath, content);
|
|
96
|
+
print(green(` ✅ Updated: ${file.target}`));
|
|
97
|
+
} else {
|
|
98
|
+
writeFileSync(targetPath, content);
|
|
99
|
+
print(green(` ✅ Created: ${file.target}`));
|
|
100
|
+
}
|
|
98
101
|
} catch (error) {
|
|
99
102
|
print(red(` ❌ Error creating ${file.target}: ${error}`));
|
|
100
103
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_colors = require('./colors.cjs');
|
|
3
|
+
const require_print = require('./print.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/lib/box.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
/**
|
|
8
|
+
* Strips ANSI escape codes from a string to get the visible character length.
|
|
9
|
+
*/
|
|
10
|
+
function stripAnsi(str) {
|
|
11
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prints lines inside a bordered box, similar to npm/turbo update notifications.
|
|
15
|
+
*
|
|
16
|
+
* Example output:
|
|
17
|
+
* ╭──────────────────────────────────────────────────────╮
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Updated UDS rules are available for Cursor and │
|
|
20
|
+
* │ Claude Code. Run `uds editor-rules` to update. │
|
|
21
|
+
* │ │
|
|
22
|
+
* ╰──────────────────────────────────────────────────────╯
|
|
23
|
+
*/
|
|
24
|
+
function printBox(lines) {
|
|
25
|
+
const padding = 3;
|
|
26
|
+
const innerWidth = Math.max(...lines.map((l) => stripAnsi(l).length)) + padding * 2;
|
|
27
|
+
const top = require_colors.yellow(`╭${"─".repeat(innerWidth)}╮`);
|
|
28
|
+
const bottom = require_colors.yellow(`╰${"─".repeat(innerWidth)}╯`);
|
|
29
|
+
const emptyLine = require_colors.yellow("│") + " ".repeat(innerWidth) + require_colors.yellow("│");
|
|
30
|
+
require_print.print("");
|
|
31
|
+
require_print.print(top);
|
|
32
|
+
require_print.print(emptyLine);
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const visibleLength = stripAnsi(line).length;
|
|
35
|
+
const rightPad = innerWidth - padding - visibleLength;
|
|
36
|
+
require_print.print(require_colors.yellow("│") + " ".repeat(padding) + line + " ".repeat(rightPad) + require_colors.yellow("│"));
|
|
37
|
+
}
|
|
38
|
+
require_print.print(emptyLine);
|
|
39
|
+
require_print.print(bottom);
|
|
40
|
+
require_print.print("");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.printBox = printBox;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { yellow } from "./colors.js";
|
|
3
|
+
import { print } from "./print.js";
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/lib/box.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
/**
|
|
8
|
+
* Strips ANSI escape codes from a string to get the visible character length.
|
|
9
|
+
*/
|
|
10
|
+
function stripAnsi(str) {
|
|
11
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prints lines inside a bordered box, similar to npm/turbo update notifications.
|
|
15
|
+
*
|
|
16
|
+
* Example output:
|
|
17
|
+
* ╭──────────────────────────────────────────────────────╮
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Updated UDS rules are available for Cursor and │
|
|
20
|
+
* │ Claude Code. Run `uds editor-rules` to update. │
|
|
21
|
+
* │ │
|
|
22
|
+
* ╰──────────────────────────────────────────────────────╯
|
|
23
|
+
*/
|
|
24
|
+
function printBox(lines) {
|
|
25
|
+
const padding = 3;
|
|
26
|
+
const innerWidth = Math.max(...lines.map((l) => stripAnsi(l).length)) + padding * 2;
|
|
27
|
+
const top = yellow(`╭${"─".repeat(innerWidth)}╮`);
|
|
28
|
+
const bottom = yellow(`╰${"─".repeat(innerWidth)}╯`);
|
|
29
|
+
const emptyLine = yellow("│") + " ".repeat(innerWidth) + yellow("│");
|
|
30
|
+
print("");
|
|
31
|
+
print(top);
|
|
32
|
+
print(emptyLine);
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const visibleLength = stripAnsi(line).length;
|
|
35
|
+
const rightPad = innerWidth - padding - visibleLength;
|
|
36
|
+
print(yellow("│") + " ".repeat(padding) + line + " ".repeat(rightPad) + yellow("│"));
|
|
37
|
+
}
|
|
38
|
+
print(emptyLine);
|
|
39
|
+
print(bottom);
|
|
40
|
+
print("");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { printBox };
|
|
@@ -14,9 +14,11 @@ const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
|
14
14
|
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
15
15
|
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
16
16
|
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
17
|
+
const bold = (text) => `\x1b[1m${text}\x1b[0m`;
|
|
17
18
|
|
|
18
19
|
//#endregion
|
|
19
20
|
exports.blue = blue;
|
|
21
|
+
exports.bold = bold;
|
|
20
22
|
exports.cyan = cyan;
|
|
21
23
|
exports.gray = gray;
|
|
22
24
|
exports.green = green;
|
|
@@ -13,6 +13,7 @@ const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
|
13
13
|
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
14
14
|
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
15
15
|
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
16
|
+
const bold = (text) => `\x1b[1m${text}\x1b[0m`;
|
|
16
17
|
|
|
17
18
|
//#endregion
|
|
18
|
-
export { blue, cyan, gray, green, magenta, red, white, yellow };
|
|
19
|
+
export { blue, bold, cyan, gray, green, magenta, red, white, yellow };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_colors = require('./colors.cjs');
|
|
3
|
+
const require_print = require('./print.cjs');
|
|
4
|
+
const require_spinner = require('./spinner.cjs');
|
|
5
|
+
|
|
6
|
+
//#region ../cli/dist/lib/logger.mjs
|
|
7
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
8
|
+
/**
|
|
9
|
+
* Logger utility for CLI commands.
|
|
10
|
+
* Centralizes logging behavior with support for silent mode.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Create a logger instance with optional silent mode.
|
|
14
|
+
* When silent, all logging methods become no-ops.
|
|
15
|
+
*/
|
|
16
|
+
function createLogger(options = {}) {
|
|
17
|
+
const isSilent = options.silent ?? false;
|
|
18
|
+
return {
|
|
19
|
+
isSilent,
|
|
20
|
+
print: (message) => {
|
|
21
|
+
if (!isSilent) require_print.print(message);
|
|
22
|
+
},
|
|
23
|
+
printAlways: (message) => {
|
|
24
|
+
require_print.print(message);
|
|
25
|
+
},
|
|
26
|
+
spinStart: (message) => {
|
|
27
|
+
if (!isSilent) require_spinner.spinStart(message);
|
|
28
|
+
},
|
|
29
|
+
spinStop: (icon, message) => {
|
|
30
|
+
if (!isSilent) require_spinner.spinStop(icon, message);
|
|
31
|
+
},
|
|
32
|
+
success: (message) => {
|
|
33
|
+
if (!isSilent) require_print.print(require_colors.green(`✅ ${message}`));
|
|
34
|
+
},
|
|
35
|
+
warn: (message) => {
|
|
36
|
+
if (!isSilent) require_print.print(require_colors.yellow(`⚠️ ${message}`));
|
|
37
|
+
},
|
|
38
|
+
error: (message) => {
|
|
39
|
+
require_print.print(require_colors.red(`❌ ${message}`));
|
|
40
|
+
},
|
|
41
|
+
info: (message) => {
|
|
42
|
+
if (!isSilent) require_print.print(require_colors.cyan(message));
|
|
43
|
+
},
|
|
44
|
+
label: (label, value) => {
|
|
45
|
+
if (!isSilent) require_print.print(`${require_colors.magenta(label)} ${require_colors.cyan(value)}`);
|
|
46
|
+
},
|
|
47
|
+
listItem: (text) => {
|
|
48
|
+
if (!isSilent) require_print.print(` ${require_colors.gray("•")} ${text}`);
|
|
49
|
+
},
|
|
50
|
+
timestamp: (message, color = "green") => {
|
|
51
|
+
if (isSilent) return;
|
|
52
|
+
const time = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
53
|
+
const colorFn = color === "green" ? require_colors.green : color === "yellow" ? require_colors.yellow : require_colors.red;
|
|
54
|
+
require_print.print(`${require_colors.gray(`[${time}]`)} ${colorFn(message)}`);
|
|
55
|
+
},
|
|
56
|
+
newline: () => {
|
|
57
|
+
if (!isSilent) require_print.print("");
|
|
58
|
+
},
|
|
59
|
+
child: (childOptions = {}) => {
|
|
60
|
+
return createLogger({ silent: childOptions.silent ?? isSilent });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.createLogger = createLogger;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { cyan, gray, green, magenta, red, yellow } from "./colors.js";
|
|
3
|
+
import { print } from "./print.js";
|
|
4
|
+
import { spinStart, spinStop } from "./spinner.js";
|
|
5
|
+
|
|
6
|
+
//#region ../cli/dist/lib/logger.mjs
|
|
7
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
8
|
+
/**
|
|
9
|
+
* Logger utility for CLI commands.
|
|
10
|
+
* Centralizes logging behavior with support for silent mode.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Create a logger instance with optional silent mode.
|
|
14
|
+
* When silent, all logging methods become no-ops.
|
|
15
|
+
*/
|
|
16
|
+
function createLogger(options = {}) {
|
|
17
|
+
const isSilent = options.silent ?? false;
|
|
18
|
+
return {
|
|
19
|
+
isSilent,
|
|
20
|
+
print: (message) => {
|
|
21
|
+
if (!isSilent) print(message);
|
|
22
|
+
},
|
|
23
|
+
printAlways: (message) => {
|
|
24
|
+
print(message);
|
|
25
|
+
},
|
|
26
|
+
spinStart: (message) => {
|
|
27
|
+
if (!isSilent) spinStart(message);
|
|
28
|
+
},
|
|
29
|
+
spinStop: (icon, message) => {
|
|
30
|
+
if (!isSilent) spinStop(icon, message);
|
|
31
|
+
},
|
|
32
|
+
success: (message) => {
|
|
33
|
+
if (!isSilent) print(green(`✅ ${message}`));
|
|
34
|
+
},
|
|
35
|
+
warn: (message) => {
|
|
36
|
+
if (!isSilent) print(yellow(`⚠️ ${message}`));
|
|
37
|
+
},
|
|
38
|
+
error: (message) => {
|
|
39
|
+
print(red(`❌ ${message}`));
|
|
40
|
+
},
|
|
41
|
+
info: (message) => {
|
|
42
|
+
if (!isSilent) print(cyan(message));
|
|
43
|
+
},
|
|
44
|
+
label: (label, value) => {
|
|
45
|
+
if (!isSilent) print(`${magenta(label)} ${cyan(value)}`);
|
|
46
|
+
},
|
|
47
|
+
listItem: (text) => {
|
|
48
|
+
if (!isSilent) print(` ${gray("•")} ${text}`);
|
|
49
|
+
},
|
|
50
|
+
timestamp: (message, color = "green") => {
|
|
51
|
+
if (isSilent) return;
|
|
52
|
+
const time = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
53
|
+
const colorFn = color === "green" ? green : color === "yellow" ? yellow : red;
|
|
54
|
+
print(`${gray(`[${time}]`)} ${colorFn(message)}`);
|
|
55
|
+
},
|
|
56
|
+
newline: () => {
|
|
57
|
+
if (!isSilent) print("");
|
|
58
|
+
},
|
|
59
|
+
child: (childOptions = {}) => {
|
|
60
|
+
return createLogger({ silent: childOptions.silent ?? isSilent });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { createLogger };
|