watercolor-ui 1.2.0 → 1.2.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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024 Watercolor UI Team
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -8,36 +8,26 @@ This package is an installer for Watercolor UI.
8
8
  npm install watercolor-ui
9
9
  ```
10
10
 
11
- During installation, it will install the core package and the selected platform package:
11
+ Run the installer to install the core package and the selected platform package:
12
12
 
13
13
  - `@zeturn/watercolor-core`
14
14
  - `@zeturn/watercolor-react` or `@zeturn/watercolor-vue`
15
15
  - One icon package (optional)
16
16
 
17
- ### Control the selection
17
+ ### Choose a platform
18
18
 
19
- Set the framework explicitly if you want non-interactive installs:
19
+ Use the CLI interactively:
20
20
 
21
21
  ```bash
22
- WATERCOLOR_UI_FRAMEWORK=react npm install watercolor-ui
23
- WATERCOLOR_UI_FRAMEWORK=vue npm install watercolor-ui
24
- WATERCOLOR_UI_FRAMEWORK=both npm install watercolor-ui
25
- ```
26
-
27
- Set the icon pack explicitly (defaults to none):
28
-
29
- ```bash
30
- WATERCOLOR_UI_ICONS=feather npm install watercolor-ui
31
- WATERCOLOR_UI_ICONS=heroicons npm install watercolor-ui
32
- WATERCOLOR_UI_ICONS=lucide npm install watercolor-ui
33
- WATERCOLOR_UI_ICONS=phosphor npm install watercolor-ui
34
- WATERCOLOR_UI_ICONS=tabler npm install watercolor-ui
22
+ npx watercolor-ui
35
23
  ```
36
24
 
37
- You can also run the installer manually:
25
+ Or choose the framework and optional icon pack explicitly:
38
26
 
39
27
  ```bash
40
28
  npx watercolor-ui --framework react
