sdaia-ui 1.1.2 → 1.2.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/index.js +43 -14
- package/package.json +1 -6
package/dist/index.js
CHANGED
|
@@ -276,14 +276,14 @@ export default config;
|
|
|
276
276
|
logger.success("Tailwind CSS detected");
|
|
277
277
|
}
|
|
278
278
|
logger.break();
|
|
279
|
-
logger.info("Installing
|
|
280
|
-
const
|
|
279
|
+
logger.info("Installing DGA icon set (required for all components)...");
|
|
280
|
+
const iconLibCmd = getInstallCommand(pm, ["@platformscode/icons"]);
|
|
281
281
|
try {
|
|
282
|
-
execSync(
|
|
283
|
-
logger.success("
|
|
282
|
+
execSync(iconLibCmd, { stdio: "inherit", cwd: process.cwd() });
|
|
283
|
+
logger.success("@platformscode/icons installed");
|
|
284
284
|
} catch {
|
|
285
|
-
logger.warn(`Failed to auto-install
|
|
286
|
-
${
|
|
285
|
+
logger.warn(`Failed to auto-install @platformscode/icons. Run manually:
|
|
286
|
+
${iconLibCmd}`);
|
|
287
287
|
}
|
|
288
288
|
const utilityDeps = ["tailwind-merge", "clsx", "class-variance-authority"];
|
|
289
289
|
const utilityCmd = getInstallCommand(pm, utilityDeps);
|
|
@@ -365,19 +365,21 @@ import { execSync as execSync2 } from "node:child_process";
|
|
|
365
365
|
import path4 from "node:path";
|
|
366
366
|
function transformImports(source, componentDir, utilsDir, componentName) {
|
|
367
367
|
const componentPath = path4.posix.join(componentDir, componentName);
|
|
368
|
-
const
|
|
369
|
-
const cnImportPath =
|
|
370
|
-
|
|
368
|
+
const utilsRelative = path4.posix.relative(componentPath, utilsDir);
|
|
369
|
+
const cnImportPath = utilsRelative ? `${utilsRelative}/cn` : "./cn";
|
|
370
|
+
const sdaiaAssetsImportPath = "../sdaia-assets";
|
|
371
|
+
let result = source;
|
|
372
|
+
result = result.replace(
|
|
371
373
|
/from\s+(['"])\.\.\/\.\.\/lib\/cn\1/g,
|
|
372
374
|
`from '${cnImportPath}'`
|
|
373
375
|
);
|
|
374
376
|
result = result.replace(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
/from\s+(['"])sdaia-ui\/sdaia-assets\1/g,
|
|
378
|
+
`from '${sdaiaAssetsImportPath}'`
|
|
377
379
|
);
|
|
378
380
|
result = result.replace(
|
|
379
|
-
/from\s+(['"])\.\.\/\.\.\/
|
|
380
|
-
`from '
|
|
381
|
+
/from\s+(['"])\.\.\/\.\.\/sdaia-assets(?:\/[^'"]*)?\1/g,
|
|
382
|
+
`from '${sdaiaAssetsImportPath}'`
|
|
381
383
|
);
|
|
382
384
|
result = result.replace(
|
|
383
385
|
/^([ \t]*)import\s+([A-Za-z_$][\w$]*)\s+from\s+(['"])\.\.\/\.\.\/hooks\/[^'"]+\3\s*;?/gm,
|
|
@@ -480,8 +482,35 @@ async function add(componentSlugs, options) {
|
|
|
480
482
|
` ${entry.name} \u2192 ${path5.relative(process.cwd(), compDir)}/`
|
|
481
483
|
);
|
|
482
484
|
}
|
|
485
|
+
const utilityDepsNeeded = /* @__PURE__ */ new Set();
|
|
486
|
+
for (const entry of toInstall) {
|
|
487
|
+
for (const u of entry.utilityDependencies ?? []) utilityDepsNeeded.add(u);
|
|
488
|
+
}
|
|
489
|
+
for (const utilName of utilityDepsNeeded) {
|
|
490
|
+
const util = registry.utilities.find((u) => u.name === utilName);
|
|
491
|
+
if (!util) continue;
|
|
492
|
+
const baseDir = util.name === "sdaia-assets" ? config.componentDir : config.utilsDir;
|
|
493
|
+
const utilDir = path5.resolve(process.cwd(), baseDir, util.name);
|
|
494
|
+
const alreadyHere = fs4.existsSync(utilDir) && fs4.existsSync(path5.join(utilDir, "index.ts"));
|
|
495
|
+
if (alreadyHere && !options.overwrite) {
|
|
496
|
+
logger.info(`Utility ${util.name} already installed (skipping)`);
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
fs4.mkdirSync(utilDir, { recursive: true });
|
|
500
|
+
for (const fileName of util.files) {
|
|
501
|
+
const source = await fetchComponentFile(
|
|
502
|
+
config.registryUrl,
|
|
503
|
+
util.name,
|
|
504
|
+
fileName
|
|
505
|
+
);
|
|
506
|
+
fs4.writeFileSync(path5.join(utilDir, fileName), source);
|
|
507
|
+
}
|
|
508
|
+
logger.success(
|
|
509
|
+
` ${util.name} \u2192 ${path5.relative(process.cwd(), utilDir)}/`
|
|
510
|
+
);
|
|
511
|
+
}
|
|
483
512
|
const npmDeps = collectNpmDependencies(toInstall);
|
|
484
|
-
const baseDeps = ["clsx", "tailwind-merge"];
|
|
513
|
+
const baseDeps = ["clsx", "tailwind-merge", "@platformscode/icons"];
|
|
485
514
|
const allDeps = [.../* @__PURE__ */ new Set([...npmDeps, ...baseDeps])];
|
|
486
515
|
const pkgJsonPath = path5.resolve(process.cwd(), "package.json");
|
|
487
516
|
let missingDeps = allDeps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdaia-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CLI for installing SDAIA Design System components into your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,11 +9,6 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./icons": {
|
|
14
|
-
"types": "./dist/icons/IconFactory.d.ts",
|
|
15
|
-
"import": "./dist/icons.js",
|
|
16
|
-
"require": "./dist/icons.cjs"
|
|
17
12
|
}
|
|
18
13
|
},
|
|
19
14
|
"files": [
|