@yahoo/uds 3.96.0 → 3.97.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/dist/cli/commands/purge.cjs +26 -0
- package/dist/cli/commands/purge.d.cts +15 -0
- package/dist/cli/commands/purge.d.ts +15 -0
- package/dist/cli/commands/purge.js +25 -0
- package/dist/cli/commands/sync.cjs +96 -0
- package/dist/cli/commands/sync.d.cts +16 -0
- package/dist/cli/commands/sync.d.ts +16 -0
- package/dist/cli/commands/sync.js +93 -0
- package/dist/cli/commands/utils/purgeCSS.cjs +258 -0
- package/dist/cli/commands/utils/purgeCSS.d.cts +59 -0
- package/dist/cli/commands/utils/purgeCSS.d.ts +59 -0
- package/dist/cli/commands/utils/purgeCSS.js +244 -0
- package/dist/cli/commands/utils/sortKeys.cjs +23 -0
- package/dist/cli/commands/utils/sortKeys.d.cts +5 -0
- package/dist/cli/commands/utils/sortKeys.d.ts +5 -0
- package/dist/cli/commands/utils/sortKeys.js +21 -0
- package/dist/cli/commands/version.cjs +21 -0
- package/dist/cli/commands/version.d.cts +7 -0
- package/dist/cli/commands/version.d.ts +7 -0
- package/dist/cli/commands/version.js +18 -0
- package/dist/cli/dist/cli.cjs +78 -0
- package/dist/cli/dist/cli.js +78 -0
- package/dist/cli/dist/commands/codemod/codemod.cjs +81 -0
- package/dist/cli/dist/commands/codemod/codemod.js +79 -0
- package/dist/cli/dist/commands/editor-rules.cjs +107 -0
- package/dist/cli/dist/commands/editor-rules.js +106 -0
- package/dist/cli/dist/lib/args.cjs +32 -0
- package/dist/cli/dist/lib/args.js +31 -0
- package/dist/cli/dist/lib/colors.cjs +26 -0
- package/dist/cli/dist/lib/colors.js +18 -0
- package/dist/cli/dist/lib/print.cjs +13 -0
- package/dist/cli/dist/lib/print.js +12 -0
- package/dist/cli/dist/lib/spinner.cjs +59 -0
- package/dist/cli/dist/lib/spinner.js +57 -0
- package/dist/cli/dist/utils/analytics.cjs +33 -0
- package/dist/cli/dist/utils/analytics.js +32 -0
- package/dist/cli/dist/utils/getCommandHelp.cjs +58 -0
- package/dist/cli/dist/utils/getCommandHelp.js +56 -0
- package/dist/cli/dist/utils/getDirChoices.cjs +27 -0
- package/dist/cli/dist/utils/getDirChoices.js +25 -0
- package/dist/cli/dist/utils/rules/config.cjs +56 -0
- package/dist/cli/dist/utils/rules/config.js +53 -0
- package/dist/cli/runner.cjs +14 -0
- package/dist/cli/runner.d.cts +2 -0
- package/dist/cli/runner.d.ts +2 -0
- package/dist/cli/runner.js +14 -0
- package/dist/styles/styler.d.cts +32 -32
- package/dist/styles/styler.d.ts +32 -32
- package/dist/tailwind/tailwindPlugin.d.cts +1 -1
- package/dist/tailwind/tailwindPlugin.d.ts +1 -1
- package/dist/tailwind/utils/getShadowStyles.d.cts +4 -4
- package/dist/tailwind/utils/getShadowStyles.d.ts +4 -4
- package/dist/uds/scripts/utils/tsMorph.cjs +1 -1
- package/dist/uds/scripts/utils/tsMorph.d.cts +1 -1
- package/dist/uds/scripts/utils/tsMorph.d.ts +1 -1
- package/package.json +5 -8
- package/uds.js +11 -1
- package/dist/cli.mjs +0 -897
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { trackEvent } from "../../utils/analytics.js";
|
|
3
|
+
import { getCommandHelp, getSubCommandsChoices } from "../../utils/getCommandHelp.js";
|
|
4
|
+
import { getDirChoices } from "../../utils/getDirChoices.js";
|
|
5
|
+
import prompts from "prompts";
|
|
6
|
+
|
|
7
|
+
//#region ../cli/dist/commands/codemod/codemod.mjs
|
|
8
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
9
|
+
var codemod_default = {
|
|
10
|
+
name: "codemod",
|
|
11
|
+
description: `Apply a codemod`,
|
|
12
|
+
run: async (props) => {
|
|
13
|
+
const subCommands = await getSubCommandsChoices(props);
|
|
14
|
+
const subCommandIsValid = subCommands.some(({ value }) => props?.first === value);
|
|
15
|
+
const wantsHelp = props.options.help || props.options.h;
|
|
16
|
+
const isRootCommand = Boolean(!props?.first);
|
|
17
|
+
const dirChoices = getDirChoices();
|
|
18
|
+
if (wantsHelp) return getCommandHelp(props);
|
|
19
|
+
const runCodeMod = async (codemod, selectedDirs) => {
|
|
20
|
+
return (await import(`./${codemod}`)).default.run({
|
|
21
|
+
...props,
|
|
22
|
+
selectedDirs
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
if (isRootCommand) {
|
|
26
|
+
const { selectedDirs, selectedCodemods, didConfirm } = await prompts([
|
|
27
|
+
{
|
|
28
|
+
type: "multiselect",
|
|
29
|
+
name: "selectedDirs",
|
|
30
|
+
instructions: false,
|
|
31
|
+
message: "Where are your sourcefiles?",
|
|
32
|
+
hint: "(Space to select. Return to submit)",
|
|
33
|
+
choices: dirChoices
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "multiselect",
|
|
37
|
+
name: "selectedCodemods",
|
|
38
|
+
instructions: false,
|
|
39
|
+
message: "Select the codemods you want to run",
|
|
40
|
+
hint: "(Space to select. Return to submit)",
|
|
41
|
+
choices: subCommands
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "toggle",
|
|
45
|
+
name: "didConfirm",
|
|
46
|
+
message: "Are you ready?",
|
|
47
|
+
initial: true,
|
|
48
|
+
active: "yes",
|
|
49
|
+
inactive: "no"
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
if (!selectedDirs?.length || !selectedCodemods?.length || !didConfirm) process.exit(1);
|
|
53
|
+
await Promise.all(selectedCodemods.map(async (codemod) => {
|
|
54
|
+
await runCodeMod(codemod, selectedDirs);
|
|
55
|
+
return trackEvent("codemod", { codemod });
|
|
56
|
+
}));
|
|
57
|
+
return;
|
|
58
|
+
} else if (subCommandIsValid) {
|
|
59
|
+
const { selectedDirs } = await prompts({
|
|
60
|
+
type: "multiselect",
|
|
61
|
+
name: "selectedDirs",
|
|
62
|
+
instructions: false,
|
|
63
|
+
message: "Where are your sourcefiles?",
|
|
64
|
+
hint: "(Space to select. Return to submit)",
|
|
65
|
+
choices: dirChoices
|
|
66
|
+
});
|
|
67
|
+
if (!selectedDirs?.length) process.exit(1);
|
|
68
|
+
const codemod = props.first;
|
|
69
|
+
await runCodeMod(codemod, selectedDirs);
|
|
70
|
+
return trackEvent("codemod", { codemod });
|
|
71
|
+
} else await getCommandHelp({
|
|
72
|
+
...props,
|
|
73
|
+
notes: `That codemod does not exist. Try one of the codemods listed above!`
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { codemod_default };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_analytics = require('../utils/analytics.cjs');
|
|
4
|
+
const require_colors = require('../lib/colors.cjs');
|
|
5
|
+
const require_print = require('../lib/print.cjs');
|
|
6
|
+
const require_config = require('../utils/rules/config.cjs');
|
|
7
|
+
let node_fs = require("node:fs");
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
|
|
10
|
+
//#region ../cli/dist/commands/editor-rules.mjs
|
|
11
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
12
|
+
var editor_rules_default = {
|
|
13
|
+
name: "editor-rules",
|
|
14
|
+
description: "🎯 Generate editor rules for various code editors and AI tools",
|
|
15
|
+
alias: ["rules", "editor"],
|
|
16
|
+
run: async ({ options }) => {
|
|
17
|
+
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
18
|
+
require_print.print(require_colors.blue("🎯 UDS Editor Rules Command"));
|
|
19
|
+
require_print.print("");
|
|
20
|
+
require_print.print(require_colors.green("Description: Generate editor rules for various code editors and AI tools"));
|
|
21
|
+
require_print.print("");
|
|
22
|
+
require_print.print(require_colors.yellow("Options:"));
|
|
23
|
+
require_print.print(" --force, -f Force overwrite existing rules directory");
|
|
24
|
+
require_print.print(" --output, -o Output directory (defaults to workspace root)");
|
|
25
|
+
require_print.print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
26
|
+
require_print.print("");
|
|
27
|
+
require_print.print(require_colors.blue("Available editors/tools:"));
|
|
28
|
+
const editors = require_config.getAvailableEditors();
|
|
29
|
+
for (const editor of editors) {
|
|
30
|
+
const config = require_config.getEditorConfig(editor);
|
|
31
|
+
if (config) require_print.print(` • ${editor}: ${config.description}`);
|
|
32
|
+
}
|
|
33
|
+
require_print.print("");
|
|
34
|
+
require_print.print(require_colors.blue("Examples:"));
|
|
35
|
+
require_print.print(" uds editor-rules # Generate all rules in current directory");
|
|
36
|
+
require_print.print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
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
|
+
require_print.print("");
|
|
40
|
+
require_print.print(require_colors.green("What it generates:"));
|
|
41
|
+
require_print.print(" • Cursor Rules (.cursor/uds/)");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const outputDir = options.output || process.cwd();
|
|
46
|
+
const selectedEditor = options.editor?.toLowerCase();
|
|
47
|
+
const force = options.force === "true" || options.force === true;
|
|
48
|
+
require_print.print(require_colors.blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
49
|
+
if (selectedEditor) {
|
|
50
|
+
const editorConfig = require_config.getEditorConfig(selectedEditor);
|
|
51
|
+
if (!editorConfig) {
|
|
52
|
+
require_print.print(require_colors.red(`❌ Unknown editor: ${selectedEditor}`));
|
|
53
|
+
require_print.print(require_colors.yellow("Available editors:"));
|
|
54
|
+
const editors = require_config.getAvailableEditors();
|
|
55
|
+
for (const editor of editors) {
|
|
56
|
+
const config = require_config.getEditorConfig(editor);
|
|
57
|
+
if (config) require_print.print(` • ${editor}: ${config.description}`);
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await generateEditorRules(outputDir, selectedEditor, editorConfig, force);
|
|
62
|
+
} else {
|
|
63
|
+
const editors = require_config.getAvailableEditors();
|
|
64
|
+
for (const editor of editors) {
|
|
65
|
+
const editorConfig = require_config.getEditorConfig(editor);
|
|
66
|
+
if (editorConfig) await generateEditorRules(outputDir, editor, editorConfig, force);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
require_print.print(require_colors.green("🎉 Editor rules generated successfully!"));
|
|
70
|
+
require_print.print(require_colors.blue("📝 Rules are now available for your development environment"));
|
|
71
|
+
await require_analytics.trackEvent("editor_rules_generated", {
|
|
72
|
+
output_dir: outputDir,
|
|
73
|
+
force: force || false,
|
|
74
|
+
editor: selectedEditor || "all"
|
|
75
|
+
});
|
|
76
|
+
} catch (error) {
|
|
77
|
+
require_print.print(require_colors.red(`❌ Error generating editor rules: ${error}`));
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
async function generateEditorRules(outputDir, editorName, editorConfig, force = false) {
|
|
83
|
+
require_print.print(require_colors.blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
84
|
+
for (const rule of editorConfig.rules) {
|
|
85
|
+
require_print.print(require_colors.yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
86
|
+
for (const file of rule.files) {
|
|
87
|
+
const targetPath = (0, node_path.join)(outputDir, file.target);
|
|
88
|
+
const targetDir = (0, node_path.join)(targetPath, "..");
|
|
89
|
+
if (!(0, node_fs.existsSync)(targetDir)) (0, node_fs.mkdirSync)(targetDir, { recursive: true });
|
|
90
|
+
if ((0, node_fs.existsSync)(targetPath)) if (force) require_print.print(require_colors.yellow(` 🗑️ Overwriting: ${file.target}`));
|
|
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
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
(0, node_fs.writeFileSync)(targetPath, require_config.getRuleContent(file.source));
|
|
98
|
+
require_print.print(require_colors.green(` ✅ Created: ${file.target}`));
|
|
99
|
+
} catch (error) {
|
|
100
|
+
require_print.print(require_colors.red(` ❌ Error creating ${file.target}: ${error}`));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
exports.editor_rules_default = editor_rules_default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { trackEvent } from "../utils/analytics.js";
|
|
3
|
+
import { blue, green, red, yellow } from "../lib/colors.js";
|
|
4
|
+
import { print } from "../lib/print.js";
|
|
5
|
+
import { getAvailableEditors, getEditorConfig, getRuleContent } from "../utils/rules/config.js";
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
|
|
9
|
+
//#region ../cli/dist/commands/editor-rules.mjs
|
|
10
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
11
|
+
var editor_rules_default = {
|
|
12
|
+
name: "editor-rules",
|
|
13
|
+
description: "🎯 Generate editor rules for various code editors and AI tools",
|
|
14
|
+
alias: ["rules", "editor"],
|
|
15
|
+
run: async ({ options }) => {
|
|
16
|
+
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
17
|
+
print(blue("🎯 UDS Editor Rules Command"));
|
|
18
|
+
print("");
|
|
19
|
+
print(green("Description: Generate editor rules for various code editors and AI tools"));
|
|
20
|
+
print("");
|
|
21
|
+
print(yellow("Options:"));
|
|
22
|
+
print(" --force, -f Force overwrite existing rules directory");
|
|
23
|
+
print(" --output, -o Output directory (defaults to workspace root)");
|
|
24
|
+
print(" --editor, -e Specific editor/tool (defaults to all)");
|
|
25
|
+
print("");
|
|
26
|
+
print(blue("Available editors/tools:"));
|
|
27
|
+
const editors = getAvailableEditors();
|
|
28
|
+
for (const editor of editors) {
|
|
29
|
+
const config = getEditorConfig(editor);
|
|
30
|
+
if (config) print(` • ${editor}: ${config.description}`);
|
|
31
|
+
}
|
|
32
|
+
print("");
|
|
33
|
+
print(blue("Examples:"));
|
|
34
|
+
print(" uds editor-rules # Generate all rules in current directory");
|
|
35
|
+
print(" uds editor-rules --editor cursor # Generate only Cursor rules");
|
|
36
|
+
print(" uds editor-rules --output /path # Generate rules in specific directory");
|
|
37
|
+
print(" uds editor-rules --force # Force overwrite existing rules");
|
|
38
|
+
print("");
|
|
39
|
+
print(green("What it generates:"));
|
|
40
|
+
print(" • Cursor Rules (.cursor/uds/)");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const outputDir = options.output || process.cwd();
|
|
45
|
+
const selectedEditor = options.editor?.toLowerCase();
|
|
46
|
+
const force = options.force === "true" || options.force === true;
|
|
47
|
+
print(blue(`📁 Generating editor rules in: ${outputDir}`));
|
|
48
|
+
if (selectedEditor) {
|
|
49
|
+
const editorConfig = getEditorConfig(selectedEditor);
|
|
50
|
+
if (!editorConfig) {
|
|
51
|
+
print(red(`❌ Unknown editor: ${selectedEditor}`));
|
|
52
|
+
print(yellow("Available editors:"));
|
|
53
|
+
const editors = getAvailableEditors();
|
|
54
|
+
for (const editor of editors) {
|
|
55
|
+
const config = getEditorConfig(editor);
|
|
56
|
+
if (config) print(` • ${editor}: ${config.description}`);
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
await generateEditorRules(outputDir, selectedEditor, editorConfig, force);
|
|
61
|
+
} else {
|
|
62
|
+
const editors = getAvailableEditors();
|
|
63
|
+
for (const editor of editors) {
|
|
64
|
+
const editorConfig = getEditorConfig(editor);
|
|
65
|
+
if (editorConfig) await generateEditorRules(outputDir, editor, editorConfig, force);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
print(green("🎉 Editor rules generated successfully!"));
|
|
69
|
+
print(blue("📝 Rules are now available for your development environment"));
|
|
70
|
+
await trackEvent("editor_rules_generated", {
|
|
71
|
+
output_dir: outputDir,
|
|
72
|
+
force: force || false,
|
|
73
|
+
editor: selectedEditor || "all"
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
print(red(`❌ Error generating editor rules: ${error}`));
|
|
77
|
+
process.exitCode = 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
async function generateEditorRules(outputDir, editorName, editorConfig, force = false) {
|
|
82
|
+
print(blue(`\n🔧 Generating ${editorConfig.name} rules...`));
|
|
83
|
+
for (const rule of editorConfig.rules) {
|
|
84
|
+
print(yellow(` 📝 ${rule.name}: ${rule.description}`));
|
|
85
|
+
for (const file of rule.files) {
|
|
86
|
+
const targetPath = join(outputDir, file.target);
|
|
87
|
+
const targetDir = join(targetPath, "..");
|
|
88
|
+
if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
|
|
89
|
+
if (existsSync(targetPath)) if (force) print(yellow(` 🗑️ Overwriting: ${file.target}`));
|
|
90
|
+
else {
|
|
91
|
+
print(red(` ❌ File already exists: ${file.target}`));
|
|
92
|
+
print(yellow(" Use --force to overwrite existing files"));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
writeFileSync(targetPath, getRuleContent(file.source));
|
|
97
|
+
print(green(` ✅ Created: ${file.target}`));
|
|
98
|
+
} catch (error) {
|
|
99
|
+
print(red(` ❌ Error creating ${file.target}: ${error}`));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { editor_rules_default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
|
|
3
|
+
//#region ../cli/dist/lib/args.mjs
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* Parse command line arguments.
|
|
7
|
+
* @param argv - Arguments to parse (typically process.argv.slice(2))
|
|
8
|
+
* @returns Parsed positional args and options
|
|
9
|
+
*/
|
|
10
|
+
function parseArgs(argv) {
|
|
11
|
+
const positional = [];
|
|
12
|
+
const options = {};
|
|
13
|
+
for (let i = 0; i < argv.length; i++) {
|
|
14
|
+
const arg = argv[i];
|
|
15
|
+
if (arg.startsWith("--")) {
|
|
16
|
+
const key = arg.slice(2);
|
|
17
|
+
const next = argv[i + 1];
|
|
18
|
+
options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
|
|
19
|
+
} else if (arg.startsWith("-") && arg.length === 2) {
|
|
20
|
+
const key = arg.slice(1);
|
|
21
|
+
const next = argv[i + 1];
|
|
22
|
+
options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
|
|
23
|
+
} else positional.push(arg);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
positional,
|
|
27
|
+
options
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.parseArgs = parseArgs;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../cli/dist/lib/args.mjs
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
4
|
+
/**
|
|
5
|
+
* Parse command line arguments.
|
|
6
|
+
* @param argv - Arguments to parse (typically process.argv.slice(2))
|
|
7
|
+
* @returns Parsed positional args and options
|
|
8
|
+
*/
|
|
9
|
+
function parseArgs(argv) {
|
|
10
|
+
const positional = [];
|
|
11
|
+
const options = {};
|
|
12
|
+
for (let i = 0; i < argv.length; i++) {
|
|
13
|
+
const arg = argv[i];
|
|
14
|
+
if (arg.startsWith("--")) {
|
|
15
|
+
const key = arg.slice(2);
|
|
16
|
+
const next = argv[i + 1];
|
|
17
|
+
options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
|
|
18
|
+
} else if (arg.startsWith("-") && arg.length === 2) {
|
|
19
|
+
const key = arg.slice(1);
|
|
20
|
+
const next = argv[i + 1];
|
|
21
|
+
options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
|
|
22
|
+
} else positional.push(arg);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
positional,
|
|
26
|
+
options
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { parseArgs };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
|
|
3
|
+
//#region ../cli/dist/lib/colors.mjs
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* ANSI escape code color utilities for terminal output.
|
|
7
|
+
* Zero dependencies - uses standard ANSI escape sequences.
|
|
8
|
+
*/
|
|
9
|
+
const red = (text) => `\x1b[31m${text}\x1b[0m`;
|
|
10
|
+
const green = (text) => `\x1b[32m${text}\x1b[0m`;
|
|
11
|
+
const yellow = (text) => `\x1b[33m${text}\x1b[0m`;
|
|
12
|
+
const blue = (text) => `\x1b[34m${text}\x1b[0m`;
|
|
13
|
+
const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
14
|
+
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
15
|
+
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
16
|
+
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.blue = blue;
|
|
20
|
+
exports.cyan = cyan;
|
|
21
|
+
exports.gray = gray;
|
|
22
|
+
exports.green = green;
|
|
23
|
+
exports.magenta = magenta;
|
|
24
|
+
exports.red = red;
|
|
25
|
+
exports.white = white;
|
|
26
|
+
exports.yellow = yellow;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../cli/dist/lib/colors.mjs
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
4
|
+
/**
|
|
5
|
+
* ANSI escape code color utilities for terminal output.
|
|
6
|
+
* Zero dependencies - uses standard ANSI escape sequences.
|
|
7
|
+
*/
|
|
8
|
+
const red = (text) => `\x1b[31m${text}\x1b[0m`;
|
|
9
|
+
const green = (text) => `\x1b[32m${text}\x1b[0m`;
|
|
10
|
+
const yellow = (text) => `\x1b[33m${text}\x1b[0m`;
|
|
11
|
+
const blue = (text) => `\x1b[34m${text}\x1b[0m`;
|
|
12
|
+
const magenta = (text) => `\x1b[35m${text}\x1b[0m`;
|
|
13
|
+
const cyan = (text) => `\x1b[36m${text}\x1b[0m`;
|
|
14
|
+
const white = (text) => `\x1b[37m${text}\x1b[0m`;
|
|
15
|
+
const gray = (text) => `\x1b[2m${text}\x1b[0m`;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { blue, cyan, gray, green, magenta, red, white, yellow };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
|
|
3
|
+
//#region ../cli/dist/lib/print.mjs
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* Console output wrapper.
|
|
7
|
+
*/
|
|
8
|
+
function print(...args) {
|
|
9
|
+
console.log(...args);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.print = print;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../cli/dist/lib/print.mjs
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
4
|
+
/**
|
|
5
|
+
* Console output wrapper.
|
|
6
|
+
*/
|
|
7
|
+
function print(...args) {
|
|
8
|
+
console.log(...args);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { print };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
|
|
3
|
+
//#region ../cli/dist/lib/spinner.mjs
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* Simple terminal spinner for showing progress during long operations.
|
|
7
|
+
* Uses Braille spinner characters for a smooth animation.
|
|
8
|
+
*/
|
|
9
|
+
let spinnerInterval = null;
|
|
10
|
+
let currentMessage = "";
|
|
11
|
+
const frames = [
|
|
12
|
+
"⠋",
|
|
13
|
+
"⠙",
|
|
14
|
+
"⠹",
|
|
15
|
+
"⠸",
|
|
16
|
+
"⠼",
|
|
17
|
+
"⠴",
|
|
18
|
+
"⠦",
|
|
19
|
+
"⠧",
|
|
20
|
+
"⠇",
|
|
21
|
+
"⠏"
|
|
22
|
+
];
|
|
23
|
+
let frameIndex = 0;
|
|
24
|
+
/**
|
|
25
|
+
* Start a spinner with a message.
|
|
26
|
+
* Only one spinner can be active at a time.
|
|
27
|
+
*/
|
|
28
|
+
function spinStart(message) {
|
|
29
|
+
if (spinnerInterval) spinStop();
|
|
30
|
+
currentMessage = message;
|
|
31
|
+
frameIndex = 0;
|
|
32
|
+
process.stdout.write("\x1B[?25l");
|
|
33
|
+
spinnerInterval = setInterval(() => {
|
|
34
|
+
const frame = frames[frameIndex];
|
|
35
|
+
process.stdout.write(`\r${frame} ${currentMessage}`);
|
|
36
|
+
frameIndex = (frameIndex + 1) % frames.length;
|
|
37
|
+
}, 80);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stop the spinner and optionally show a final message.
|
|
41
|
+
* @param iconOrMessage - Optional icon to show OR the message if second param not provided
|
|
42
|
+
* @param message - Optional final message to display
|
|
43
|
+
*/
|
|
44
|
+
function spinStop(iconOrMessage, message) {
|
|
45
|
+
if (spinnerInterval) {
|
|
46
|
+
clearInterval(spinnerInterval);
|
|
47
|
+
spinnerInterval = null;
|
|
48
|
+
}
|
|
49
|
+
process.stdout.write("\r\x1B[K");
|
|
50
|
+
process.stdout.write("\x1B[?25h");
|
|
51
|
+
if (iconOrMessage || message) {
|
|
52
|
+
const finalMessage = message ? `${iconOrMessage} ${message}` : iconOrMessage;
|
|
53
|
+
console.log(finalMessage);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.spinStart = spinStart;
|
|
59
|
+
exports.spinStop = spinStop;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../cli/dist/lib/spinner.mjs
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
4
|
+
/**
|
|
5
|
+
* Simple terminal spinner for showing progress during long operations.
|
|
6
|
+
* Uses Braille spinner characters for a smooth animation.
|
|
7
|
+
*/
|
|
8
|
+
let spinnerInterval = null;
|
|
9
|
+
let currentMessage = "";
|
|
10
|
+
const frames = [
|
|
11
|
+
"⠋",
|
|
12
|
+
"⠙",
|
|
13
|
+
"⠹",
|
|
14
|
+
"⠸",
|
|
15
|
+
"⠼",
|
|
16
|
+
"⠴",
|
|
17
|
+
"⠦",
|
|
18
|
+
"⠧",
|
|
19
|
+
"⠇",
|
|
20
|
+
"⠏"
|
|
21
|
+
];
|
|
22
|
+
let frameIndex = 0;
|
|
23
|
+
/**
|
|
24
|
+
* Start a spinner with a message.
|
|
25
|
+
* Only one spinner can be active at a time.
|
|
26
|
+
*/
|
|
27
|
+
function spinStart(message) {
|
|
28
|
+
if (spinnerInterval) spinStop();
|
|
29
|
+
currentMessage = message;
|
|
30
|
+
frameIndex = 0;
|
|
31
|
+
process.stdout.write("\x1B[?25l");
|
|
32
|
+
spinnerInterval = setInterval(() => {
|
|
33
|
+
const frame = frames[frameIndex];
|
|
34
|
+
process.stdout.write(`\r${frame} ${currentMessage}`);
|
|
35
|
+
frameIndex = (frameIndex + 1) % frames.length;
|
|
36
|
+
}, 80);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Stop the spinner and optionally show a final message.
|
|
40
|
+
* @param iconOrMessage - Optional icon to show OR the message if second param not provided
|
|
41
|
+
* @param message - Optional final message to display
|
|
42
|
+
*/
|
|
43
|
+
function spinStop(iconOrMessage, message) {
|
|
44
|
+
if (spinnerInterval) {
|
|
45
|
+
clearInterval(spinnerInterval);
|
|
46
|
+
spinnerInterval = null;
|
|
47
|
+
}
|
|
48
|
+
process.stdout.write("\r\x1B[K");
|
|
49
|
+
process.stdout.write("\x1B[?25h");
|
|
50
|
+
if (iconOrMessage || message) {
|
|
51
|
+
const finalMessage = message ? `${iconOrMessage} ${message}` : iconOrMessage;
|
|
52
|
+
console.log(finalMessage);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { spinStart, spinStop };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_child_process = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/utils/analytics.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
async function trackEvent(eventName, eventParams) {
|
|
8
|
+
try {
|
|
9
|
+
let userEmail = "unknown";
|
|
10
|
+
if (process.env.CI) userEmail = "CI";
|
|
11
|
+
else try {
|
|
12
|
+
userEmail = (0, node_child_process.execSync)("git config user.email", {
|
|
13
|
+
encoding: "utf8",
|
|
14
|
+
stdio: "pipe"
|
|
15
|
+
}).trim();
|
|
16
|
+
} catch {}
|
|
17
|
+
const team = process.env.UDS_TEAM_SLUG;
|
|
18
|
+
const request = new Request("https://config.uds.build/api/cli-analytics", {
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: JSON.stringify({
|
|
21
|
+
userEmail,
|
|
22
|
+
team,
|
|
23
|
+
eventName,
|
|
24
|
+
eventParams
|
|
25
|
+
}),
|
|
26
|
+
headers: { "Content-Type": "application/json" }
|
|
27
|
+
});
|
|
28
|
+
await fetch(request);
|
|
29
|
+
} catch (_error) {}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.trackEvent = trackEvent;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
//#region ../cli/dist/utils/analytics.mjs
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
6
|
+
async function trackEvent(eventName, eventParams) {
|
|
7
|
+
try {
|
|
8
|
+
let userEmail = "unknown";
|
|
9
|
+
if (process.env.CI) userEmail = "CI";
|
|
10
|
+
else try {
|
|
11
|
+
userEmail = execSync("git config user.email", {
|
|
12
|
+
encoding: "utf8",
|
|
13
|
+
stdio: "pipe"
|
|
14
|
+
}).trim();
|
|
15
|
+
} catch {}
|
|
16
|
+
const team = process.env.UDS_TEAM_SLUG;
|
|
17
|
+
const request = new Request("https://config.uds.build/api/cli-analytics", {
|
|
18
|
+
method: "POST",
|
|
19
|
+
body: JSON.stringify({
|
|
20
|
+
userEmail,
|
|
21
|
+
team,
|
|
22
|
+
eventName,
|
|
23
|
+
eventParams
|
|
24
|
+
}),
|
|
25
|
+
headers: { "Content-Type": "application/json" }
|
|
26
|
+
});
|
|
27
|
+
await fetch(request);
|
|
28
|
+
} catch (_error) {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { trackEvent };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_colors = require('../lib/colors.cjs');
|
|
3
|
+
const require_print = require('../lib/print.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../cli/dist/utils/getCommandHelp.mjs
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
|
|
7
|
+
const CODEMOD_SUBCOMMANDS = [
|
|
8
|
+
{
|
|
9
|
+
name: "sizingProps",
|
|
10
|
+
description: "Convert sizing props to classNames"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "spacingProps",
|
|
14
|
+
description: "Migrate spacing props from old to new values"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "tailwindClassesToProps",
|
|
18
|
+
description: "Convert Tailwind classes to UDS props"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "flattenButtonVariant",
|
|
22
|
+
description: "Flatten Button variant props"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "buttonType",
|
|
26
|
+
description: "Add type attribute to Button components"
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
const banner = `
|
|
30
|
+
█ █ █▀▄ ▄▀▀ ▄▀▀ █ █
|
|
31
|
+
▀▄█ █▄▀ ▄██ ▀▄▄ █▄▄ █
|
|
32
|
+
Universal Design System
|
|
33
|
+
`.trim();
|
|
34
|
+
async function getCommandHelp(props) {
|
|
35
|
+
const { name, commandPath, notes } = props;
|
|
36
|
+
const category = commandPath?.[0];
|
|
37
|
+
require_print.print(`\n${require_colors.green(banner)}\n`);
|
|
38
|
+
require_print.print(`${require_colors.magenta("Usage:")} ${require_colors.white(`${name} <command>`)}\n`);
|
|
39
|
+
if (category === "codemod") {
|
|
40
|
+
require_print.print(`${require_colors.magenta("Codemods:")}`);
|
|
41
|
+
const widest = Math.max(...CODEMOD_SUBCOMMANDS.map((c) => c.name.length)) + 4;
|
|
42
|
+
for (const cmd of CODEMOD_SUBCOMMANDS) require_print.print(` ${require_colors.cyan(`${name} codemod ${cmd.name}`.padEnd(widest + 12))} ${require_colors.gray(cmd.description)}`);
|
|
43
|
+
}
|
|
44
|
+
if (notes) require_print.print(`\n${require_colors.magenta("Notes:")} ${notes}`);
|
|
45
|
+
require_print.print("");
|
|
46
|
+
}
|
|
47
|
+
async function getSubCommandsChoices(_props) {
|
|
48
|
+
return CODEMOD_SUBCOMMANDS.map((cmd) => ({
|
|
49
|
+
title: `${cmd.name} (${cmd.description})`,
|
|
50
|
+
value: cmd.name,
|
|
51
|
+
selected: true
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.CODEMOD_SUBCOMMANDS = CODEMOD_SUBCOMMANDS;
|
|
57
|
+
exports.getCommandHelp = getCommandHelp;
|
|
58
|
+
exports.getSubCommandsChoices = getSubCommandsChoices;
|