@happlyui/cli 0.1.0 → 0.1.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 +11 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -187196,16 +187196,17 @@ function resolveAlias(alias, config) {
|
|
|
187196
187196
|
}
|
|
187197
187197
|
function getComponentPath(componentName, componentType, config) {
|
|
187198
187198
|
const ext = config.tsx ? ".tsx" : ".jsx";
|
|
187199
|
+
const srcPrefix = config.srcDir ? "src/" : "";
|
|
187199
187200
|
switch (componentType) {
|
|
187200
187201
|
case "registry:ui":
|
|
187201
187202
|
case "registry:component":
|
|
187202
|
-
return path2.join(config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
|
|
187203
|
+
return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
|
|
187203
187204
|
case "registry:hook":
|
|
187204
|
-
return path2.join((config.aliases.hooks || "@/hooks").replace("@/", ""), `${componentName}${ext}`);
|
|
187205
|
+
return path2.join(srcPrefix + (config.aliases.hooks || "@/hooks").replace("@/", ""), `${componentName}${ext}`);
|
|
187205
187206
|
case "registry:lib":
|
|
187206
|
-
return path2.join((config.aliases.lib || "@/lib").replace("@/", ""), `${componentName}${ext}`);
|
|
187207
|
+
return path2.join(srcPrefix + (config.aliases.lib || "@/lib").replace("@/", ""), `${componentName}${ext}`);
|
|
187207
187208
|
default:
|
|
187208
|
-
return path2.join(config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
|
|
187209
|
+
return path2.join(srcPrefix + config.aliases.ui.replace("@/", ""), `${componentName}${ext}`);
|
|
187209
187210
|
}
|
|
187210
187211
|
}
|
|
187211
187212
|
async function ensureDir(dirPath) {
|
|
@@ -189053,7 +189054,8 @@ async function init(options) {
|
|
|
189053
189054
|
try {
|
|
189054
189055
|
await writeConfig(cwd, config);
|
|
189055
189056
|
writeSpinner.text = "Created components.json";
|
|
189056
|
-
const
|
|
189057
|
+
const srcPrefix = config.srcDir ? "src/" : "";
|
|
189058
|
+
const utilsPath = srcPrefix + config.aliases.utils.replace("@/", "");
|
|
189057
189059
|
const utilsContent = config.tsx ? UTILS_TEMPLATE : UTILS_JS_TEMPLATE;
|
|
189058
189060
|
const utilsExt = config.tsx ? ".ts" : ".js";
|
|
189059
189061
|
await writeComponentFile(cwd, `${utilsPath}${utilsExt}`, utilsContent);
|
|
@@ -189100,7 +189102,8 @@ async function init(options) {
|
|
|
189100
189102
|
function createDefaultConfig(projectInfo) {
|
|
189101
189103
|
const isSrcDir = projectInfo.isSrcDir;
|
|
189102
189104
|
return {
|
|
189103
|
-
$schema: "https://
|
|
189105
|
+
$schema: "https://cdn.jsdelivr.net/gh/Mindful-Connect/happly-ui-npm@production/schemas/components.json",
|
|
189106
|
+
srcDir: isSrcDir,
|
|
189104
189107
|
tailwind: {
|
|
189105
189108
|
config: projectInfo.tailwindConfig || "tailwind.config.ts",
|
|
189106
189109
|
css: projectInfo.tailwindCss || (isSrcDir ? "src/index.css" : "index.css"),
|
|
@@ -189119,7 +189122,8 @@ function createDefaultConfig(projectInfo) {
|
|
|
189119
189122
|
}
|
|
189120
189123
|
function createConfig(projectInfo, responses) {
|
|
189121
189124
|
return {
|
|
189122
|
-
$schema: "https://
|
|
189125
|
+
$schema: "https://cdn.jsdelivr.net/gh/Mindful-Connect/happly-ui-npm@production/schemas/components.json",
|
|
189126
|
+
srcDir: projectInfo.isSrcDir,
|
|
189123
189127
|
tailwind: {
|
|
189124
189128
|
config: projectInfo.tailwindConfig || "tailwind.config.ts",
|
|
189125
189129
|
css: projectInfo.tailwindCss || (projectInfo.isSrcDir ? "src/index.css" : "index.css"),
|