@androbinco/library-cli 0.1.0 → 0.3.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/README.md +86 -37
- package/package.json +11 -16
- package/src/commands/add.js +107 -0
- package/src/commands/list.js +51 -0
- package/src/index.js +46 -15
- package/src/templates/carousel/components/navigation-buttons.tsx +1 -0
- package/src/templates/carousel/components/pagination/bullet.pagination.carousel.tsx +69 -0
- package/src/templates/carousel/components/pagination/number.pagination.carousel.tsx +30 -0
- package/src/templates/carousel/components/pagination/progress/progress.pagination.carousel.tsx +99 -0
- package/src/templates/carousel/components/pagination/progress/use-slide-progress.tsx +31 -0
- package/src/templates/carousel/components/pagination.tsx +47 -82
- package/src/templates/faqs-accordion/examples/faqs-showcase.tsx +42 -0
- package/src/templates/faqs-accordion/faqs-accordion.tsx +70 -0
- package/src/templates/faqs-accordion/mock-data.ts +38 -0
- package/src/templates/faqs-accordion/types.ts +18 -0
- package/src/templates/in-view/data.in-view.ts +89 -0
- package/src/templates/in-view/examples/in-view-examples.home.tsx +101 -0
- package/src/templates/in-view/examples/in-view-grid-showcase.tsx +41 -0
- package/src/templates/in-view/in-view-animation.tsx +72 -0
- package/src/templates/in-view/in-view-grid.tsx +81 -0
- package/src/templates/in-view/in-view-hidden-text.tsx +45 -0
- package/src/templates/in-view/in-view-stroke-line.tsx +30 -0
- package/src/templates/lenis/examples/providers.tsx +23 -0
- package/src/templates/lenis/lenis-provider.tsx +46 -0
- package/src/templates/scroll-components/hooks/use-client-dimensions.ts +21 -0
- package/src/templates/scroll-components/parallax/examples/parallax-showcase.tsx +87 -0
- package/src/templates/scroll-components/parallax/parallax.css +36 -0
- package/src/templates/scroll-components/parallax/parallax.tsx +67 -0
- package/src/templates/scroll-components/scale-gallery/components/expanding-element.tsx +40 -0
- package/src/templates/scroll-components/scale-gallery/examples/scale-gallery-showcase.tsx +68 -0
- package/src/templates/scroll-components/scale-gallery/scale-gallery.tsx +57 -0
- package/src/templates/scroll-components/scroll-tracker-provider.tsx +78 -0
- package/src/templates/scroll-components/scroll-tracker-showcase.tsx +44 -0
- package/src/templates/strapi-dynamic-zone/README.md +157 -0
- package/src/templates/strapi-dynamic-zone/dynamic-zone.tsx +113 -0
- package/src/templates/strapi-dynamic-zone/examples/page.tsx +53 -0
- package/src/templates/strapi-dynamic-zone/examples/renderers.tsx +74 -0
- package/src/templates/strapi-dynamic-zone/examples/types.ts +41 -0
- package/src/templates/strapi-dynamic-zone/index.ts +11 -0
- package/src/templates/strapi-dynamic-zone/types.ts +73 -0
- package/src/templates/ticker/css-ticker/css-ticker.tsx +61 -0
- package/src/templates/ticker/css-ticker/ticker.keyframes.css +86 -0
- package/src/templates/ticker/examples/ticker-hover-showcase.home.tsx +57 -0
- package/src/templates/ticker/examples/ticker-static-showcase.home.tsx +56 -0
- package/src/templates/ticker/hooks/use-ticker-clones.tsx +70 -0
- package/src/templates/ticker/hooks/use-ticker-incremental.tsx +72 -0
- package/src/templates/ticker/motion-ticker.tsx +93 -0
- package/src/utils/components.js +587 -54
- package/src/utils/files.js +89 -5
- package/src/templates/button/button.tsx +0 -5
- package/src/templates/card/card.tsx +0 -5
- package/src/templates/example/example.tsx +0 -5
- package/src/templates/hero/hero.tsx +0 -5
package/src/utils/files.js
CHANGED
|
@@ -21,7 +21,49 @@ export function isWithinProjectRoot(targetPath) {
|
|
|
21
21
|
return !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export async function
|
|
24
|
+
export async function checkComponentExists(componentName, filename) {
|
|
25
|
+
const componentPath = path.resolve(process.cwd(), 'src', 'components', componentName, filename);
|
|
26
|
+
return await fs.pathExists(componentPath);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function copyExamples(component, templatesDir, examplesToCopy) {
|
|
30
|
+
if (!examplesToCopy || examplesToCopy.length === 0) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const componentSourcePath = path.join(templatesDir, component.sourceDir);
|
|
35
|
+
const componentDestPath = path.resolve(process.cwd(), 'src', 'components', component.name);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
// Copy selected example files
|
|
39
|
+
for (const exampleFile of examplesToCopy) {
|
|
40
|
+
// Support both nested paths (e.g., 'parallax/examples/parallax-showcase.tsx')
|
|
41
|
+
// and flat paths (e.g., 'scroll-tracker-showcase.tsx')
|
|
42
|
+
const sourceFile = path.join(componentSourcePath, exampleFile);
|
|
43
|
+
|
|
44
|
+
// For nested paths like 'parallax/examples/parallax-showcase.tsx',
|
|
45
|
+
// copy to 'examples/parallax-showcase.tsx' in destination
|
|
46
|
+
// For flat paths like 'scroll-tracker-showcase.tsx',
|
|
47
|
+
// copy to 'examples/scroll-tracker-showcase.tsx' in destination
|
|
48
|
+
const filename = path.basename(exampleFile);
|
|
49
|
+
const destFile = path.join(componentDestPath, 'examples', filename);
|
|
50
|
+
|
|
51
|
+
if (await fs.pathExists(sourceFile)) {
|
|
52
|
+
await fs.ensureDir(path.dirname(destFile));
|
|
53
|
+
await fs.copy(sourceFile, destFile, { overwrite: true });
|
|
54
|
+
} else {
|
|
55
|
+
p.log.warn(`Example file "${exampleFile}" not found. Skipping.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return true;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
p.log.error(`Failed to copy examples: ${error.message}`);
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function copyComponent(component, templatesDir, examplesToCopy = null, componentsToCopy = null) {
|
|
25
67
|
const sourcePath = path.join(templatesDir, component.sourceDir);
|
|
26
68
|
const destBasePath = path.resolve(process.cwd(), 'src', 'components', component.name);
|
|
27
69
|
|
|
@@ -35,8 +77,8 @@ export async function copyComponent(component, templatesDir) {
|
|
|
35
77
|
return false;
|
|
36
78
|
}
|
|
37
79
|
|
|
38
|
-
// Check if destination exists and is not empty
|
|
39
|
-
if (await fs.pathExists(destBasePath)) {
|
|
80
|
+
// Check if destination exists and is not empty (only if copying all files)
|
|
81
|
+
if (!componentsToCopy && await fs.pathExists(destBasePath)) {
|
|
40
82
|
const isEmpty = await isDirectoryEmpty(destBasePath);
|
|
41
83
|
|
|
42
84
|
if (!isEmpty) {
|
|
@@ -56,8 +98,50 @@ export async function copyComponent(component, templatesDir) {
|
|
|
56
98
|
// Ensure destination directory exists
|
|
57
99
|
await fs.ensureDir(destBasePath);
|
|
58
100
|
|
|
59
|
-
|
|
60
|
-
|
|
101
|
+
if (componentsToCopy && componentsToCopy.length > 0) {
|
|
102
|
+
// Copy only selected component files
|
|
103
|
+
for (const filename of componentsToCopy) {
|
|
104
|
+
const sourceFile = path.join(sourcePath, filename);
|
|
105
|
+
const destFile = path.join(destBasePath, filename);
|
|
106
|
+
|
|
107
|
+
if (!(await fs.pathExists(sourceFile))) {
|
|
108
|
+
p.log.warn(`Component file "${filename}" not found. Skipping.`);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Check if it's a directory and if it already exists
|
|
113
|
+
const sourceStat = await fs.stat(sourceFile);
|
|
114
|
+
if (sourceStat.isDirectory()) {
|
|
115
|
+
// If directory already exists, skip copying it (allows sharing between variants)
|
|
116
|
+
if (await fs.pathExists(destFile)) {
|
|
117
|
+
p.log.info(`Directory "${filename}" already exists. Skipping to allow sharing.`);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
await fs.copy(sourceFile, destFile, { overwrite: true });
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
// Copy all files from source to destination, excluding examples folder
|
|
126
|
+
const files = await fs.readdir(sourcePath);
|
|
127
|
+
for (const file of files) {
|
|
128
|
+
const sourceFile = path.join(sourcePath, file);
|
|
129
|
+
const destFile = path.join(destBasePath, file);
|
|
130
|
+
const stat = await fs.stat(sourceFile);
|
|
131
|
+
|
|
132
|
+
// Skip examples directory - we'll handle it separately
|
|
133
|
+
if (stat.isDirectory() && file === 'examples') {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
await fs.copy(sourceFile, destFile, { overwrite: true });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Copy selected examples if provided
|
|
142
|
+
if (examplesToCopy && examplesToCopy.length > 0) {
|
|
143
|
+
await copyExamples(component, templatesDir, examplesToCopy);
|
|
144
|
+
}
|
|
61
145
|
|
|
62
146
|
return true;
|
|
63
147
|
} catch (error) {
|