41
- npx watercolor-ui --icons lucide
42
- npx watercolor-ui
29
+ npx watercolor-ui --framework vue --icons lucide
43
30
  ```
31
+
32
+ Installing `watercolor-ui` has no postinstall side effects. The CLI only changes
33
+ dependencies when you invoke it explicitly.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "watercolor-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Watercolor UI installer for core and platform packages",
5
+ "type": "commonjs",
5
6
  "main": "scripts/installer.js",
6
7
  "bin": {
7
8
  "watercolor-ui": "bin/watercolor-ui.js"
@@ -12,9 +13,6 @@
12
13
  "README.md",
13
14
  "package.json"
14
15
  ],
15
- "scripts": {
16
- "postinstall": "node scripts/postinstall.js"
17
- },
18
16
  "publishConfig": {
19
17
  "access": "public"
20
18
  },
@@ -2,29 +2,32 @@ const fs = require('fs')
2
2
  const path = require('path')
3
3
  const { spawnSync } = require('child_process')
4
4
  const readline = require('readline')
5
+ const { version: WATERCOLOR_VERSION } = require('../package.json')
5
6
 
6
- const PACKAGE_CORE = '@zeturn/watercolor-core'
7
- const PACKAGE_REACT = '@zeturn/watercolor-react'
8
- const PACKAGE_VUE = '@zeturn/watercolor-vue'
7
+ const watercolorPackage = name => `${name}@${WATERCOLOR_VERSION}`
8
+ const PACKAGE_CORE = watercolorPackage('@zeturn/watercolor-core')
9
+ const PACKAGE_REACT = watercolorPackage('@zeturn/watercolor-react')
10
+ const PACKAGE_VUE = watercolorPackage('@zeturn/watercolor-vue')
9
11
  const ICON_PACKAGES = {
10
- feather: '@zeturn/watercolor-icons-feather',
12
+ feather: watercolorPackage('@zeturn/watercolor-icons-feather'),
11
13
  heroicons: {
12
- react: '@zeturn/watercolor-icons-heroicons-react',
13
- vue: '@zeturn/watercolor-icons-heroicons-vue'
14
+ react: watercolorPackage('@zeturn/watercolor-icons-heroicons-react'),
15
+ vue: watercolorPackage('@zeturn/watercolor-icons-heroicons-vue')
14
16
  },
15
17
  lucide: {
16
- react: '@zeturn/watercolor-icons-lucide-react',
17
- vue: '@zeturn/watercolor-icons-lucide-vue'
18
+ react: watercolorPackage('@zeturn/watercolor-icons-lucide-react'),
19
+ vue: watercolorPackage('@zeturn/watercolor-icons-lucide-vue')
18
20
  },
19
21
  phosphor: {
20
- react: '@zeturn/watercolor-icons-phosphor-react',
21
- vue: '@zeturn/watercolor-icons-phosphor-vue'
22
+ react: watercolorPackage('@zeturn/watercolor-icons-phosphor-react'),
23
+ vue: watercolorPackage('@zeturn/watercolor-icons-phosphor-vue')
22
24
  },
23
25
  tabler: {
24
- react: '@zeturn/watercolor-icons-tabler-react',
25
- vue: '@zeturn/watercolor-icons-tabler-vue'
26
+ react: watercolorPackage('@zeturn/watercolor-icons-tabler-react'),
27
+ vue: watercolorPackage('@zeturn/watercolor-icons-tabler-vue')
26
28
  }
27
29
  }
30
+ const packageName = specifier => specifier.slice(0, specifier.lastIndexOf('@'))
28
31
  const ROOT_PACKAGE_NAME = 'watercolor-ui-root'
29
32
 
30
33
  function getPackageManager() {
@@ -53,8 +56,8 @@ function detectFramework(pkg) {
53
56
  ...(pkg.peerDependencies || {})
54
57
  }
55
58
 
56
- const hasReact = Boolean(deps.react || deps['react-dom'] || deps[PACKAGE_REACT])
57
- const hasVue = Boolean(deps.vue || deps[PACKAGE_VUE])
59
+ const hasReact = Boolean(deps.react || deps['react-dom'] || deps[packageName(PACKAGE_REACT)])
60
+ const hasVue = Boolean(deps.vue || deps[packageName(PACKAGE_VUE)])
58
61
 
59
62
  if (hasReact && hasVue) return 'both'
60
63
  if (hasReact) return 'react'
@@ -71,11 +74,11 @@ function detectIconPack(pkg) {
71
74
  }
72
75
 
73
76
  const detected = []
74
- if (deps[ICON_PACKAGES.feather]) detected.push('feather')
75
- if (deps[ICON_PACKAGES.heroicons.react] || deps[ICON_PACKAGES.heroicons.vue]) detected.push('heroicons')
76
- if (deps[ICON_PACKAGES.lucide.react] || deps[ICON_PACKAGES.lucide.vue]) detected.push('lucide')
77
- if (deps[ICON_PACKAGES.phosphor.react] || deps[ICON_PACKAGES.phosphor.vue]) detected.push('phosphor')
78
- if (deps[ICON_PACKAGES.tabler.react] || deps[ICON_PACKAGES.tabler.vue]) detected.push('tabler')
77
+ if (deps[packageName(ICON_PACKAGES.feather)]) detected.push('feather')
78
+ if (deps[packageName(ICON_PACKAGES.heroicons.react)] || deps[packageName(ICON_PACKAGES.heroicons.vue)]) detected.push('heroicons')
79
+ if (deps[packageName(ICON_PACKAGES.lucide.react)] || deps[packageName(ICON_PACKAGES.lucide.vue)]) detected.push('lucide')
80
+ if (deps[packageName(ICON_PACKAGES.phosphor.react)] || deps[packageName(ICON_PACKAGES.phosphor.vue)]) detected.push('phosphor')
81
+ if (deps[packageName(ICON_PACKAGES.tabler.react)] || deps[packageName(ICON_PACKAGES.tabler.vue)]) detected.push('tabler')
79
82
 
80
83
  if (detected.length === 1) return detected[0]
81
84
  return null
@@ -1,5 +0,0 @@
1
- const { runInstaller } = require('./installer')
2
-
3
- runInstaller({ interactive: true }).catch(error => {
4
- console.warn('[watercolor-ui] Installer error:', error.message)
5
- })