@gesslar/uglier 0.6.0 → 0.7.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/bin/cli.js +12 -14
- package/package.json +3 -4
package/bin/cli.js
CHANGED
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
import {execSync} from "child_process"
|
|
6
6
|
import {
|
|
7
7
|
FileObject,
|
|
8
|
-
|
|
9
|
-
CappedDirectoryObject,
|
|
8
|
+
VDirectoryObject,
|
|
10
9
|
Sass
|
|
11
10
|
} from "@gesslar/toolkit"
|
|
12
11
|
import c from "@gesslar/colours"
|
|
13
12
|
import {detectAgent} from "@skarab/detect-package-manager"
|
|
14
13
|
|
|
15
|
-
// Use
|
|
14
|
+
// Use VDirectoryObject to ensure we never accidentally venture outside project
|
|
16
15
|
// Cap at project root - this becomes our sandbox boundary
|
|
17
|
-
const PROJECT_ROOT =
|
|
16
|
+
const PROJECT_ROOT = VDirectoryObject.fromCwd()
|
|
18
17
|
const SRC_DIR = PROJECT_ROOT.getDirectory("src")
|
|
19
18
|
const PACKAGE_NAME = "@gesslar/uglier"
|
|
20
19
|
|
|
@@ -120,9 +119,8 @@ export function exec(cmd) {
|
|
|
120
119
|
export async function getAvailableConfigs() {
|
|
121
120
|
try {
|
|
122
121
|
// Try to read from installed package or local source
|
|
123
|
-
const cwd =
|
|
124
|
-
const installedDir =
|
|
125
|
-
|
|
122
|
+
const cwd = VDirectoryObject.fromCwd()
|
|
123
|
+
const installedDir = cwd.getDirectory(`node_modules/${PACKAGE_NAME}/src`)
|
|
126
124
|
const localSource = new FileObject("uglier.js", SRC_DIR)
|
|
127
125
|
const installedSource = new FileObject("uglier.js", installedDir)
|
|
128
126
|
|
|
@@ -168,7 +166,7 @@ export async function getAvailableConfigs() {
|
|
|
168
166
|
*/
|
|
169
167
|
export async function isInstalled(packageName) {
|
|
170
168
|
try {
|
|
171
|
-
const cwd =
|
|
169
|
+
const cwd = VDirectoryObject.fromCwd()
|
|
172
170
|
const packageJsonFile = new FileObject("package.json", cwd)
|
|
173
171
|
|
|
174
172
|
if(!(await packageJsonFile.exists)) {
|
|
@@ -241,8 +239,8 @@ export async function install() {
|
|
|
241
239
|
* @returns {Promise<boolean>} True if successful
|
|
242
240
|
*/
|
|
243
241
|
export async function generateConfig(targets = []) {
|
|
244
|
-
const cwd =
|
|
245
|
-
const configFile =
|
|
242
|
+
const cwd = VDirectoryObject.fromCwd()
|
|
243
|
+
const configFile = cwd.getFile("eslint.config.js")
|
|
246
244
|
|
|
247
245
|
if(await configFile.exists) {
|
|
248
246
|
console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} already exists`)
|
|
@@ -336,8 +334,8 @@ ${withLines}
|
|
|
336
334
|
* @returns {Promise<boolean>} True if successful
|
|
337
335
|
*/
|
|
338
336
|
export async function addToConfig(targets = []) {
|
|
339
|
-
const cwd =
|
|
340
|
-
const configFile =
|
|
337
|
+
const cwd = VDirectoryObject.fromCwd()
|
|
338
|
+
const configFile = cwd.getFile("eslint.config.js")
|
|
341
339
|
|
|
342
340
|
if(!(await configFile.exists)) {
|
|
343
341
|
console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} not found`)
|
|
@@ -461,8 +459,8 @@ export async function addToConfig(targets = []) {
|
|
|
461
459
|
* @returns {Promise<{success: boolean, removedTargets: string[], removedOverrides: string[]}>} Result info
|
|
462
460
|
*/
|
|
463
461
|
export async function removeFromConfig(targets = []) {
|
|
464
|
-
const cwd =
|
|
465
|
-
const configFile =
|
|
462
|
+
const cwd = VDirectoryObject.fromCwd()
|
|
463
|
+
const configFile = cwd.getFile("eslint.config.js")
|
|
466
464
|
|
|
467
465
|
if(!(await configFile.exists)) {
|
|
468
466
|
console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} not found`)
|
package/package.json
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"description": "Composable ESLint flat config blocks for stylistic, JSDoc, and environment presets.",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "gesslar",
|
|
6
|
-
"email": "bmw@gesslar.dev",
|
|
7
6
|
"url": "https://gesslar.dev"
|
|
8
7
|
},
|
|
9
|
-
"version": "0.
|
|
8
|
+
"version": "0.7.0",
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
12
11
|
"url": "git+https://github.com/gesslar/uglier.git"
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
44
|
"@gesslar/colours": "^0.7.1",
|
|
46
|
-
"@gesslar/toolkit": "^3.
|
|
45
|
+
"@gesslar/toolkit": "^3.17.0",
|
|
47
46
|
"@skarab/detect-package-manager": "^1.0.0",
|
|
48
47
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
49
48
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
@@ -57,7 +56,7 @@
|
|
|
57
56
|
"test": "node --test tests/unit/*.test.js",
|
|
58
57
|
"lint": "eslint",
|
|
59
58
|
"lint:fix": "eslint --fix",
|
|
60
|
-
"update": "pnpm
|
|
59
|
+
"update": "pnpm self-update && pnpx npm-check-updates -u && pnpm install",
|
|
61
60
|
"submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
62
61
|
"pr": "gt submit -p --ai",
|
|
63
62
|
"patch": "pnpm version patch",
|