rxn-ui 0.6.3 → 0.6.4

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/cli/init.js CHANGED
@@ -3,7 +3,6 @@ import path from 'node:path'
3
3
 
4
4
  import { STYLES_FILES, GITHUB_RAW, cwd } from './constants.js'
5
5
  import { detectProject, loadConfig, saveConfig } from './utils/config.js'
6
- import { downloadItems } from './add.js'
7
6
  import { fetchFile } from './utils/fetch.js'
8
7
  import { log } from './utils/logger.js'
9
8
 
@@ -30,6 +29,18 @@ async function downloadStyles(stylesDir) {
30
29
  }
31
30
  }
32
31
 
32
+ function getDefaultStylesDir() {
33
+ const hasSrc = fs.existsSync(path.join(cwd, 'src'))
34
+ const base = hasSrc ? 'src/app/styles' : 'styles'
35
+ const stylesPath = path.join(cwd, base)
36
+
37
+ if (fs.existsSync(stylesPath)) {
38
+ const dir = path.dirname(base)
39
+ return path.join(dir, 'rxn-styles')
40
+ }
41
+ return base
42
+ }
43
+
33
44
  export async function init(cmdOptions = {}) {
34
45
  const configPath = path.join(cwd, 'rxn-ui.json')
35
46
 
@@ -38,7 +49,6 @@ export async function init(cmdOptions = {}) {
38
49
  log.info(`
39
50
  Already initialized at ${configPath}
40
51
  Components: ${existing.components}
41
- Styles: ${existing.styles}
42
52
  Assets: ${existing.assets}`)
43
53
  return
44
54
  }
@@ -48,22 +58,14 @@ Assets: ${existing.assets}`)
48
58
  if (cmdOptions.components) {
49
59
  config.components = cmdOptions.components
50
60
  }
51
- if (cmdOptions.styles) {
52
- config.styles = cmdOptions.styles
53
- } else {
54
- config.styles = 'styles'
55
- }
56
61
  if (cmdOptions.composables) {
57
62
  config.composables = cmdOptions.composables
58
63
  }
59
-
60
- // Check if styles dir exists, use 'rxn-styles' prefix to avoid conflicts
61
- const stylesPath = path.join(cwd, config.styles)
62
- if (fs.existsSync(stylesPath)) {
63
- const base = path.basename(config.styles)
64
- const dir = path.dirname(config.styles)
65
- config.styles = path.join(dir, `rxn-${base}`)
66
- log.info(`Styles directory "${config.styles}" (prefixed to avoid conflict)`)
64
+ if (cmdOptions.assets) {
65
+ config.assets = cmdOptions.assets
66
+ }
67
+ if (cmdOptions.utils) {
68
+ config.utils = cmdOptions.utils
67
69
  }
68
70
 
69
71
  saveConfig(config)
@@ -71,13 +73,12 @@ Assets: ${existing.assets}`)
71
73
  log(`\n
72
74
  Configuration saved to ${configPath}
73
75
  Components: ${config.components}
74
- Styles: ${config.styles}
75
76
  Composables: ${config.composables}
76
77
  Assets: ${config.assets}
77
78
  Utils: ${config.utils}`)
78
79
 
79
- // Download styles
80
- const stylesDir = path.join(cwd, config.styles)
80
+ // Download styles to default location
81
+ const stylesDir = path.join(cwd, getDefaultStylesDir())
81
82
  await downloadStyles(stylesDir)
82
83
 
83
84
  log(`\nNow you can add components:
package/cli/showHelp.js CHANGED
@@ -15,8 +15,9 @@ ${colors.bold}Commands:${colors.reset}
15
15
 
16
16
  ${colors.bold}Options:${colors.reset}
17
17
  --components <path> Custom components directory
18
- --styles <path> Custom styles directory
19
18
  --composables <path> Custom composables directory
19
+ --assets <path> Custom assets directory
20
+ --utils <path> Custom utils directory
20
21
 
21
22
  ${colors.bold}Examples:${colors.reset}
22
23
  npx rxn-ui init
@@ -21,7 +21,7 @@ export function detectProject() {
21
21
  return {
22
22
  components: hasSrc ? 'src/shared/components' : 'components',
23
23
  composables: hasSrc ? 'src/shared/composables' : 'composables',
24
- assets: hasSrc ? 'src/assets' : 'assets',
24
+ assets: hasSrc ? 'src/shared/assets' : 'assets',
25
25
  utils: hasSrc ? 'src/shared/utils' : 'utils',
26
26
  }
27
27
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rxn-ui",
3
3
  "description": "Vue 3 UI component library",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "type": "module",