inventive-ui 0.0.1 → 0.0.2
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.js +103 -126
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/templates/assets.config.defaults.json +125 -36
package/dist/index.js
CHANGED
|
@@ -190,7 +190,7 @@ var BANNER_COMPACT = [
|
|
|
190
190
|
var FULL_BANNER_WIDTH = 101;
|
|
191
191
|
function resolveCliVersion() {
|
|
192
192
|
try {
|
|
193
|
-
return true ? "0.0.
|
|
193
|
+
return true ? "0.0.2" : "1.0.0";
|
|
194
194
|
} catch {
|
|
195
195
|
return "1.0.0";
|
|
196
196
|
}
|
|
@@ -634,7 +634,7 @@ var ASSET_CATEGORY_LABELS = {
|
|
|
634
634
|
|
|
635
635
|
// src/utils/filesystem.ts
|
|
636
636
|
import path9 from "path";
|
|
637
|
-
import { fileURLToPath } from "url";
|
|
637
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
638
638
|
import os3 from "os";
|
|
639
639
|
import fs8 from "fs-extra";
|
|
640
640
|
|
|
@@ -1412,6 +1412,37 @@ function parseAndValidateRegistryManifest(raw, source) {
|
|
|
1412
1412
|
return result.data;
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
+
// src/utils/theme-config-scaffold.ts
|
|
1416
|
+
import { existsSync } from "fs";
|
|
1417
|
+
import { dirname, join } from "path";
|
|
1418
|
+
import { fileURLToPath } from "url";
|
|
1419
|
+
import { createJiti } from "jiti";
|
|
1420
|
+
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
1421
|
+
function resolveFrameworkScriptsDir(startCwd) {
|
|
1422
|
+
const searchRoots = [startCwd, process.cwd(), join(__dirname2, "../..")];
|
|
1423
|
+
for (const root of searchRoots) {
|
|
1424
|
+
const frameworkDir = resolvePackageDir(FRAMEWORK_PACKAGE, root);
|
|
1425
|
+
if (!frameworkDir) continue;
|
|
1426
|
+
const scriptsDir = join(frameworkDir, "scripts");
|
|
1427
|
+
const loader = join(scriptsDir, "load-framework-theme-defaults.mjs");
|
|
1428
|
+
if (existsSync(loader)) return scriptsDir;
|
|
1429
|
+
}
|
|
1430
|
+
throw new CLIError(
|
|
1431
|
+
`Cannot scaffold iui.config.ts: ${FRAMEWORK_PACKAGE} is not installed or is missing scripts/load-framework-theme-defaults.mjs.`
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
function buildProjectConfigSource(cwd = process.cwd()) {
|
|
1435
|
+
const scriptsDir = resolveFrameworkScriptsDir(cwd);
|
|
1436
|
+
const jiti = createJiti(import.meta.url, { interopDefault: true });
|
|
1437
|
+
const loader = jiti(
|
|
1438
|
+
join(scriptsDir, "load-framework-theme-defaults.mjs")
|
|
1439
|
+
);
|
|
1440
|
+
const defaults = loader.loadFrameworkThemeDefaults(scriptsDir);
|
|
1441
|
+
return loader.buildThemeScaffoldConfig(defaults, {
|
|
1442
|
+
configType: "IUIThemeConfig"
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1415
1446
|
// src/utils/security/identifiers.ts
|
|
1416
1447
|
var SLUG_RE = /^[a-z][a-z0-9-]*$/;
|
|
1417
1448
|
var JS_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
@@ -2647,6 +2678,30 @@ function checkAssetsConfigValidity(cwd = process.cwd()) {
|
|
|
2647
2678
|
details: "Run iui init or merge CLI defaults so @alias icons resolve."
|
|
2648
2679
|
};
|
|
2649
2680
|
}
|
|
2681
|
+
const logo = assets2.logo;
|
|
2682
|
+
if (assets2.logo && (!logo?.globalLogos || Object.keys(logo.globalLogos).length === 0)) {
|
|
2683
|
+
return {
|
|
2684
|
+
ok: false,
|
|
2685
|
+
summary: "assets.config.json is missing logo.globalLogos",
|
|
2686
|
+
details: "Run iui init or merge CLI defaults so @alias logos resolve."
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2689
|
+
const emoji = assets2.emoji;
|
|
2690
|
+
if (assets2.emoji && (!emoji?.globalEmojis || Object.keys(emoji.globalEmojis).length === 0)) {
|
|
2691
|
+
return {
|
|
2692
|
+
ok: false,
|
|
2693
|
+
summary: "assets.config.json is missing emoji.globalEmojis",
|
|
2694
|
+
details: "Run iui init or merge CLI defaults so @alias emojis resolve."
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
const colorLogo = assets2.colorLogo;
|
|
2698
|
+
if (assets2.colorLogo && (!colorLogo?.globalColorLogos || Object.keys(colorLogo.globalColorLogos).length === 0)) {
|
|
2699
|
+
return {
|
|
2700
|
+
ok: false,
|
|
2701
|
+
summary: "assets.config.json is missing colorLogo.globalColorLogos",
|
|
2702
|
+
details: "Run iui init or merge CLI defaults so @alias color logos resolve."
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2650
2705
|
return { ok: true, summary: "assets.config.json is valid" };
|
|
2651
2706
|
}
|
|
2652
2707
|
function checkComponentConfigTierBleed(cwd = process.cwd()) {
|
|
@@ -2794,7 +2849,7 @@ function writePackageManifest(manifest, cwd) {
|
|
|
2794
2849
|
writeJson(packageManifestPath(cwd), manifest);
|
|
2795
2850
|
}
|
|
2796
2851
|
function getCliTemplatesDir() {
|
|
2797
|
-
return path9.join(path9.dirname(
|
|
2852
|
+
return path9.join(path9.dirname(fileURLToPath2(import.meta.url)), "..", "templates");
|
|
2798
2853
|
}
|
|
2799
2854
|
function loadAssetsConfigTemplate() {
|
|
2800
2855
|
const templatePath = path9.join(getCliTemplatesDir(), "assets.config.defaults.json");
|
|
@@ -2821,12 +2876,19 @@ function mergeAssetSlotWithTemplate(slot, templateSlot) {
|
|
|
2821
2876
|
"globalIcons",
|
|
2822
2877
|
"globalEmojis",
|
|
2823
2878
|
"globalLogos",
|
|
2824
|
-
"globalColorLogos"
|
|
2879
|
+
"globalColorLogos",
|
|
2880
|
+
"globalLoaders",
|
|
2881
|
+
"globalIllustrations",
|
|
2882
|
+
"globalFlags",
|
|
2883
|
+
"globalFileTypes"
|
|
2825
2884
|
]) {
|
|
2826
2885
|
const tplMap = templateSlot[mapKey];
|
|
2827
2886
|
const userMap = slot?.[mapKey];
|
|
2828
|
-
if (tplMap && typeof tplMap === "object"
|
|
2829
|
-
out[mapKey] =
|
|
2887
|
+
if (tplMap && typeof tplMap === "object") {
|
|
2888
|
+
out[mapKey] = {
|
|
2889
|
+
...tplMap,
|
|
2890
|
+
...userMap ?? {}
|
|
2891
|
+
};
|
|
2830
2892
|
}
|
|
2831
2893
|
}
|
|
2832
2894
|
return out;
|
|
@@ -3070,117 +3132,7 @@ function registryItemsMap(manifest) {
|
|
|
3070
3132
|
}
|
|
3071
3133
|
function writeProjectConfig(cwd = process.cwd()) {
|
|
3072
3134
|
const configPath = path9.join(cwd, PROJECT_CONFIG_FILE);
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
const config: IUIThemeConfig = {
|
|
3076
|
-
theme: {
|
|
3077
|
-
mode: {
|
|
3078
|
-
default: "light",
|
|
3079
|
-
allowSystem: true,
|
|
3080
|
-
},
|
|
3081
|
-
|
|
3082
|
-
direction: "ltr",
|
|
3083
|
-
|
|
3084
|
-
colors: {
|
|
3085
|
-
semantic: {
|
|
3086
|
-
success: "green",
|
|
3087
|
-
warning: "amber",
|
|
3088
|
-
danger: "red",
|
|
3089
|
-
info: "blue",
|
|
3090
|
-
},
|
|
3091
|
-
|
|
3092
|
-
neutral: {
|
|
3093
|
-
base: "gray",
|
|
3094
|
-
warm: "stone",
|
|
3095
|
-
cool: "slate",
|
|
3096
|
-
},
|
|
3097
|
-
|
|
3098
|
-
brand: {
|
|
3099
|
-
set: "indigo",
|
|
3100
|
-
},
|
|
3101
|
-
|
|
3102
|
-
accent: {
|
|
3103
|
-
"accent-1": "fuchsia",
|
|
3104
|
-
},
|
|
3105
|
-
|
|
3106
|
-
gradients: {
|
|
3107
|
-
sunset: {
|
|
3108
|
-
from: "success",
|
|
3109
|
-
to: "blue",
|
|
3110
|
-
direction: "to end",
|
|
3111
|
-
},
|
|
3112
|
-
glass: {
|
|
3113
|
-
from: "red",
|
|
3114
|
-
to: "yellow",
|
|
3115
|
-
direction: "to end",
|
|
3116
|
-
},
|
|
3117
|
-
},
|
|
3118
|
-
},
|
|
3119
|
-
|
|
3120
|
-
typography: {
|
|
3121
|
-
provider: "system",
|
|
3122
|
-
set: "inter",
|
|
3123
|
-
},
|
|
3124
|
-
|
|
3125
|
-
spacing: {
|
|
3126
|
-
set: "compact",
|
|
3127
|
-
},
|
|
3128
|
-
|
|
3129
|
-
radius: {
|
|
3130
|
-
set: "none",
|
|
3131
|
-
},
|
|
3132
|
-
},
|
|
3133
|
-
|
|
3134
|
-
states: {
|
|
3135
|
-
focused: {
|
|
3136
|
-
mode: "native",
|
|
3137
|
-
shades: { light: "600", dark: "400" },
|
|
3138
|
-
style: {
|
|
3139
|
-
width: 2,
|
|
3140
|
-
offset: 2,
|
|
3141
|
-
offsetColor: { light: "white", dark: "black" },
|
|
3142
|
-
},
|
|
3143
|
-
accessibility: { minContrast: 3, highContrastSupport: false },
|
|
3144
|
-
},
|
|
3145
|
-
disabled: {
|
|
3146
|
-
style: "fade",
|
|
3147
|
-
opacity: 0.5,
|
|
3148
|
-
},
|
|
3149
|
-
loading: {
|
|
3150
|
-
style: "fade",
|
|
3151
|
-
opacity: 0.5,
|
|
3152
|
-
spinner: true,
|
|
3153
|
-
cursor: "wait",
|
|
3154
|
-
label: "Loading",
|
|
3155
|
-
},
|
|
3156
|
-
},
|
|
3157
|
-
|
|
3158
|
-
core: {
|
|
3159
|
-
important: false,
|
|
3160
|
-
},
|
|
3161
|
-
|
|
3162
|
-
/**
|
|
3163
|
-
* Compile-first CSS \u2014 scanned at build time by the Vite/Webpack/Next plugin.
|
|
3164
|
-
* Do not import style-map ".generated" files into the browser graph.
|
|
3165
|
-
* scanDirs / scanPackages default in Framework \u2014 override only when needed.
|
|
3166
|
-
* See Framework docs/01-compile-first-guide.md for all build options.
|
|
3167
|
-
*/
|
|
3168
|
-
build: {
|
|
3169
|
-
safelist: [],
|
|
3170
|
-
packageSafelist: false,
|
|
3171
|
-
includeShadeMatrix: false,
|
|
3172
|
-
includeThemePresets: true,
|
|
3173
|
-
resolvePalettePatterns: true,
|
|
3174
|
-
includeArbitraryScan: true,
|
|
3175
|
-
writeFiles: false,
|
|
3176
|
-
minify: true,
|
|
3177
|
-
useAst: true,
|
|
3178
|
-
},
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
export default config;
|
|
3182
|
-
`;
|
|
3183
|
-
atomicWriteFile(configPath, content);
|
|
3135
|
+
atomicWriteFile(configPath, buildProjectConfigSource(cwd));
|
|
3184
3136
|
}
|
|
3185
3137
|
function ensureProjectConfigBuildBlock(cwd = process.cwd()) {
|
|
3186
3138
|
const configPath = path9.join(resolveIuiProjectRoot(cwd), PROJECT_CONFIG_FILE);
|
|
@@ -4701,6 +4653,12 @@ function syncDeclaredDependencyVersion(packageName, cwd = process.cwd()) {
|
|
|
4701
4653
|
atomicWriteJson(pkgPath, pkg);
|
|
4702
4654
|
return true;
|
|
4703
4655
|
}
|
|
4656
|
+
function getDirectDeclaredVersionFloor(packageName, cwd = process.cwd()) {
|
|
4657
|
+
const declared = isPackageInDirectDeps(packageName, cwd);
|
|
4658
|
+
if (!declared) return null;
|
|
4659
|
+
const floor = cleanVersionString(declared);
|
|
4660
|
+
return floor || null;
|
|
4661
|
+
}
|
|
4704
4662
|
function syncInventiveUiDeclaredDependencies(cwd = process.cwd()) {
|
|
4705
4663
|
const pkgPath = path11.join(cwd, "package.json");
|
|
4706
4664
|
if (!fs9.existsSync(pkgPath)) return [];
|
|
@@ -4871,6 +4829,9 @@ var FRAMEWORK_PACKAGE2 = "@inventive-ui/framework";
|
|
|
4871
4829
|
function hasYarnPnP(cwd) {
|
|
4872
4830
|
return fs10.existsSync(path12.join(cwd, ".pnp.cjs")) || fs10.existsSync(path12.join(cwd, ".pnp.js"));
|
|
4873
4831
|
}
|
|
4832
|
+
function getFrameworkUpdateBaselineVersion(cwd = process.cwd()) {
|
|
4833
|
+
return getDirectDeclaredVersionFloor(FRAMEWORK_PACKAGE2, cwd) ?? getInstalledPackageVersion(FRAMEWORK_PACKAGE2, cwd);
|
|
4834
|
+
}
|
|
4874
4835
|
function getFrameworkInstallStatus(cwd = process.cwd()) {
|
|
4875
4836
|
cleanupLegacyFrameworkMeta(cwd);
|
|
4876
4837
|
const installedVersion = getInstalledPackageVersion(FRAMEWORK_PACKAGE2, cwd);
|
|
@@ -7981,16 +7942,16 @@ async function runPackageDiagnostics(targetCwd, opts, counters) {
|
|
|
7981
7942
|
}
|
|
7982
7943
|
const auth = getAuthConfig();
|
|
7983
7944
|
if (auth?.token) {
|
|
7984
|
-
const
|
|
7945
|
+
const fwBaseline = getFrameworkUpdateBaselineVersion(targetCwd);
|
|
7985
7946
|
const compInstalled = getInstalledPackageVersion(COMPONENTS_PACKAGE, targetCwd);
|
|
7986
7947
|
const [latestFw, latestComp] = await Promise.all([
|
|
7987
|
-
|
|
7948
|
+
fwBaseline ? getLatestVersionSafe(auth.token, "framework") : Promise.resolve(null),
|
|
7988
7949
|
compInstalled ? getLatestVersionSafe(auth.token, "components") : Promise.resolve(null)
|
|
7989
7950
|
]);
|
|
7990
7951
|
let behind = false;
|
|
7991
|
-
if (
|
|
7952
|
+
if (fwBaseline && latestFw && isVersionGreater(latestFw, fwBaseline)) {
|
|
7992
7953
|
behind = true;
|
|
7993
|
-
warn(`Framework v${
|
|
7954
|
+
warn(`Framework v${fwBaseline} is behind the latest v${latestFw}`);
|
|
7994
7955
|
}
|
|
7995
7956
|
if (compInstalled && latestComp && isVersionGreater(latestComp, compInstalled)) {
|
|
7996
7957
|
behind = true;
|
|
@@ -7998,7 +7959,7 @@ async function runPackageDiagnostics(targetCwd, opts, counters) {
|
|
|
7998
7959
|
}
|
|
7999
7960
|
if (behind) {
|
|
8000
7961
|
hint("Run iui update to move to the latest versions.");
|
|
8001
|
-
} else if (
|
|
7962
|
+
} else if (fwBaseline && latestFw || compInstalled && latestComp) {
|
|
8002
7963
|
pass("Inventive UI packages are on the latest version");
|
|
8003
7964
|
}
|
|
8004
7965
|
}
|
|
@@ -8320,7 +8281,7 @@ async function updateCommand(opts = {}) {
|
|
|
8320
8281
|
const auth = await ensureAuthSession();
|
|
8321
8282
|
await ensureLicenseSession();
|
|
8322
8283
|
const inProject = isInsideProject();
|
|
8323
|
-
const currentCliVersion = true ? "0.0.
|
|
8284
|
+
const currentCliVersion = true ? "0.0.2" : "unknown";
|
|
8324
8285
|
const latestCliVersion = await fetchLatestCliVersion(auth.token);
|
|
8325
8286
|
const cliUpdateAvailable = latestCliVersion !== null && isVersionGreater(latestCliVersion, currentCliVersion);
|
|
8326
8287
|
if (latestCliVersion && cliUpdateAvailable) {
|
|
@@ -8385,15 +8346,16 @@ async function updateCommand(opts = {}) {
|
|
|
8385
8346
|
}
|
|
8386
8347
|
}
|
|
8387
8348
|
const frameworkStatus = getFrameworkInstallStatus(installCwd);
|
|
8349
|
+
const frameworkBaselineVersion = getFrameworkUpdateBaselineVersion(installCwd);
|
|
8388
8350
|
const latestFrameworkVersion = await fetchLatestScopedPackageVersion(auth.token, "framework");
|
|
8389
|
-
const frameworkUpdateAvailable = frameworkStatus.installed &&
|
|
8351
|
+
const frameworkUpdateAvailable = frameworkStatus.installed && frameworkBaselineVersion && latestFrameworkVersion && isVersionGreater(latestFrameworkVersion, frameworkBaselineVersion);
|
|
8390
8352
|
let shouldUpdateFramework = false;
|
|
8391
8353
|
if (frameworkUpdateAvailable) {
|
|
8392
8354
|
subheading("Framework update");
|
|
8393
8355
|
newline();
|
|
8394
8356
|
updateRow(
|
|
8395
8357
|
"Inventive UI Framework",
|
|
8396
|
-
|
|
8358
|
+
frameworkBaselineVersion ?? "unknown",
|
|
8397
8359
|
latestFrameworkVersion ?? "unknown",
|
|
8398
8360
|
true
|
|
8399
8361
|
);
|
|
@@ -8447,6 +8409,7 @@ async function updateCommand(opts = {}) {
|
|
|
8447
8409
|
info("No asset package updates available.");
|
|
8448
8410
|
}
|
|
8449
8411
|
const hasAnyUpdates = cliUpdateAvailable || available.length > 0 || assetUpdates.length > 0 || Boolean(frameworkUpdateAvailable);
|
|
8412
|
+
const alignDeclaredDependencies = () => syncInventiveUiDeclaredDependencies(installCwd);
|
|
8450
8413
|
if (opts.check === true) {
|
|
8451
8414
|
if (hasAnyUpdates) {
|
|
8452
8415
|
done("Updates are available.");
|
|
@@ -8457,6 +8420,14 @@ async function updateCommand(opts = {}) {
|
|
|
8457
8420
|
return;
|
|
8458
8421
|
}
|
|
8459
8422
|
if (!hasAnyUpdates) {
|
|
8423
|
+
const synced2 = alignDeclaredDependencies();
|
|
8424
|
+
if (synced2.length > 0) {
|
|
8425
|
+
ok(
|
|
8426
|
+
`Aligned package.json with hoisted installs (${synced2.length} @inventive-ui package${synced2.length === 1 ? "" : "s"})`
|
|
8427
|
+
);
|
|
8428
|
+
done("Workspace dependency declarations are now in sync.");
|
|
8429
|
+
return;
|
|
8430
|
+
}
|
|
8460
8431
|
done("Everything is up to date.");
|
|
8461
8432
|
return;
|
|
8462
8433
|
}
|
|
@@ -8509,6 +8480,12 @@ async function updateCommand(opts = {}) {
|
|
|
8509
8480
|
updatedAssets += 1;
|
|
8510
8481
|
}
|
|
8511
8482
|
}
|
|
8483
|
+
const synced = alignDeclaredDependencies();
|
|
8484
|
+
if (synced.length > 0) {
|
|
8485
|
+
ok(
|
|
8486
|
+
`Aligned package.json with installed versions (${synced.length} @inventive-ui package${synced.length === 1 ? "" : "s"})`
|
|
8487
|
+
);
|
|
8488
|
+
}
|
|
8512
8489
|
done(
|
|
8513
8490
|
`Update complete: ${updatedFramework} framework, ${updatedComponents} component${updatedComponents === 1 ? "" : "s"}, ${updatedAssets} asset package${updatedAssets === 1 ? "" : "s"}.`
|
|
8514
8491
|
);
|
|
@@ -8586,7 +8563,7 @@ var AUTH_EXEMPT_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
8586
8563
|
"doctor",
|
|
8587
8564
|
"list"
|
|
8588
8565
|
]);
|
|
8589
|
-
program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.
|
|
8566
|
+
program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.2" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
|
|
8590
8567
|
program.command("login").description("Authenticate with GitHub and link your license").option("-f, --force", "Force re-authentication and register this device").option("--bootstrap", "After login, run optional setup prompts").action((opts) => loginCommand(opts));
|
|
8591
8568
|
program.command("logout").description("Remove stored credentials").action(logoutCommand);
|
|
8592
8569
|
program.command("whoami").description("Show authenticated identity and license details").action(whoamiCommand);
|