@nqlib/nqui 0.1.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nqlib/nqui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A React component library with enhanced UI components and developer tools",
5
5
  "type": "module",
6
6
  "main": "./dist/nqui.cjs.js",
@@ -27,6 +27,7 @@ const isPublishedPackage = !existsSync(indexCssPath) && existsSync(distStylesPat
27
27
 
28
28
  // Function to find actual CSS file location for Next.js
29
29
  function findNextJsCssFile() {
30
+ // Check for existing CSS files first (prioritize globals.css)
30
31
  const possiblePaths = [
31
32
  'src/app/globals.css',
32
33
  'app/globals.css',
@@ -41,10 +42,20 @@ function findNextJsCssFile() {
41
42
  }
42
43
  }
43
44
 
44
- // Default fallback based on directory structure
45
+ // If no CSS file exists, determine based on directory structure
46
+ // Check for src/app/ first (Next.js with src directory)
45
47
  if (existsSync(join(process.cwd(), 'src', 'app'))) {
46
48
  return 'src/app/globals.css';
47
49
  }
50
+ // Check for app/ (Next.js without src directory)
51
+ if (existsSync(join(process.cwd(), 'app'))) {
52
+ return 'app/globals.css';
53
+ }
54
+
55
+ // Final fallback: prefer src/app/ if src exists, otherwise app/
56
+ if (existsSync(join(process.cwd(), 'src'))) {
57
+ return 'src/app/globals.css';
58
+ }
48
59
  return 'app/globals.css';
49
60
  }
50
61
 
@@ -84,8 +95,11 @@ function getDefaultPath(projectType) {
84
95
 
85
96
  function findProjectType() {
86
97
  // Check for framework-specific files
98
+ // Next.js: check for next.config.js/ts OR app directory OR src/app directory
87
99
  if (existsSync(join(process.cwd(), 'next.config.js')) ||
88
- existsSync(join(process.cwd(), 'next.config.ts'))) {
100
+ existsSync(join(process.cwd(), 'next.config.ts')) ||
101
+ existsSync(join(process.cwd(), 'app')) ||
102
+ existsSync(join(process.cwd(), 'src', 'app'))) {
89
103
  return 'nextjs';
90
104
  }
91
105
  if (existsSync(join(process.cwd(), 'vite.config.js')) ||
@@ -417,7 +431,19 @@ async function copyNextJsExamples() {
417
431
 
418
432
  async function main() {
419
433
  const args = process.argv.slice(2);
420
- const targetPath = args[0];
434
+ let targetPath = args[0];
435
+
436
+ // Ignore command names that might be passed as arguments when called via npx
437
+ // Common command names: 'init-css', 'nqui', 'nqui-init-css'
438
+ if (targetPath === 'init-css' || targetPath === 'nqui' || targetPath === 'nqui-init-css') {
439
+ targetPath = args[1] || undefined;
440
+ }
441
+
442
+ // If targetPath doesn't look like a file path (no extension, no directory separators), ignore it
443
+ // This prevents treating command names or other non-path arguments as file paths
444
+ if (targetPath && !targetPath.includes('.') && !targetPath.includes('/') && !targetPath.includes('\\')) {
445
+ targetPath = undefined;
446
+ }
421
447
 
422
448
  try {
423
449
  // Extract standalone CSS