From fbdf97801e10f995fea766e1f5fe6a4a63ef8006 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 2 Oct 2024 13:45:25 -0700 Subject: [PATCH] tinyglobby can replace is-glob as well --- package-lock.json | 10 ++-------- package.json | 2 -- src/cli.ts | 5 ++--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 57b7930f..6ac6d51f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "@apidevtools/json-schema-ref-parser": "^11.5.5", "@types/json-schema": "^7.0.15", "@types/lodash": "^4.17.7", - "is-glob": "^4.0.3", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "minimist": "^1.2.8", @@ -24,7 +23,6 @@ }, "devDependencies": { "@types/cli-color": "^2.0.6", - "@types/is-glob": "^4.0.4", "@types/js-yaml": "^4.0.9", "@types/minimist": "^1.2.5", "@types/node": "^20.12.7", @@ -468,12 +466,6 @@ "integrity": "sha512-uLK0/0dOYdkX8hNsezpYh1gc8eerbhf9bOKZ3e24sP67703mw9S14/yW6mSTatiaKO9v+mU/a1EVy4rOXXeZTA==", "dev": true }, - "node_modules/@types/is-glob": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/is-glob/-/is-glob-4.0.4.tgz", - "integrity": "sha512-3mFBtIPQ0TQetKRDe94g8YrxJZxdMillMGegyv6zRBXvq4peRRhf2wLZ/Dl53emtTsC29dQQBwYvovS20yXpiQ==", - "dev": true - }, "node_modules/@types/js-yaml": { "version": "4.0.9", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", @@ -3846,6 +3838,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3881,6 +3874,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, diff --git a/package.json b/package.json index a20fb9f9..be8675f7 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "@apidevtools/json-schema-ref-parser": "^11.5.5", "@types/json-schema": "^7.0.15", "@types/lodash": "^4.17.7", - "is-glob": "^4.0.3", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "minimist": "^1.2.8", @@ -60,7 +59,6 @@ }, "devDependencies": { "@types/cli-color": "^2.0.6", - "@types/is-glob": "^4.0.4", "@types/js-yaml": "^4.0.9", "@types/minimist": "^1.2.5", "@types/node": "^20.12.7", diff --git a/src/cli.ts b/src/cli.ts index bbbea66a..51bc29a8 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -2,8 +2,7 @@ import minimist from 'minimist' import {readFileSync, writeFileSync, existsSync, lstatSync, readdirSync, mkdirSync} from 'fs' -import {glob} from 'tinyglobby' -import isGlob from 'is-glob' +import {glob, isDynamicPattern} from 'tinyglobby' import {join, resolve, dirname} from 'path' import {compile, DEFAULT_OPTIONS, Options} from './index' import {pathTransform, error, parseFileAsJSONSchema, justName} from './utils' @@ -39,7 +38,7 @@ async function main(argv: minimist.ParsedArgs) { const argIn: string = argv._[0] || argv.input const argOut: string | undefined = argv._[1] || argv.output // the output can be omitted so this can be undefined - const ISGLOB = isGlob(argIn) + const ISGLOB = isDynamicPattern(argIn) const ISDIR = isDir(argIn) if ((ISGLOB || ISDIR) && argOut && argOut.includes('.d.ts')) {