@electroplix/components 0.2.1 → 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.
Files changed (2) hide show
  1. package/cli.cjs +46 -1
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -173,6 +173,31 @@ for (const cat of Object.keys(CATEGORIES)) {
173
173
 
174
174
  const totalCount = Object.values(CATEGORIES).reduce((sum, a) => sum + a.length, 0);
175
175
 
176
+ /* ══════════════════════════════════════════════════════════════════ */
177
+ /* Package manager detection */
178
+ /* ══════════════════════════════════════════════════════════════════ */
179
+
180
+ function detectPackageManager() {
181
+ const cwd = process.cwd();
182
+
183
+ // Check for lockfiles in order of preference
184
+ if (fs.existsSync(path.join(cwd, "bun.lock"))) {
185
+ return { manager: "bun", command: "bun install", displayName: "Bun" };
186
+ }
187
+ if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
188
+ return { manager: "pnpm", command: "pnpm install", displayName: "pnpm" };
189
+ }
190
+ if (fs.existsSync(path.join(cwd, "yarn.lock"))) {
191
+ return { manager: "yarn", command: "yarn install", displayName: "Yarn" };
192
+ }
193
+ if (fs.existsSync(path.join(cwd, "package-lock.json"))) {
194
+ return { manager: "npm", command: "npm install", displayName: "npm" };
195
+ }
196
+
197
+ // Default to npm if no lockfile found
198
+ return { manager: "npm", command: "npm install", displayName: "npm" };
199
+ }
200
+
176
201
  /* ══════════════════════════════════════════════════════════════════ */
177
202
  /* INIT command */
178
203
  /* ══════════════════════════════════════════════════════════════════ */
@@ -193,7 +218,7 @@ function init() {
193
218
  if (fs.existsSync(configPath)) {
194
219
  skipped.push(configName);
195
220
  } else {
196
- const configTemplate = `import { defineConfig } from "@electroplix/components/config";
221
+ const configTemplate = `import { defineConfig } from "@electroplix/components";
197
222
 
198
223
  const config = defineConfig({
199
224
  // \u2500\u2500 Global overrides (applied to ALL categories) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -280,6 +305,26 @@ export function Providers({ children }: { children: React.ReactNode }) {
280
305
  console.log();
281
306
  console.log(` ${s.gray("import { PrimaryNav, StaticHero } from \"@electroplix/components\";")}`);
282
307
  console.log();
308
+ console.log();
309
+
310
+ /* ── install package ── */
311
+ const { execSync } = require("child_process");
312
+ const pmInfo = detectPackageManager();
313
+
314
+ console.log(` ${s.white("3.")} Installing ${s.cyan("@electroplix/components")} with ${s.cyan(pmInfo.displayName)}...`);
315
+ console.log();
316
+
317
+ try {
318
+ execSync(`${pmInfo.command} @electroplix/components`, { stdio: "inherit" });
319
+ console.log();
320
+ console.log(` ${s.green(B.check)} ${s.bold("Setup complete!")} You're ready to use Electroplix components.`);
321
+ console.log();
322
+ } catch (err) {
323
+ console.log();
324
+ console.log(` ${s.yellow("!")} ${s.bold("Manual install required:")}`);
325
+ console.log(` ${s.cyan(`${pmInfo.command} @electroplix/components`)}`);
326
+ console.log();
327
+ }
283
328
  }
284
329
 
285
330
  /* ══════════════════════════════════════════════════════════════════ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electroplix/components",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Parametric, config-driven UI components by Electroplix. ~154 components across 18 categories — navigation, hero, buttons, forms, content, data display, ecommerce, lists/cards, marketing, media, miscellaneous, modals, onboarding, search, site-identity, social, user-accounts, and blog.",
5
5
  "type": "module",
6
6
  "sideEffects": false,