solidui-cli 0.1.6 → 0.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 +28 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
1
|
+
#! /usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
@@ -462,11 +462,21 @@ module.exports = {
|
|
|
462
462
|
"accordion-up": {
|
|
463
463
|
from: { height: "var(--kb-accordion-content-height)" },
|
|
464
464
|
to: { height: 0 }
|
|
465
|
+
},
|
|
466
|
+
"content-show": {
|
|
467
|
+
from: { opacity: 0, transform: "scale(0.96)" },
|
|
468
|
+
to: { opacity: 1, transform: "scale(1)" }
|
|
469
|
+
},
|
|
470
|
+
"content-hide": {
|
|
471
|
+
from: { opacity: 1, transform: "scale(1)" },
|
|
472
|
+
to: { opacity: 0, transform: "scale(0.96)" }
|
|
465
473
|
}
|
|
466
474
|
},
|
|
467
475
|
animation: {
|
|
468
476
|
"accordion-down": "accordion-down 0.2s ease-out",
|
|
469
|
-
"accordion-up": "accordion-up 0.2s ease-out"
|
|
477
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
478
|
+
"content-show": "content-show 0.2s ease-out",
|
|
479
|
+
"content-hide": "content-hide 0.2s ease-out"
|
|
470
480
|
}
|
|
471
481
|
}
|
|
472
482
|
},
|
|
@@ -478,7 +488,7 @@ export default {
|
|
|
478
488
|
content: [
|
|
479
489
|
"./src/**/*.{html,js,jsx,md,mdx,ts,tsx}"
|
|
480
490
|
],
|
|
481
|
-
presets: [require("./
|
|
491
|
+
presets: [require("./ui.preset.js")]
|
|
482
492
|
}`;
|
|
483
493
|
|
|
484
494
|
// src/lib/transformImports.ts
|
|
@@ -646,10 +656,10 @@ async function add(componentNames) {
|
|
|
646
656
|
const activityIndicator = spinner2();
|
|
647
657
|
activityIndicator.start("Creating components...");
|
|
648
658
|
try {
|
|
649
|
-
const
|
|
650
|
-
const
|
|
651
|
-
const isTypescriptEnabled =
|
|
652
|
-
const componentFolderDir = path.resolve(cwd(),
|
|
659
|
+
const readUIConfig = readFileSync(path.resolve(cwd(), "ui.config.json"));
|
|
660
|
+
const uiConfig = parse(configSchema, JSON.parse(readUIConfig.toString()));
|
|
661
|
+
const isTypescriptEnabled = uiConfig.tsx;
|
|
662
|
+
const componentFolderDir = path.resolve(cwd(), uiConfig.componentDir);
|
|
653
663
|
const dirExists = existsSync(componentFolderDir);
|
|
654
664
|
if (!dirExists)
|
|
655
665
|
mkdirSync(componentFolderDir, { recursive: true });
|
|
@@ -669,7 +679,7 @@ async function add(componentNames) {
|
|
|
669
679
|
}
|
|
670
680
|
for (const file of component.files) {
|
|
671
681
|
log2.step(`Creating ${file.name}`);
|
|
672
|
-
const content = transformImports(file.content,
|
|
682
|
+
const content = transformImports(file.content, uiConfig);
|
|
673
683
|
if (isTypescriptEnabled) {
|
|
674
684
|
writeFileSync(componentFolderDir + `/${file.name}`, content);
|
|
675
685
|
} else {
|
|
@@ -732,7 +742,7 @@ async function init() {
|
|
|
732
742
|
saveConfig(config);
|
|
733
743
|
writeTsconfig(config.aliases.path);
|
|
734
744
|
writeUtils();
|
|
735
|
-
await
|
|
745
|
+
await writeUIPreset();
|
|
736
746
|
await writeTailwindConfig(config.tailwind.config);
|
|
737
747
|
await writeCSS(config.tailwind.css);
|
|
738
748
|
log3.success("Project configuration completed.");
|
|
@@ -784,25 +794,25 @@ async function installDeps() {
|
|
|
784
794
|
}
|
|
785
795
|
function saveConfig(config) {
|
|
786
796
|
const indicator = spinner3();
|
|
787
|
-
indicator.start("Writing
|
|
788
|
-
writeFile("
|
|
797
|
+
indicator.start("Writing ui.config.json...");
|
|
798
|
+
writeFile("ui.config.json", JSON.stringify(config, null, 2), (error) => {
|
|
789
799
|
if (error)
|
|
790
800
|
log3.error("There was an error while saving your preferences");
|
|
791
801
|
});
|
|
792
|
-
indicator.stop("
|
|
802
|
+
indicator.stop("ui.config.json successfully created!");
|
|
793
803
|
}
|
|
794
|
-
async function
|
|
804
|
+
async function writeUIPreset() {
|
|
795
805
|
const indicator = spinner3();
|
|
796
806
|
indicator.start("Writing Solid UI Components tailwind preset...");
|
|
797
807
|
try {
|
|
798
|
-
writeFile("
|
|
808
|
+
writeFile("ui.preset.js", TAILWIND_PRESET, (error) => {
|
|
799
809
|
if (error)
|
|
800
|
-
log3.error(`There was an error while writing the
|
|
810
|
+
log3.error(`There was an error while writing the ui.preset.js: ${error}`);
|
|
801
811
|
});
|
|
802
812
|
} catch (error) {
|
|
803
813
|
log3.error(`Sorry, something went wrong while getting the tailwind presets: ${error}`);
|
|
804
814
|
}
|
|
805
|
-
indicator.stop("
|
|
815
|
+
indicator.stop("ui.preset.js successfully created!");
|
|
806
816
|
}
|
|
807
817
|
async function writeTailwindConfig(tailwindConfigDir) {
|
|
808
818
|
const indicator = spinner3();
|
|
@@ -838,7 +848,7 @@ function writeTsconfig(alias) {
|
|
|
838
848
|
|
|
839
849
|
// src/index.ts
|
|
840
850
|
var program = new Command();
|
|
841
|
-
program.name("
|
|
842
|
-
program.command("init").description("Initialize and install the necessary things to make use of Solid
|
|
851
|
+
program.name("solidui-cli").description("A CLI used for the Solid-UI components library").version("0.1");
|
|
852
|
+
program.command("init").description("Initialize and install the necessary things to make use of Solid-UI").action(async () => await init());
|
|
843
853
|
program.command("add").argument("[components...]", "Components to be added to your project").description("Add a component to your project").action(async (component) => await add(component));
|
|
844
854
|
program.parse();
|