@exem-ui/cli 0.1.0 → 0.3.2-next.20260227091619
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 +183 -183
- package/README.md +15 -15
- package/dist/index.js +122 -29
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -793,10 +793,11 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
|
793
793
|
|
|
794
794
|
// src/templates/tailwind-v3.ts
|
|
795
795
|
var TAILWIND_V3_CONFIG = `import type { Config } from 'tailwindcss';
|
|
796
|
-
import
|
|
796
|
+
import exemPlugin from '@exem-ui/tailwindcss3/plugin';
|
|
797
797
|
|
|
798
798
|
const config: Config = {
|
|
799
|
-
|
|
799
|
+
darkMode: 'class',
|
|
800
|
+
plugins: [exemPlugin],
|
|
800
801
|
content: [
|
|
801
802
|
'./src/**/*.{js,ts,jsx,tsx}',
|
|
802
803
|
'./node_modules/@exem-ui/react/dist/**/*.{js,mjs}',
|
|
@@ -806,17 +807,20 @@ const config: Config = {
|
|
|
806
807
|
export default config;
|
|
807
808
|
`;
|
|
808
809
|
var TAILWIND_V3_MANUAL_MSG = `
|
|
809
|
-
Add the
|
|
810
|
+
Add the Exem UI plugin to your existing tailwind.config.ts:
|
|
810
811
|
|
|
811
|
-
import
|
|
812
|
+
import exemPlugin from '@exem-ui/tailwindcss3/plugin';
|
|
812
813
|
|
|
813
814
|
export default {
|
|
814
|
-
|
|
815
|
+
darkMode: 'class',
|
|
816
|
+
plugins: [exemPlugin],
|
|
815
817
|
content: [
|
|
816
818
|
// ... your existing content paths
|
|
817
819
|
'./node_modules/@exem-ui/react/dist/**/*.{js,mjs}',
|
|
818
820
|
],
|
|
819
821
|
};
|
|
822
|
+
|
|
823
|
+
\u{1F4D6} https://ui.ex-em.com/getting-started/installation
|
|
820
824
|
`;
|
|
821
825
|
|
|
822
826
|
// src/templates/tailwind-v4.ts
|
|
@@ -925,7 +929,7 @@ var PACKAGES = [
|
|
|
925
929
|
|
|
926
930
|
// src/commands/init.ts
|
|
927
931
|
async function init() {
|
|
928
|
-
we(import_picocolors2.default.bgCyan(import_picocolors2.default.black("
|
|
932
|
+
we(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" Exem UI Setup ")));
|
|
929
933
|
const detectedPm = detectPackageManager();
|
|
930
934
|
const pm = await de({
|
|
931
935
|
message: "Which package manager do you use?",
|
|
@@ -938,24 +942,21 @@ async function init() {
|
|
|
938
942
|
ve("Setup cancelled.");
|
|
939
943
|
process.exit(0);
|
|
940
944
|
}
|
|
941
|
-
const
|
|
942
|
-
message: "Which
|
|
943
|
-
options:
|
|
944
|
-
value:
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
945
|
+
const framework = await de({
|
|
946
|
+
message: "Which framework are you using?",
|
|
947
|
+
options: [
|
|
948
|
+
{ value: "react", label: "React", hint: "React 19+ components available" },
|
|
949
|
+
{
|
|
950
|
+
value: "none",
|
|
951
|
+
label: "Other / None",
|
|
952
|
+
hint: "Core tokens + Tailwind preset only"
|
|
953
|
+
}
|
|
954
|
+
]
|
|
950
955
|
});
|
|
951
|
-
if (BD(
|
|
956
|
+
if (BD(framework)) {
|
|
952
957
|
ve("Setup cancelled.");
|
|
953
958
|
process.exit(0);
|
|
954
959
|
}
|
|
955
|
-
if (!selectedPackages.includes("@exem-ui/core")) {
|
|
956
|
-
selectedPackages.unshift("@exem-ui/core");
|
|
957
|
-
v2.info(`${import_picocolors2.default.cyan("@exem-ui/core")} is required and has been added.`);
|
|
958
|
-
}
|
|
959
960
|
const tailwind = await de({
|
|
960
961
|
message: "Which Tailwind CSS version are you using?",
|
|
961
962
|
options: [
|
|
@@ -968,11 +969,46 @@ async function init() {
|
|
|
968
969
|
ve("Setup cancelled.");
|
|
969
970
|
process.exit(0);
|
|
970
971
|
}
|
|
971
|
-
|
|
972
|
-
|
|
972
|
+
const initialPackages = ["@exem-ui/core"];
|
|
973
|
+
if (framework === "react") {
|
|
974
|
+
initialPackages.push("@exem-ui/react");
|
|
975
|
+
}
|
|
976
|
+
if (tailwind === "v3") {
|
|
977
|
+
initialPackages.push("@exem-ui/tailwindcss3");
|
|
978
|
+
} else if (tailwind === "v4") {
|
|
979
|
+
initialPackages.push("@exem-ui/tailwindcss4");
|
|
980
|
+
}
|
|
981
|
+
const packageOptions = PACKAGES.filter((pkg) => {
|
|
982
|
+
if (tailwind === "v3" && pkg.name === "@exem-ui/tailwindcss4") {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
if (tailwind === "v4" && pkg.name === "@exem-ui/tailwindcss3") {
|
|
986
|
+
return false;
|
|
987
|
+
}
|
|
988
|
+
if (tailwind === "none") {
|
|
989
|
+
if (pkg.name === "@exem-ui/tailwindcss3" || pkg.name === "@exem-ui/tailwindcss4") {
|
|
990
|
+
return false;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return true;
|
|
994
|
+
});
|
|
995
|
+
const selectedPackages = await pe({
|
|
996
|
+
message: "Which packages do you want to install?",
|
|
997
|
+
options: packageOptions.map((pkg) => ({
|
|
998
|
+
value: pkg.name,
|
|
999
|
+
label: pkg.name,
|
|
1000
|
+
hint: pkg.description
|
|
1001
|
+
})),
|
|
1002
|
+
initialValues: initialPackages,
|
|
1003
|
+
required: true
|
|
1004
|
+
});
|
|
1005
|
+
if (BD(selectedPackages)) {
|
|
1006
|
+
ve("Setup cancelled.");
|
|
1007
|
+
process.exit(0);
|
|
973
1008
|
}
|
|
974
|
-
if (
|
|
975
|
-
selectedPackages.
|
|
1009
|
+
if (!selectedPackages.includes("@exem-ui/core")) {
|
|
1010
|
+
selectedPackages.unshift("@exem-ui/core");
|
|
1011
|
+
v2.info(`${import_picocolors2.default.cyan("@exem-ui/core")} is required and has been added.`);
|
|
976
1012
|
}
|
|
977
1013
|
const channel = await de({
|
|
978
1014
|
message: "Which release channel?",
|
|
@@ -987,6 +1023,7 @@ async function init() {
|
|
|
987
1023
|
}
|
|
988
1024
|
const options = {
|
|
989
1025
|
packageManager: pm,
|
|
1026
|
+
framework,
|
|
990
1027
|
packages: selectedPackages,
|
|
991
1028
|
tailwind,
|
|
992
1029
|
channel
|
|
@@ -1017,6 +1054,7 @@ async function init() {
|
|
|
1017
1054
|
} else if (options.tailwind === "v4") {
|
|
1018
1055
|
configureTailwindV4();
|
|
1019
1056
|
}
|
|
1057
|
+
configureBaseStyles(options.tailwind);
|
|
1020
1058
|
const addScript = await me({
|
|
1021
1059
|
message: "Add an update:exem-ui script to package.json?",
|
|
1022
1060
|
initialValue: true
|
|
@@ -1024,13 +1062,13 @@ async function init() {
|
|
|
1024
1062
|
if (!BD(addScript) && addScript) {
|
|
1025
1063
|
addUpdateScript(options);
|
|
1026
1064
|
}
|
|
1027
|
-
fe(import_picocolors2.default.green("
|
|
1065
|
+
fe(import_picocolors2.default.green("Exem UI setup complete!"));
|
|
1028
1066
|
}
|
|
1029
1067
|
function configureTailwindV3() {
|
|
1030
1068
|
const configPath = resolveFromCwd("tailwind.config.ts");
|
|
1031
1069
|
if (!fileExists(configPath)) {
|
|
1032
1070
|
writeFile(configPath, TAILWIND_V3_CONFIG);
|
|
1033
|
-
v2.success(`Created ${import_picocolors2.default.cyan("tailwind.config.ts")} with
|
|
1071
|
+
v2.success(`Created ${import_picocolors2.default.cyan("tailwind.config.ts")} with Exem UI preset.`);
|
|
1034
1072
|
} else {
|
|
1035
1073
|
v2.warning(`${import_picocolors2.default.cyan("tailwind.config.ts")} already exists.`);
|
|
1036
1074
|
v2.message(TAILWIND_V3_MANUAL_MSG);
|
|
@@ -1049,16 +1087,46 @@ function configureTailwindV4() {
|
|
|
1049
1087
|
if (targetCss) {
|
|
1050
1088
|
const content = readFile(targetCss);
|
|
1051
1089
|
if (content?.includes("@exem-ui/tailwindcss4")) {
|
|
1052
|
-
v2.info("
|
|
1090
|
+
v2.info("Exem UI Tailwind v4 import already present. Skipping.");
|
|
1053
1091
|
return;
|
|
1054
1092
|
}
|
|
1055
1093
|
writeFile(targetCss, TAILWIND_V4_IMPORT + (content ?? ""));
|
|
1056
|
-
v2.success(`Added
|
|
1094
|
+
v2.success(`Added Exem UI import to ${import_picocolors2.default.cyan(targetCss)}.`);
|
|
1057
1095
|
} else {
|
|
1058
1096
|
v2.warning("Could not find a CSS entry file.");
|
|
1059
1097
|
v2.message(TAILWIND_V4_MANUAL_MSG);
|
|
1060
1098
|
}
|
|
1061
1099
|
}
|
|
1100
|
+
var BASE_STYLES = `
|
|
1101
|
+
/* Exem UI base styles */
|
|
1102
|
+
body {
|
|
1103
|
+
background-color: var(--color-background-primary);
|
|
1104
|
+
color: var(--color-text-primary);
|
|
1105
|
+
}
|
|
1106
|
+
`;
|
|
1107
|
+
function configureBaseStyles(tailwind) {
|
|
1108
|
+
if (tailwind === "none") {
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
const cssFiles = ["src/index.css", "src/app.css", "src/global.css", "app/globals.css"];
|
|
1112
|
+
let targetCss = null;
|
|
1113
|
+
for (const file of cssFiles) {
|
|
1114
|
+
const resolved = resolveFromCwd(file);
|
|
1115
|
+
if (fileExists(resolved)) {
|
|
1116
|
+
targetCss = resolved;
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (!targetCss) {
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
const content = readFile(targetCss);
|
|
1124
|
+
if (content?.includes("--color-background-primary")) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
writeFile(targetCss, (content ?? "") + BASE_STYLES);
|
|
1128
|
+
v2.success(`Added base body styles to ${import_picocolors2.default.cyan(targetCss)}.`);
|
|
1129
|
+
}
|
|
1062
1130
|
function addUpdateScript(options) {
|
|
1063
1131
|
const pkgPath = resolveFromCwd("package.json");
|
|
1064
1132
|
const pkg = readJson(pkgPath);
|
|
@@ -1076,15 +1144,40 @@ function addUpdateScript(options) {
|
|
|
1076
1144
|
}
|
|
1077
1145
|
|
|
1078
1146
|
// src/index.ts
|
|
1147
|
+
var VERSION = "0.1.0";
|
|
1079
1148
|
var args = process.argv.slice(2);
|
|
1080
1149
|
var command = args[0];
|
|
1150
|
+
function showHelp() {
|
|
1151
|
+
process.stdout.write(`
|
|
1152
|
+
@exem-ui/cli v${VERSION}
|
|
1153
|
+
|
|
1154
|
+
Usage: npx @exem-ui/cli [command]
|
|
1155
|
+
|
|
1156
|
+
Commands:
|
|
1157
|
+
init Set up Exem UI in your project (default)
|
|
1158
|
+
|
|
1159
|
+
Options:
|
|
1160
|
+
--help, -h Show this help message
|
|
1161
|
+
--version, -v Show version number
|
|
1162
|
+
|
|
1163
|
+
`);
|
|
1164
|
+
}
|
|
1081
1165
|
async function main() {
|
|
1166
|
+
if (command === "--help" || command === "-h") {
|
|
1167
|
+
showHelp();
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
if (command === "--version" || command === "-v") {
|
|
1171
|
+
process.stdout.write(`${VERSION}
|
|
1172
|
+
`);
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1082
1175
|
if (!command || command === "init") {
|
|
1083
1176
|
await init();
|
|
1084
1177
|
} else {
|
|
1085
1178
|
process.stderr.write(`Unknown command: ${command}
|
|
1086
1179
|
`);
|
|
1087
|
-
|
|
1180
|
+
showHelp();
|
|
1088
1181
|
process.exit(1);
|
|
1089
1182
|
}
|
|
1090
1183
|
}
|