@gesslar/uglier 0.2.0 → 0.4.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 +18 -1
- package/bin/install.js +29 -4
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -42,6 +42,8 @@ npx @gesslar/uglier
|
|
|
42
42
|
|
|
43
43
|
This automatically installs `@gesslar/uglier`, `eslint`, and all dependencies.
|
|
44
44
|
|
|
45
|
+
**Package Manager Support:** Automatically detects and uses your preferred package manager (npm, pnpm, yarn, or Bun). Use `pnpx`, `yarn dlx`, or `bunx` instead of `npx` - the installer will detect your choice and install packages accordingly.
|
|
46
|
+
|
|
45
47
|
## Usage
|
|
46
48
|
|
|
47
49
|
### Generated Config
|
|
@@ -165,6 +167,11 @@ npx @gesslar/uglier init node web # Multiple targets
|
|
|
165
167
|
|
|
166
168
|
# Show available configs
|
|
167
169
|
npx @gesslar/uglier --help
|
|
170
|
+
|
|
171
|
+
# Works with any package manager
|
|
172
|
+
pnpx @gesslar/uglier init node # pnpm
|
|
173
|
+
yarn dlx @gesslar/uglier init node # yarn
|
|
174
|
+
bunx @gesslar/uglier init node # bun
|
|
168
175
|
```
|
|
169
176
|
|
|
170
177
|
## Manual Installation
|
|
@@ -172,7 +179,17 @@ npx @gesslar/uglier --help
|
|
|
172
179
|
If you prefer manual control:
|
|
173
180
|
|
|
174
181
|
```bash
|
|
175
|
-
npm
|
|
182
|
+
# npm
|
|
183
|
+
npm i -D @gesslar/uglier eslint
|
|
184
|
+
|
|
185
|
+
# pnpm
|
|
186
|
+
pnpm i -D @gesslar/uglier eslint
|
|
187
|
+
|
|
188
|
+
# yarn
|
|
189
|
+
yarn add -D @gesslar/uglier eslint
|
|
190
|
+
|
|
191
|
+
# bun
|
|
192
|
+
bun add -d @gesslar/uglier eslint
|
|
176
193
|
```
|
|
177
194
|
|
|
178
195
|
Note: `@stylistic/eslint-plugin`, `eslint-plugin-jsdoc`, and `globals` are bundled as dependencies.
|
package/bin/install.js
CHANGED
|
@@ -26,6 +26,7 @@ import {dirname} from "path"
|
|
|
26
26
|
import {fileURLToPath} from "url"
|
|
27
27
|
import {FileObject, DirectoryObject} from "@gesslar/toolkit"
|
|
28
28
|
import c from "@gesslar/colours"
|
|
29
|
+
import {detectAgent} from "@skarab/detect-package-manager"
|
|
29
30
|
|
|
30
31
|
const __filename = fileURLToPath(import.meta.url)
|
|
31
32
|
const __dirname = dirname(__filename)
|
|
@@ -38,6 +39,28 @@ const PEER_DEPS = [
|
|
|
38
39
|
"eslint"
|
|
39
40
|
]
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Get install command for detected package manager
|
|
44
|
+
*
|
|
45
|
+
* @returns {Promise<{manager: string, installCmd: string}>} Package manager info
|
|
46
|
+
*/
|
|
47
|
+
async function getPackageManagerInfo() {
|
|
48
|
+
const agent = await detectAgent()
|
|
49
|
+
const manager = agent?.name || "npm"
|
|
50
|
+
|
|
51
|
+
const commands = {
|
|
52
|
+
npm: "npm i -D",
|
|
53
|
+
pnpm: "pnpm i -D",
|
|
54
|
+
yarn: "yarn add -D",
|
|
55
|
+
bun: "bun add -d"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
manager,
|
|
60
|
+
installCmd: commands[manager] || commands.npm
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
/**
|
|
42
65
|
* Execute a command and return output
|
|
43
66
|
*
|
|
@@ -145,7 +168,7 @@ async function isInstalled(packageName) {
|
|
|
145
168
|
const packageJsonFile = new FileObject("package.json", process.cwd())
|
|
146
169
|
|
|
147
170
|
if(!(await packageJsonFile.exists)) {
|
|
148
|
-
console.warn(c`No {<B}package.json{B>} found. Please
|
|
171
|
+
console.warn(c`No {<B}package.json{B>} found. Please initialize your project first.`)
|
|
149
172
|
process.exit(1)
|
|
150
173
|
}
|
|
151
174
|
|
|
@@ -191,10 +214,12 @@ async function install() {
|
|
|
191
214
|
if(toInstall.length > 0) {
|
|
192
215
|
console.log(c`\n{F027} Installing:{/} ${toInstall.map(p => c`{F172}${p}{/}`).join(", ")}`)
|
|
193
216
|
|
|
194
|
-
const installCmd =
|
|
217
|
+
const {manager, installCmd} = await getPackageManagerInfo()
|
|
218
|
+
const fullCmd = `${installCmd} ${toInstall.join(" ")}`
|
|
195
219
|
|
|
196
|
-
console.log(c`{F244}
|
|
197
|
-
|
|
220
|
+
console.log(c`{F244}Using package manager: ${manager}{/}`)
|
|
221
|
+
console.log(c`{F244}Running: ${fullCmd}{/}`)
|
|
222
|
+
exec(fullCmd)
|
|
198
223
|
|
|
199
224
|
console.log()
|
|
200
225
|
console.log(c`{F070}✓{/} Installation successful.`)
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/uglier",
|
|
3
3
|
"description": "Composable ESLint flat config blocks for stylistic, JSDoc, and environment presets.",
|
|
4
|
-
"author":
|
|
5
|
-
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "gesslar",
|
|
6
|
+
"email": "bmw@gesslar.dev",
|
|
7
|
+
"url": "https://gesslar.dev"
|
|
8
|
+
},
|
|
9
|
+
"version": "0.4.0",
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
8
12
|
"url": "git+https://github.com/gesslar/uglier.git"
|
|
@@ -39,7 +43,8 @@
|
|
|
39
43
|
},
|
|
40
44
|
"dependencies": {
|
|
41
45
|
"@gesslar/colours": "^0.0.1",
|
|
42
|
-
"@gesslar/toolkit": "^3.
|
|
46
|
+
"@gesslar/toolkit": "^3.4.0",
|
|
47
|
+
"@skarab/detect-package-manager": "^1.0.0",
|
|
43
48
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
44
49
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
45
50
|
"globals": "^16.5.0"
|