@gesslar/uglier 0.6.0 → 1.0.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.
Files changed (2) hide show
  1. package/bin/cli.js +15 -18
  2. package/package.json +3 -4
package/bin/cli.js CHANGED
@@ -4,17 +4,15 @@
4
4
 
5
5
  import {execSync} from "child_process"
6
6
  import {
7
- FileObject,
8
- DirectoryObject,
9
- CappedDirectoryObject,
7
+ VDirectoryObject,
10
8
  Sass
11
9
  } from "@gesslar/toolkit"
12
10
  import c from "@gesslar/colours"
13
11
  import {detectAgent} from "@skarab/detect-package-manager"
14
12
 
15
- // Use CappedDirectoryObject to ensure we never accidentally venture outside project
13
+ // Use VDirectoryObject to ensure we never accidentally venture outside project
16
14
  // Cap at project root - this becomes our sandbox boundary
17
- const PROJECT_ROOT = CappedDirectoryObject.fromCwd()
15
+ const PROJECT_ROOT = VDirectoryObject.fromCwd()
18
16
  const SRC_DIR = PROJECT_ROOT.getDirectory("src")
19
17
  const PACKAGE_NAME = "@gesslar/uglier"
20
18
 
@@ -120,11 +118,10 @@ export function exec(cmd) {
120
118
  export async function getAvailableConfigs() {
121
119
  try {
122
120
  // Try to read from installed package or local source
123
- const cwd = new CappedDirectoryObject(process.cwd())
124
- const installedDir = new DirectoryObject(`node_modules/${PACKAGE_NAME}/src`, cwd)
125
-
126
- const localSource = new FileObject("uglier.js", SRC_DIR)
127
- const installedSource = new FileObject("uglier.js", installedDir)
121
+ const cwd = VDirectoryObject.fromCwd()
122
+ const installedDir = cwd.getDirectory(`node_modules/${PACKAGE_NAME}/src`)
123
+ const localSource = SRC_DIR.getFile("uglier.js")
124
+ const installedSource = installedDir.getFile("uglier.js")
128
125
 
129
126
  let uglierFile = null
130
127
 
@@ -168,8 +165,8 @@ export async function getAvailableConfigs() {
168
165
  */
169
166
  export async function isInstalled(packageName) {
170
167
  try {
171
- const cwd = new CappedDirectoryObject(process.cwd())
172
- const packageJsonFile = new FileObject("package.json", cwd)
168
+ const cwd = VDirectoryObject.fromCwd()
169
+ const packageJsonFile = cwd.getFile("package.json")
173
170
 
174
171
  if(!(await packageJsonFile.exists)) {
175
172
  console.warn(c`No {<B}package.json{B>} found. Please initialize your project first.`)
@@ -241,8 +238,8 @@ export async function install() {
241
238
  * @returns {Promise<boolean>} True if successful
242
239
  */
243
240
  export async function generateConfig(targets = []) {
244
- const cwd = new CappedDirectoryObject(process.cwd())
245
- const configFile = new FileObject("eslint.config.js", cwd)
241
+ const cwd = VDirectoryObject.fromCwd()
242
+ const configFile = cwd.getFile("eslint.config.js")
246
243
 
247
244
  if(await configFile.exists) {
248
245
  console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} already exists`)
@@ -336,8 +333,8 @@ ${withLines}
336
333
  * @returns {Promise<boolean>} True if successful
337
334
  */
338
335
  export async function addToConfig(targets = []) {
339
- const cwd = new CappedDirectoryObject(process.cwd())
340
- const configFile = new FileObject("eslint.config.js", cwd)
336
+ const cwd = VDirectoryObject.fromCwd()
337
+ const configFile = cwd.getFile("eslint.config.js")
341
338
 
342
339
  if(!(await configFile.exists)) {
343
340
  console.log(c`{F214}Error:{/} {<B}eslint.config.js{B>} not found`)
@@ -461,8 +458,8 @@ export async function addToConfig(targets = []) {
461
458
  * @returns {Promise<{success: boolean, removedTargets: string[], removedOverrides: string[]}>} Result info
462
459
  */
463
460
  export async function removeFromConfig(targets = []) {
464
- const cwd = new CappedDirectoryObject(process.cwd())
465
- const configFile = new FileObject("eslint.config.js", cwd)
461
+ const cwd = VDirectoryObject.fromCwd()
462
+ const configFile = cwd.getFile("eslint.config.js")
466
463
 
467
464
  if(!(await configFile.exists)) {
468
465
  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.6.0",
8
+ "version": "1.0.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.9.0",
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 up --latest --recursive",
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",