cleanup(js): switch to picomatch (#30079)
This commit is contained in:
parent
c02719d2df
commit
c35862d4b8
@ -141,6 +141,7 @@
|
||||
"@types/marked": "^2.0.0",
|
||||
"@types/node": "20.16.10",
|
||||
"@types/npm-package-arg": "6.1.1",
|
||||
"@types/picomatch": "3.0.2",
|
||||
"@types/react": "18.3.1",
|
||||
"@types/react-dom": "18.3.0",
|
||||
"@types/semver": "^7.5.8",
|
||||
@ -364,6 +365,7 @@
|
||||
"next-seo": "^5.13.0",
|
||||
"node-machine-id": "1.1.12",
|
||||
"npm-run-path": "^4.0.1",
|
||||
"picomatch": "4.0.2",
|
||||
"preact": "10.25.4",
|
||||
"react": "18.3.1",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
|
||||
@ -11,6 +11,10 @@
|
||||
"name": "fast-glob",
|
||||
"message": "Please use `tinyglobby` instead."
|
||||
},
|
||||
{
|
||||
"name": "minimatch",
|
||||
"message": "Please use `picomatch` instead."
|
||||
},
|
||||
{
|
||||
"name": "fs-extra",
|
||||
"message": "Please use equivalent utilities from `node:fs` instead."
|
||||
|
||||
@ -52,10 +52,10 @@
|
||||
"ignore": "^5.0.4",
|
||||
"js-tokens": "^4.0.0",
|
||||
"jsonc-parser": "3.2.0",
|
||||
"minimatch": "9.0.3",
|
||||
"npm-package-arg": "11.0.1",
|
||||
"npm-run-path": "^4.0.1",
|
||||
"ora": "5.3.0",
|
||||
"picomatch": "4.0.2",
|
||||
"semver": "^7.5.3",
|
||||
"source-map-support": "0.5.19",
|
||||
"tinyglobby": "^0.2.10",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { detectPackageManager, type CreateNodesContext } from '@nx/devkit';
|
||||
import { TempFs } from '@nx/devkit/internal-testing-utils';
|
||||
import { minimatch } from 'minimatch';
|
||||
import picomatch = require('picomatch');
|
||||
import { mkdirSync, rmdirSync } from 'node:fs';
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { getLockFileName } from 'nx/src/plugins/js/lock-file/lock-file';
|
||||
@ -3784,7 +3784,7 @@ async function applyFilesToTempFsAndContext(
|
||||
await tempFs.createFiles(fileSys);
|
||||
// @ts-expect-error update otherwise readonly property for testing
|
||||
context.configFiles = Object.keys(fileSys).filter((file) =>
|
||||
minimatch(file, createNodesV2[0], { dot: true })
|
||||
picomatch(createNodesV2[0], { dot: true })(file)
|
||||
);
|
||||
setupWorkspaceContext(tempFs.tempDir);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ import {
|
||||
type TargetConfiguration,
|
||||
} from '@nx/devkit';
|
||||
import { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs';
|
||||
import { minimatch } from 'minimatch';
|
||||
import picomatch = require('picomatch');
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import {
|
||||
basename,
|
||||
@ -555,8 +555,8 @@ function getInputs(
|
||||
if (
|
||||
!otherFilesInclude.some(
|
||||
(includePath) =>
|
||||
minimatch(normalize(includePath), normalize(excludePath)) ||
|
||||
minimatch(normalize(excludePath), normalize(includePath))
|
||||
picomatch(normalize(excludePath))(normalize(includePath)) ||
|
||||
picomatch(normalize(includePath))(normalize(excludePath))
|
||||
)
|
||||
) {
|
||||
excludePaths.add(excludePath);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { minimatch } from 'minimatch';
|
||||
import picomatch = require('picomatch');
|
||||
import {
|
||||
copyFileSync,
|
||||
existsSync,
|
||||
@ -169,8 +169,8 @@ export class CopyAssetsHandler {
|
||||
const pathFromRoot = path.relative(this.rootDir, event.path);
|
||||
for (const ag of this.assetGlobs) {
|
||||
if (
|
||||
minimatch(pathFromRoot, ag.pattern) &&
|
||||
!ag.ignore?.some((ig) => minimatch(pathFromRoot, ig)) &&
|
||||
picomatch(ag.pattern)(pathFromRoot) &&
|
||||
!ag.ignore?.some((ig) => picomatch(ig)(pathFromRoot)) &&
|
||||
!this.ignore.ignores(pathFromRoot)
|
||||
) {
|
||||
const relPath = path.relative(ag.input, pathFromRoot);
|
||||
@ -192,7 +192,7 @@ export class CopyAssetsHandler {
|
||||
private filesToEvent(files: string[], assetGlob: AssetEntry): FileEvent[] {
|
||||
return files.reduce((acc, src) => {
|
||||
if (
|
||||
!assetGlob.ignore?.some((ig) => minimatch(src, ig)) &&
|
||||
!assetGlob.ignore?.some((ig) => picomatch(ig)(src)) &&
|
||||
!this.ignore.ignores(src)
|
||||
) {
|
||||
const relPath = path.relative(assetGlob.input, src);
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
type GeneratorCallback,
|
||||
type Tree,
|
||||
} from '@nx/devkit';
|
||||
import { minimatch } from 'minimatch';
|
||||
import picomatch = require('picomatch');
|
||||
import { join } from 'node:path/posix';
|
||||
import { getGlobPatternsFromPackageManagerWorkspaces } from 'nx/src/plugins/package-json';
|
||||
import { PackageJson } from 'nx/src/utils/package-json';
|
||||
@ -30,7 +30,7 @@ export function getProjectPackageManagerWorkspaceState(
|
||||
(path) => readJson(tree, path, { expectComments: true })
|
||||
);
|
||||
const isIncluded = patterns.some((p) =>
|
||||
minimatch(join(projectRoot, 'package.json'), p)
|
||||
picomatch(p)(join(projectRoot, 'package.json'))
|
||||
);
|
||||
|
||||
return isIncluded ? 'included' : 'excluded';
|
||||
|
||||
11
pnpm-lock.yaml
generated
11
pnpm-lock.yaml
generated
@ -120,6 +120,9 @@ importers:
|
||||
npm-run-path:
|
||||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
picomatch:
|
||||
specifier: 4.0.2
|
||||
version: 4.0.2
|
||||
preact:
|
||||
specifier: 10.25.4
|
||||
version: 10.25.4
|
||||
@ -505,6 +508,9 @@ importers:
|
||||
'@types/npm-package-arg':
|
||||
specifier: 6.1.1
|
||||
version: 6.1.1
|
||||
'@types/picomatch':
|
||||
specifier: 3.0.2
|
||||
version: 3.0.2
|
||||
'@types/react':
|
||||
specifier: 18.3.1
|
||||
version: 18.3.1
|
||||
@ -7282,6 +7288,9 @@ packages:
|
||||
'@types/phoenix@1.6.5':
|
||||
resolution: {integrity: sha512-xegpDuR+z0UqG9fwHqNoy3rI7JDlvaPh2TY47Fl80oq6g+hXT+c/LEuE43X48clZ6lOfANl5WrPur9fYO1RJ/w==}
|
||||
|
||||
'@types/picomatch@3.0.2':
|
||||
resolution: {integrity: sha512-n0i8TD3UDB7paoMMxA3Y65vUncFJXjcUf7lQY7YyKGl6031FNjfsLs6pdLFCy2GNFxItPJG8GvvpbZc2skH7WA==}
|
||||
|
||||
'@types/prettier@2.7.3':
|
||||
resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==}
|
||||
|
||||
@ -25667,6 +25676,8 @@ snapshots:
|
||||
|
||||
'@types/phoenix@1.6.5': {}
|
||||
|
||||
'@types/picomatch@3.0.2': {}
|
||||
|
||||
'@types/prettier@2.7.3': {}
|
||||
|
||||
'@types/prop-types@15.7.13': {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user