cleanup(vue): migrate to picomatch (#30483)

This commit is contained in:
James Garbutt 2025-05-01 08:05:48 +01:00 committed by GitHub
parent 0eef86ee20
commit 6d36be0d24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View File

@ -4,7 +4,15 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {} "rules": {
"no-restricted-imports": [
"error",
{
"name": "minimatch",
"message": "Please use `picomatch` instead."
}
]
}
}, },
{ {
"files": ["*.ts", "*.tsx"], "files": ["*.ts", "*.tsx"],

View File

@ -29,7 +29,7 @@
"migrations": "./migrations.json" "migrations": "./migrations.json"
}, },
"dependencies": { "dependencies": {
"minimatch": "9.0.3", "picomatch": "^4.0.2",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"@nx/devkit": "file:../devkit", "@nx/devkit": "file:../devkit",
"@nx/js": "file:../js", "@nx/js": "file:../js",

View File

@ -13,7 +13,7 @@ import {
import { basename, join } from 'path'; import { basename, join } from 'path';
import { nxVersion } from '../../utils/versions'; import { nxVersion } from '../../utils/versions';
import { createComponentStories } from './lib/component-story'; import { createComponentStories } from './lib/component-story';
import { minimatch } from 'minimatch'; import picomatch = require('picomatch');
export interface StorybookStoriesSchema { export interface StorybookStoriesSchema {
project: string; project: string;
@ -43,7 +43,7 @@ export async function createAllStories(
visitNotIgnoredFiles(tree, p, (path) => { visitNotIgnoredFiles(tree, p, (path) => {
// Ignore private files starting with "_". // Ignore private files starting with "_".
if (basename(path).startsWith('_')) return; if (basename(path).startsWith('_')) return;
if (ignorePaths?.some((pattern) => minimatch(path, pattern))) return; if (ignorePaths?.some((pattern) => picomatch(pattern)(path))) return;
if (path.endsWith('.vue')) { if (path.endsWith('.vue')) {
// Let's see if the .stories.* file exists // Let's see if the .stories.* file exists
const ext = path.slice(path.lastIndexOf('.')); const ext = path.slice(path.lastIndexOf('.'));