@catalystsoftware/ui 1.0.17 → 1.0.18
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 +256 -158
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -200582,6 +200582,7 @@ import { pathToFileURL } from "url";
|
|
|
200582
200582
|
var SOURCE_COMPONENTS_FOLDER = "./dist/components/catalyst-ui";
|
|
200583
200583
|
var SOURCE_DATA_FOLDER = "./dist/components/catalyst-ui/data";
|
|
200584
200584
|
var DEFAULT_CONFIG = {
|
|
200585
|
+
version: "1.0.124",
|
|
200585
200586
|
theme: "blue",
|
|
200586
200587
|
preset: "MODERN",
|
|
200587
200588
|
font: "Geist",
|
|
@@ -200594,37 +200595,6 @@ var DEFAULT_CONFIG = {
|
|
|
200594
200595
|
css: "app/routes/styles/tailwind.css",
|
|
200595
200596
|
components: "app/"
|
|
200596
200597
|
};
|
|
200597
|
-
async function loadConfig() {
|
|
200598
|
-
const configPath = path2.join(process.cwd(), "config.catalyst");
|
|
200599
|
-
try {
|
|
200600
|
-
await fs.access(configPath);
|
|
200601
|
-
const content = await fs.readFile(configPath, "utf-8");
|
|
200602
|
-
const jsonContent = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
200603
|
-
const config = JSON.parse(jsonContent);
|
|
200604
|
-
return { ...DEFAULT_CONFIG, ...config };
|
|
200605
|
-
} catch {
|
|
200606
|
-
return null;
|
|
200607
|
-
}
|
|
200608
|
-
}
|
|
200609
|
-
async function createConfig() {
|
|
200610
|
-
const configPath = path2.join(process.cwd(), "config.catalyst");
|
|
200611
|
-
const configContent = `
|
|
200612
|
-
{
|
|
200613
|
-
"theme": "blue",
|
|
200614
|
-
"preset": "MODERN",
|
|
200615
|
-
"font": "Geist",
|
|
200616
|
-
"all-components": false,
|
|
200617
|
-
"install-tailwind": true,
|
|
200618
|
-
"configure-tailwind": true,
|
|
200619
|
-
"configure-tailwind.config": true,
|
|
200620
|
-
"install-postcss": true,
|
|
200621
|
-
"configure-postcss": true,
|
|
200622
|
-
"css": "app/routes/styles/tailwind.css",
|
|
200623
|
-
"components": "app/"
|
|
200624
|
-
}`;
|
|
200625
|
-
await fs.writeFile(configPath, configContent, "utf-8");
|
|
200626
|
-
console.log(source_default.green("\u2713 Created config.catalyst"));
|
|
200627
|
-
}
|
|
200628
200598
|
var API_URL = "https://catalyst-software.vercel.app/Catalyst/UI/code/verify/premium";
|
|
200629
200599
|
var API_TIMEOUT = 5000;
|
|
200630
200600
|
function hashKey(key) {
|
|
@@ -200759,41 +200729,37 @@ async function getComponentsData(includePremium) {
|
|
|
200759
200729
|
throw error;
|
|
200760
200730
|
}
|
|
200761
200731
|
}
|
|
200762
|
-
async function installSpecificComponent(componentName, isPremium, config) {
|
|
200732
|
+
async function installSpecificComponent(componentName, isPremium, targetPath, config) {
|
|
200763
200733
|
const components = await getComponentsData(isPremium);
|
|
200764
200734
|
const component = components.find((c) => c.value === componentName || c.name.toLowerCase() === componentName.toLowerCase());
|
|
200765
|
-
if (!component)
|
|
200735
|
+
if (!component)
|
|
200766
200736
|
throw new Error(`Component "${componentName}" not found`);
|
|
200767
|
-
|
|
200768
|
-
if (component.premium && !isPremium) {
|
|
200769
|
-
throw new Error(`Component "${componentName}" is premium only. Use a valid access key to install.`);
|
|
200770
|
-
}
|
|
200771
|
-
await createComponentFile(component, config);
|
|
200737
|
+
await createComponentFile(component, targetPath, config);
|
|
200772
200738
|
const sourceFullPath = path2.join(SOURCE_COMPONENTS_FOLDER, component.path);
|
|
200773
200739
|
const content = await fs.readFile(sourceFullPath, "utf-8");
|
|
200774
200740
|
const dependencies = extractImportsFromFile(content, component.path);
|
|
200775
200741
|
if (dependencies.size > 0) {
|
|
200776
|
-
await installDependencies(Array.from(dependencies));
|
|
200742
|
+
await installDependencies(Array.from(dependencies), targetPath);
|
|
200777
200743
|
}
|
|
200778
|
-
await ensureUtilsFile(config);
|
|
200744
|
+
await ensureUtilsFile(targetPath, config);
|
|
200779
200745
|
}
|
|
200780
|
-
async function createComponentFile(component, config) {
|
|
200746
|
+
async function createComponentFile(component, targetPath, config) {
|
|
200781
200747
|
const componentsBase = config?.components || "app/";
|
|
200782
200748
|
const sourcePath = component.path;
|
|
200783
|
-
const
|
|
200784
|
-
await fs.mkdir(path2.dirname(
|
|
200749
|
+
const destPath = path2.join(targetPath, componentsBase, sourcePath.replace(/^\/?(app\/)?/, ""));
|
|
200750
|
+
await fs.mkdir(path2.dirname(destPath), { recursive: true });
|
|
200785
200751
|
const sourceFullPath = path2.join(SOURCE_COMPONENTS_FOLDER, sourcePath);
|
|
200786
200752
|
const content = await fs.readFile(sourceFullPath, "utf-8");
|
|
200787
|
-
await fs.writeFile(
|
|
200788
|
-
console.log(source_default.green(`\u2713 Created ${path2.relative(
|
|
200753
|
+
await fs.writeFile(destPath, content, "utf-8");
|
|
200754
|
+
console.log(source_default.green(`\u2713 Created ${path2.relative(targetPath, destPath)}`));
|
|
200789
200755
|
}
|
|
200790
|
-
async function installAllComponents(includePremium, config) {
|
|
200756
|
+
async function installAllComponents(includePremium, targetPath, config) {
|
|
200791
200757
|
const components = await getComponentsData(includePremium);
|
|
200792
200758
|
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: `Installing ${components.length} components...` }).start();
|
|
200793
200759
|
let installed = 0;
|
|
200794
200760
|
for (const component of components) {
|
|
200795
200761
|
try {
|
|
200796
|
-
await createComponentFile(component, config);
|
|
200762
|
+
await createComponentFile(component, targetPath, config);
|
|
200797
200763
|
installed++;
|
|
200798
200764
|
spinner.text = `Installing components... (${installed}/${components.length})`;
|
|
200799
200765
|
} catch (error) {
|
|
@@ -200802,21 +200768,26 @@ async function installAllComponents(includePremium, config) {
|
|
|
200802
200768
|
}
|
|
200803
200769
|
}
|
|
200804
200770
|
spinner.succeed(source_default.green(`Installed ${installed} components`));
|
|
200805
|
-
await createIndexFiles();
|
|
200806
|
-
await configureProjectPaths();
|
|
200771
|
+
await createIndexFiles(targetPath, config);
|
|
200772
|
+
await configureProjectPaths(targetPath, config);
|
|
200807
200773
|
}
|
|
200808
|
-
async function createIndexFiles() {
|
|
200809
|
-
const spinner = ora2(
|
|
200810
|
-
const
|
|
200811
|
-
const
|
|
200812
|
-
|
|
200813
|
-
|
|
200814
|
-
|
|
200815
|
-
|
|
200816
|
-
|
|
200817
|
-
|
|
200818
|
-
|
|
200819
|
-
|
|
200774
|
+
async function createIndexFiles(targetPath, config) {
|
|
200775
|
+
const spinner = ora2("Creating index files...").start();
|
|
200776
|
+
const componentsBase = config?.components || "app/";
|
|
200777
|
+
const componentsDir = path2.join(targetPath, componentsBase, "components", "catalyst-ui");
|
|
200778
|
+
try {
|
|
200779
|
+
const folders = await fs.readdir(componentsDir, { withFileTypes: true });
|
|
200780
|
+
for (const folder of folders) {
|
|
200781
|
+
if (folder.isDirectory()) {
|
|
200782
|
+
const folderPath = path2.join(componentsDir, folder.name);
|
|
200783
|
+
await createIndexForFolder(folderPath);
|
|
200784
|
+
}
|
|
200785
|
+
}
|
|
200786
|
+
await createMainIndex(componentsDir);
|
|
200787
|
+
spinner.succeed(source_default.green("Created index files"));
|
|
200788
|
+
} catch (e) {
|
|
200789
|
+
spinner.fail(source_default.red("Index creation failed"));
|
|
200790
|
+
}
|
|
200820
200791
|
}
|
|
200821
200792
|
async function createMainIndex(componentsDir) {
|
|
200822
200793
|
try {
|
|
@@ -200866,28 +200837,24 @@ function generateIndexContent(files, basePath) {
|
|
|
200866
200837
|
`) + `
|
|
200867
200838
|
`;
|
|
200868
200839
|
}
|
|
200869
|
-
async function installDependencies(deps) {
|
|
200870
|
-
const spinner = ora2(
|
|
200840
|
+
async function installDependencies(deps, targetPath) {
|
|
200841
|
+
const spinner = ora2("Installing dependencies...").start();
|
|
200871
200842
|
try {
|
|
200872
|
-
const packageManager = await detectPackageManager();
|
|
200843
|
+
const packageManager = await detectPackageManager(targetPath);
|
|
200873
200844
|
const installCmd = packageManager === "npm" ? "install" : "add";
|
|
200874
|
-
execSync(`${packageManager} ${installCmd} ${deps.join(" ")}`, {
|
|
200875
|
-
stdio: "inherit",
|
|
200876
|
-
cwd: process.cwd()
|
|
200877
|
-
});
|
|
200845
|
+
execSync(`${packageManager} ${installCmd} ${deps.join(" ")}`, { stdio: "inherit", cwd: targetPath });
|
|
200878
200846
|
spinner.succeed(source_default.green("Dependencies installed"));
|
|
200879
200847
|
} catch (error) {
|
|
200880
|
-
spinner.fail(source_default.red("
|
|
200881
|
-
throw error;
|
|
200848
|
+
spinner.fail(source_default.red("Dependency installation failed"));
|
|
200882
200849
|
}
|
|
200883
200850
|
}
|
|
200884
|
-
async function detectPackageManager() {
|
|
200851
|
+
async function detectPackageManager(targetPath) {
|
|
200885
200852
|
try {
|
|
200886
|
-
await fs.access(path2.join(
|
|
200853
|
+
await fs.access(path2.join(targetPath, "pnpm-lock.yaml"));
|
|
200887
200854
|
return "pnpm";
|
|
200888
200855
|
} catch {}
|
|
200889
200856
|
try {
|
|
200890
|
-
await fs.access(path2.join(
|
|
200857
|
+
await fs.access(path2.join(targetPath, "yarn.lock"));
|
|
200891
200858
|
return "yarn";
|
|
200892
200859
|
} catch {}
|
|
200893
200860
|
return "npm";
|
|
@@ -200918,73 +200885,65 @@ async function installAllLibraries(includeAll) {
|
|
|
200918
200885
|
const libs = includeAll ? requiredLibsAll : requiredLibs;
|
|
200919
200886
|
await installDependencies(libs.split(" "));
|
|
200920
200887
|
}
|
|
200921
|
-
async function ensureUtilsFile(config) {
|
|
200888
|
+
async function ensureUtilsFile(targetPath, config) {
|
|
200922
200889
|
const componentsBase = config?.components || "app/";
|
|
200923
|
-
const
|
|
200890
|
+
const utilsDest = path2.join(targetPath, componentsBase, "components", "catalyst-ui", "utils", "utils.ts");
|
|
200924
200891
|
try {
|
|
200925
|
-
await fs.access(
|
|
200892
|
+
await fs.access(utilsDest);
|
|
200926
200893
|
return;
|
|
200927
200894
|
} catch {}
|
|
200928
|
-
await fs.mkdir(path2.dirname(
|
|
200929
|
-
|
|
200930
|
-
|
|
200931
|
-
console.log(source_default.green(`\u2713 Created ${path2.relative(process.cwd(), utilsPath)}`));
|
|
200932
|
-
}
|
|
200933
|
-
async function configureTailwind(useNgin, config) {
|
|
200934
|
-
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Configuring Tailwind..." }).start();
|
|
200935
|
-
if (config?.["configure-tailwind"]) {
|
|
200936
|
-
const tailwindCssPath = config.css || "app/routes/styles/tailwind.css";
|
|
200937
|
-
await copyFile(path2.join(SOURCE_DATA_FOLDER, "tailwind.css"), path2.join(process.cwd(), tailwindCssPath));
|
|
200938
|
-
} else {
|
|
200939
|
-
const tailwindCssPath = await getTailwindCssPath();
|
|
200940
|
-
await copyFile(path2.join(SOURCE_DATA_FOLDER, "tailwind.css"), tailwindCssPath);
|
|
200941
|
-
}
|
|
200942
|
-
if (config?.["configure-tailwind.config"] !== false) {
|
|
200943
|
-
const configType = config?.["configure-tailwind.config"] === "ngin" ? "ngin" : useNgin ? "ngin" : "basic";
|
|
200944
|
-
const configFileName = configType === "ngin" ? "tailwind.config.ngin.js" : "tailwind.config.js";
|
|
200945
|
-
await copyFile(path2.join(SOURCE_DATA_FOLDER, configFileName), path2.join(process.cwd(), "tailwind.config.js"));
|
|
200946
|
-
}
|
|
200947
|
-
if (config?.["configure-postcss"]) {
|
|
200948
|
-
await copyFile(path2.join(SOURCE_DATA_FOLDER, "postcss.config.js"), path2.join(process.cwd(), "postcss.config.js"));
|
|
200949
|
-
}
|
|
200950
|
-
spinner.succeed(source_default.green("Tailwind configured"));
|
|
200895
|
+
await fs.mkdir(path2.dirname(utilsDest), { recursive: true });
|
|
200896
|
+
await fs.copyFile(path2.join(SOURCE_COMPONENTS_FOLDER, "utils", "utils.ts"), utilsDest);
|
|
200897
|
+
console.log(source_default.green(`\u2713 Created ${path2.relative(targetPath, utilsDest)}`));
|
|
200951
200898
|
}
|
|
200952
|
-
async function getTailwindCssPath() {
|
|
200953
|
-
const {
|
|
200899
|
+
async function getTailwindCssPath(targetPath) {
|
|
200900
|
+
const { useDefault } = await lib_default.prompt([
|
|
200954
200901
|
{
|
|
200955
200902
|
type: "confirm",
|
|
200956
|
-
name: "
|
|
200903
|
+
name: "useDefault",
|
|
200957
200904
|
message: "Use default path for tailwind.css? (app/routes/styles/tailwind.css)",
|
|
200958
200905
|
default: true
|
|
200959
200906
|
}
|
|
200960
200907
|
]);
|
|
200961
|
-
if (
|
|
200962
|
-
return path2.join(
|
|
200908
|
+
if (useDefault) {
|
|
200909
|
+
return path2.join(targetPath, "app", "routes", "styles", "tailwind.css");
|
|
200963
200910
|
}
|
|
200964
|
-
const {
|
|
200911
|
+
const { userPath } = await lib_default.prompt([
|
|
200965
200912
|
{
|
|
200966
200913
|
type: "input",
|
|
200967
|
-
name: "
|
|
200914
|
+
name: "userPath",
|
|
200968
200915
|
message: "Enter path for tailwind.css:",
|
|
200969
200916
|
default: "app/routes/styles/tailwind.css"
|
|
200970
200917
|
}
|
|
200971
200918
|
]);
|
|
200972
|
-
return path2.join(
|
|
200919
|
+
return path2.join(targetPath, userPath);
|
|
200973
200920
|
}
|
|
200974
|
-
async function
|
|
200921
|
+
async function configureTailwind(useNgin, targetPath, config) {
|
|
200922
|
+
const spinner = ora2("Configuring Tailwind...").start();
|
|
200923
|
+
const cssPath = config?.css ? path2.join(targetPath, config.css) : await getTailwindCssPath(targetPath);
|
|
200924
|
+
const configType = config?.["configure-tailwind.config"] === "ngin" || useNgin ? "ngin" : "basic";
|
|
200925
|
+
const configFile = configType === "ngin" ? "tailwind.config.ngin.js" : "tailwind.config.js";
|
|
200926
|
+
try {
|
|
200927
|
+
await copyFile(path2.join(SOURCE_DATA_FOLDER, "tailwind.css"), cssPath, targetPath);
|
|
200928
|
+
await copyFile(path2.join(SOURCE_DATA_FOLDER, configFile), path2.join(targetPath, "tailwind.config.js"), targetPath);
|
|
200929
|
+
await copyFile(path2.join(SOURCE_DATA_FOLDER, "postcss.config.js"), path2.join(targetPath, "postcss.config.js"), targetPath);
|
|
200930
|
+
spinner.succeed(source_default.green("Tailwind and PostCSS configured!"));
|
|
200931
|
+
} catch (error) {
|
|
200932
|
+
spinner.fail(source_default.red("Failed to configure Tailwind"));
|
|
200933
|
+
throw error;
|
|
200934
|
+
}
|
|
200935
|
+
}
|
|
200936
|
+
async function copyFile(src, dest, targetPath) {
|
|
200975
200937
|
await fs.mkdir(path2.dirname(dest), { recursive: true });
|
|
200976
200938
|
await fs.copyFile(src, dest);
|
|
200977
|
-
console.log(source_default.green(`\u2713 Created ${path2.relative(
|
|
200939
|
+
console.log(source_default.green(`\u2713 Created ${path2.relative(targetPath, dest)}`));
|
|
200978
200940
|
}
|
|
200979
|
-
async function fullInstall(includePremium, useNgin, config) {
|
|
200980
|
-
await installAllComponents(includePremium, config);
|
|
200981
|
-
if (config?.["
|
|
200982
|
-
await
|
|
200983
|
-
}
|
|
200984
|
-
if (config?.["configure-tailwind"] || config?.["configure-postcss"]) {
|
|
200985
|
-
await configureTailwind(useNgin, config);
|
|
200941
|
+
async function fullInstall(includePremium, useNgin, targetPath, config) {
|
|
200942
|
+
await installAllComponents(includePremium, targetPath, config);
|
|
200943
|
+
if (config?.["configure-tailwind"]) {
|
|
200944
|
+
await configureTailwind(useNgin, targetPath, config);
|
|
200986
200945
|
}
|
|
200987
|
-
await ensureUtilsFile(config);
|
|
200946
|
+
await ensureUtilsFile(targetPath, config);
|
|
200988
200947
|
}
|
|
200989
200948
|
async function installComponentsAndLibs(includePremium) {
|
|
200990
200949
|
await installAllComponents(includePremium);
|
|
@@ -201032,99 +200991,97 @@ async function selectComponentsInteractive(includePremium) {
|
|
|
201032
200991
|
await createIndexFiles();
|
|
201033
200992
|
spinner.succeed(source_default.green(`Installed ${selectedComponents.length} components`));
|
|
201034
200993
|
}
|
|
201035
|
-
async function configureProjectPaths() {
|
|
200994
|
+
async function configureProjectPaths(targetPath, config) {
|
|
201036
200995
|
const spinner = ora2("Configuring project paths...").start();
|
|
200996
|
+
const base = config?.components || "app/";
|
|
201037
200997
|
const pathsToAdd = {
|
|
201038
|
-
"#catalyst/*":
|
|
201039
|
-
"#icons": "@catalystsoftware/icons"
|
|
201040
|
-
"#utils/*": "./app/components/catalyst-ui/utils/*",
|
|
201041
|
-
"#prisma": "./app/components/catalyst-ui/utils/prisma.ts",
|
|
201042
|
-
"#auth": "./app/components/catalyst-ui/utils/auth.ts",
|
|
201043
|
-
"#auth_session": "./app/components/catalyst-ui/utils/auth_session.ts",
|
|
201044
|
-
"#access": "./app/components/catalyst-ui/utils/user-based-access-rules.tsx",
|
|
201045
|
-
"#blocks": "./app/components/catalyst-ui/blocks/index.ts",
|
|
201046
|
-
"#hooks": "./app/components/catalyst-ui/hooks/index.ts"
|
|
200998
|
+
"#catalyst/*": `./${base}components/catalyst-ui/*`,
|
|
200999
|
+
"#icons": "@catalystsoftware/icons"
|
|
201047
201000
|
};
|
|
201048
201001
|
try {
|
|
201049
|
-
const pkgPath = path2.join(
|
|
201002
|
+
const pkgPath = path2.join(targetPath, "package.json");
|
|
201050
201003
|
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
201051
201004
|
pkg.imports = { ...pkg.imports, ...pathsToAdd };
|
|
201052
201005
|
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2));
|
|
201053
|
-
|
|
201054
|
-
|
|
201055
|
-
|
|
201056
|
-
|
|
201057
|
-
|
|
201058
|
-
|
|
201059
|
-
|
|
201060
|
-
|
|
201061
|
-
|
|
201062
|
-
|
|
201063
|
-
|
|
201064
|
-
|
|
201065
|
-
|
|
201066
|
-
} catch
|
|
201067
|
-
|
|
201068
|
-
console.error(error);
|
|
201006
|
+
spinner.succeed(source_default.green("Aliases added to package.json"));
|
|
201007
|
+
} catch (e) {
|
|
201008
|
+
spinner.fail(source_default.red("Alias configuration failed"));
|
|
201009
|
+
}
|
|
201010
|
+
}
|
|
201011
|
+
async function loadConfig(targetPath) {
|
|
201012
|
+
const configPath = path2.join(targetPath, "config.catalyst");
|
|
201013
|
+
try {
|
|
201014
|
+
await fs.access(configPath);
|
|
201015
|
+
const content = await fs.readFile(configPath, "utf-8");
|
|
201016
|
+
const jsonContent = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
201017
|
+
const config = JSON.parse(jsonContent);
|
|
201018
|
+
return { ...DEFAULT_CONFIG, ...config };
|
|
201019
|
+
} catch {
|
|
201020
|
+
return null;
|
|
201069
201021
|
}
|
|
201070
201022
|
}
|
|
201071
|
-
async function
|
|
201072
|
-
|
|
201023
|
+
async function createConfig(targetPath) {
|
|
201024
|
+
const configPath = path2.join(targetPath, "config.catalyst");
|
|
201025
|
+
const configContent = JSON.stringify(DEFAULT_CONFIG, null, 2);
|
|
201026
|
+
await fs.writeFile(configPath, configContent, "utf-8");
|
|
201027
|
+
console.log(source_default.green("\u2713 Created config.catalyst"));
|
|
201028
|
+
}
|
|
201029
|
+
async function handleAction(action, isPremium, targetPath, config) {
|
|
201073
201030
|
try {
|
|
201074
201031
|
switch (action) {
|
|
201075
201032
|
case "create-config":
|
|
201076
|
-
await createConfig();
|
|
201033
|
+
await createConfig(targetPath);
|
|
201077
201034
|
console.log(source_default.green(`
|
|
201078
201035
|
\u2714 Config file created!`));
|
|
201079
201036
|
break;
|
|
201080
201037
|
case "full-premium-install":
|
|
201081
|
-
await fullInstall(true, false);
|
|
201038
|
+
await fullInstall(true, false, targetPath, config);
|
|
201082
201039
|
console.log(source_default.green(`
|
|
201083
201040
|
\u2605 Full premium installation complete!`));
|
|
201084
201041
|
break;
|
|
201085
201042
|
case "full-premium-ngin":
|
|
201086
|
-
await fullInstall(true, true);
|
|
201043
|
+
await fullInstall(true, true, targetPath, config);
|
|
201087
201044
|
console.log(source_default.green(`
|
|
201088
201045
|
\u2605 Full premium installation with Ngin complete!`));
|
|
201089
201046
|
break;
|
|
201090
201047
|
case "components-and-libs-premium":
|
|
201091
|
-
await installComponentsAndLibs(true);
|
|
201048
|
+
await installComponentsAndLibs(true, targetPath, config);
|
|
201092
201049
|
console.log(source_default.green(`
|
|
201093
201050
|
\u2605 All premium components and libraries installed!`));
|
|
201094
201051
|
break;
|
|
201095
201052
|
case "full-install":
|
|
201096
|
-
await fullInstall(isPremium, false);
|
|
201053
|
+
await fullInstall(isPremium, false, targetPath, config);
|
|
201097
201054
|
console.log(source_default.green(`
|
|
201098
201055
|
\u2714 Installation complete!`));
|
|
201099
201056
|
break;
|
|
201100
201057
|
case "full-install-ngin":
|
|
201101
|
-
await fullInstall(isPremium, true);
|
|
201058
|
+
await fullInstall(isPremium, true, targetPath, config);
|
|
201102
201059
|
console.log(source_default.green(`
|
|
201103
201060
|
\u2714 Installation with Ngin complete!`));
|
|
201104
201061
|
break;
|
|
201105
201062
|
case "components-and-libs":
|
|
201106
|
-
await installComponentsAndLibs(isPremium);
|
|
201063
|
+
await installComponentsAndLibs(isPremium, targetPath, config);
|
|
201107
201064
|
console.log(source_default.green(`
|
|
201108
201065
|
\u2714 Components and libraries installed!`));
|
|
201109
201066
|
break;
|
|
201110
201067
|
case "configure-tailwind-postcss":
|
|
201111
|
-
await configureTailwind(false);
|
|
201068
|
+
await configureTailwind(false, targetPath, config);
|
|
201112
201069
|
console.log(source_default.green(`
|
|
201113
201070
|
\u2714 Tailwind and PostCSS configured!`));
|
|
201114
201071
|
break;
|
|
201115
201072
|
case "configure-ngin":
|
|
201116
|
-
await configureTailwind(true);
|
|
201073
|
+
await configureTailwind(true, targetPath, config);
|
|
201117
201074
|
console.log(source_default.green(`
|
|
201118
201075
|
\u2714 Configured with Ngin preset!`));
|
|
201119
201076
|
break;
|
|
201120
201077
|
case "select-components":
|
|
201121
|
-
await selectComponentsInteractive(false);
|
|
201078
|
+
await selectComponentsInteractive(false, targetPath, config);
|
|
201122
201079
|
break;
|
|
201123
201080
|
case "select-all-components":
|
|
201124
|
-
await selectComponentsInteractive(true);
|
|
201081
|
+
await selectComponentsInteractive(true, targetPath, config);
|
|
201125
201082
|
break;
|
|
201126
201083
|
case "import-call":
|
|
201127
|
-
await configureProjectPaths();
|
|
201084
|
+
await configureProjectPaths(targetPath, config);
|
|
201128
201085
|
break;
|
|
201129
201086
|
case "exit":
|
|
201130
201087
|
console.log(source_default.cyan(`
|
|
@@ -201142,10 +201099,151 @@ async function handleAction(action, isPremium) {
|
|
|
201142
201099
|
}
|
|
201143
201100
|
async function main2() {
|
|
201144
201101
|
const args = process.argv.slice(2);
|
|
201102
|
+
const pathFlagIndex = args.indexOf("-p");
|
|
201103
|
+
let customPath = process.cwd();
|
|
201104
|
+
if (pathFlagIndex !== -1 && args[pathFlagIndex + 1]) {
|
|
201105
|
+
customPath = path2.resolve(args[pathFlagIndex + 1]);
|
|
201106
|
+
args.splice(pathFlagIndex, 2);
|
|
201107
|
+
}
|
|
201145
201108
|
const config = await loadConfig();
|
|
201146
201109
|
const hasSecretAccess = await checkSecretAccess(args);
|
|
201147
201110
|
const cleanArgs = args.filter((arg) => !arg.startsWith("-") && arg.length <= 50);
|
|
201148
201111
|
const componentArg = cleanArgs.find((arg) => arg.length < 50 && !arg.includes("/"));
|
|
201112
|
+
if (componentArg === "full-w-ngin") {
|
|
201113
|
+
console.log(source_default.blue(`
|
|
201114
|
+
\u2605 Installing...
|
|
201115
|
+
`));
|
|
201116
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201117
|
+
try {
|
|
201118
|
+
await handleAction("full-install-ngin", false, customPath, config);
|
|
201119
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201120
|
+
} catch (error) {
|
|
201121
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201122
|
+
console.error(error);
|
|
201123
|
+
process.exit(1);
|
|
201124
|
+
}
|
|
201125
|
+
return;
|
|
201126
|
+
}
|
|
201127
|
+
if (componentArg === "select-components") {
|
|
201128
|
+
console.log(source_default.blue(`
|
|
201129
|
+
\u2605 Installing...
|
|
201130
|
+
`));
|
|
201131
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201132
|
+
try {
|
|
201133
|
+
await handleAction("select-components", false, customPath, config);
|
|
201134
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201135
|
+
} catch (error) {
|
|
201136
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201137
|
+
console.error(error);
|
|
201138
|
+
process.exit(1);
|
|
201139
|
+
}
|
|
201140
|
+
return;
|
|
201141
|
+
}
|
|
201142
|
+
if (componentArg === "full-install") {
|
|
201143
|
+
console.log(source_default.blue(`
|
|
201144
|
+
\u2605 Installing...
|
|
201145
|
+
`));
|
|
201146
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201147
|
+
try {
|
|
201148
|
+
await handleAction("full-install", false, customPath, config);
|
|
201149
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201150
|
+
} catch (error) {
|
|
201151
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201152
|
+
console.error(error);
|
|
201153
|
+
process.exit(1);
|
|
201154
|
+
}
|
|
201155
|
+
return;
|
|
201156
|
+
}
|
|
201157
|
+
if (componentArg === "comps-and-libs") {
|
|
201158
|
+
console.log(source_default.blue(`
|
|
201159
|
+
\u2605 Installing...
|
|
201160
|
+
`));
|
|
201161
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201162
|
+
try {
|
|
201163
|
+
await handleAction("components-and-libs", false, customPath, config);
|
|
201164
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201165
|
+
} catch (error) {
|
|
201166
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201167
|
+
console.error(error);
|
|
201168
|
+
process.exit(1);
|
|
201169
|
+
}
|
|
201170
|
+
return;
|
|
201171
|
+
}
|
|
201172
|
+
if (componentArg === "create-config") {
|
|
201173
|
+
console.log(source_default.blue(`
|
|
201174
|
+
\u2605 Installing...
|
|
201175
|
+
`));
|
|
201176
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201177
|
+
try {
|
|
201178
|
+
await handleAction("create-config", false, customPath, config);
|
|
201179
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201180
|
+
} catch (error) {
|
|
201181
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201182
|
+
console.error(error);
|
|
201183
|
+
process.exit(1);
|
|
201184
|
+
}
|
|
201185
|
+
return;
|
|
201186
|
+
}
|
|
201187
|
+
if (componentArg === "configure-tailwind-postcss") {
|
|
201188
|
+
console.log(source_default.blue(`
|
|
201189
|
+
\u2605 Installing...
|
|
201190
|
+
`));
|
|
201191
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201192
|
+
try {
|
|
201193
|
+
await handleAction("configure-tailwind-postcss", false, customPath, config);
|
|
201194
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201195
|
+
} catch (error) {
|
|
201196
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201197
|
+
console.error(error);
|
|
201198
|
+
process.exit(1);
|
|
201199
|
+
}
|
|
201200
|
+
return;
|
|
201201
|
+
}
|
|
201202
|
+
if (componentArg === "configure-ngin") {
|
|
201203
|
+
console.log(source_default.blue(`
|
|
201204
|
+
\u2605 Installing...
|
|
201205
|
+
`));
|
|
201206
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201207
|
+
try {
|
|
201208
|
+
await handleAction("configure-ngin", false, customPath, config);
|
|
201209
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201210
|
+
} catch (error) {
|
|
201211
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201212
|
+
console.error(error);
|
|
201213
|
+
process.exit(1);
|
|
201214
|
+
}
|
|
201215
|
+
return;
|
|
201216
|
+
}
|
|
201217
|
+
if (componentArg === "create-config") {
|
|
201218
|
+
console.log(source_default.blue(`
|
|
201219
|
+
\u2605 Installing...
|
|
201220
|
+
`));
|
|
201221
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201222
|
+
try {
|
|
201223
|
+
await handleAction("create-config", false, customPath, config);
|
|
201224
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201225
|
+
} catch (error) {
|
|
201226
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201227
|
+
console.error(error);
|
|
201228
|
+
process.exit(1);
|
|
201229
|
+
}
|
|
201230
|
+
return;
|
|
201231
|
+
}
|
|
201232
|
+
if (componentArg === "import-call") {
|
|
201233
|
+
console.log(source_default.blue(`
|
|
201234
|
+
\u2605 Installing...
|
|
201235
|
+
`));
|
|
201236
|
+
const spinner = ora2({ frames: ["\u28F7", "\u28EF", "\u28DF", "\u287F", "\u28BF", "\u28FB", "\u28FD", "\u28FE"], suffixText: "Installing component..." }).start();
|
|
201237
|
+
try {
|
|
201238
|
+
await handleAction("import-call", false, customPath, config);
|
|
201239
|
+
spinner.succeed(source_default.green(`Successfully installed`));
|
|
201240
|
+
} catch (error) {
|
|
201241
|
+
spinner.fail(source_default.red(`Failed to install`));
|
|
201242
|
+
console.error(error);
|
|
201243
|
+
process.exit(1);
|
|
201244
|
+
}
|
|
201245
|
+
return;
|
|
201246
|
+
}
|
|
201149
201247
|
if (componentArg && componentArg.length < 20) {
|
|
201150
201248
|
console.log(source_default.blue(`
|
|
201151
201249
|
\u2605 Installing component: ${componentArg}
|