diff --git a/components/__tests__/node.test.tsx b/components/__tests__/node.test.tsx index db9a19df9a..cc63dd37e4 100644 --- a/components/__tests__/node.test.tsx +++ b/components/__tests__/node.test.tsx @@ -1,4 +1,4 @@ -import glob from 'glob'; +import { globSync } from 'glob'; import * as React from 'react'; import { renderToString } from 'react-dom/server'; import type { Options } from '../../tests/shared/demoTest'; @@ -21,14 +21,14 @@ describe('node', () => { }); // Find the component exist demo test file - const files = glob.globSync(`./components/*/__tests__/demo.test.@(j|t)s?(x)`); + const files = globSync(`./components/*/__tests__/demo.test.@(j|t)s?(x)`); files.forEach((componentTestFile) => { const componentName = componentTestFile.match(/components\/([^/]*)\//)![1]; // Test for ssr describe(componentName, () => { - const demoList = glob.globSync(`./components/${componentName}/demo/*.tsx`); + const demoList = globSync(`./components/${componentName}/demo/*.tsx`); // Use mock to get config require(`../../${componentTestFile}`); // eslint-disable-line global-require, import/no-dynamic-require diff --git a/package.json b/package.json index 427085c6c5..80a22e9e8b 100644 --- a/package.json +++ b/package.json @@ -222,7 +222,7 @@ "fetch-jsonp": "^1.1.3", "fs-extra": "^11.0.0", "gh-pages": "^5.0.0", - "glob": "^9.2.1", + "glob": "^10.0.0", "html2sketch": "^1.0.0", "http-server": "^14.0.0", "husky": "^8.0.1", diff --git a/scripts/batch/convert-demo.js b/scripts/batch/convert-demo.js index 9924fac857..b65f76e91d 100644 --- a/scripts/batch/convert-demo.js +++ b/scripts/batch/convert-demo.js @@ -6,14 +6,14 @@ // ============================================================================== const path = require('path'); -const glob = require('glob'); +const { globSync } = require('glob'); const fs = require('fs-extra'); const chalk = require('chalk'); (async () => { console.time('Execution...'); - const demoFiles = glob.globSync(path.join(process.cwd(), 'components/*/demo/*.md')); + const demoFiles = globSync(path.join(process.cwd(), 'components/*/demo/*.md')); const tmpFolder = path.resolve('components', '~tmp'); await fs.remove(tmpFolder); diff --git a/scripts/check-demo.js b/scripts/check-demo.js index 7f06da7531..f8c0d5936a 100644 --- a/scripts/check-demo.js +++ b/scripts/check-demo.js @@ -1,9 +1,9 @@ const path = require('path'); const yfm = require('yaml-front-matter'); -const glob = require('glob'); +const { globSync } = require('glob'); const fs = require('fs'); -const demoFiles = glob.globSync(path.join(process.cwd(), 'components/**/demo/*.md')); +const demoFiles = globSync(path.join(process.cwd(), 'components/**/demo/*.md')); // eslint-disable-next-line no-restricted-syntax for (const url of demoFiles) { const demoContent = fs.readFileSync(url); diff --git a/scripts/check-ts-demo.js b/scripts/check-ts-demo.js index 95d586155b..5a47fce8a5 100644 --- a/scripts/check-ts-demo.js +++ b/scripts/check-ts-demo.js @@ -1,7 +1,7 @@ /* eslint-disable no-await-in-loop, no-console */ const path = require('path'); -const glob = require('glob'); +const { globSync } = require('glob'); const fs = require('fs-extra'); const chalk = require('chalk'); const { spawn } = require('child_process'); @@ -9,7 +9,7 @@ const { spawn } = require('child_process'); (async () => { console.time('Execution...'); - const demoFiles = glob.globSync(path.join(process.cwd(), 'components/**/demo/*.md')); + const demoFiles = globSync(path.join(process.cwd(), 'components/**/demo/*.md')); const tmpFolder = path.resolve('components', '~tmp'); await fs.remove(tmpFolder); diff --git a/scripts/generate-cssinjs.js b/scripts/generate-cssinjs.js index 98a694db85..1e62db098e 100644 --- a/scripts/generate-cssinjs.js +++ b/scripts/generate-cssinjs.js @@ -1,8 +1,8 @@ const React = require('react'); -const glob = require('glob'); +const { globSync } = require('glob'); const path = require('path'); -const styleFiles = glob.globSync( +const styleFiles = globSync( path.join( process.cwd(), 'components/!(version|config-provider|icon|auto-complete|col|row|time-picker)/style/index.?(ts|tsx)', diff --git a/tests/shared/demoTest.tsx b/tests/shared/demoTest.tsx index c10872d7a3..ac120a780e 100644 --- a/tests/shared/demoTest.tsx +++ b/tests/shared/demoTest.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/jsx-no-constructed-context-values */ import { createCache, StyleProvider } from '@ant-design/cssinjs'; -import glob from 'glob'; +import { globSync } from 'glob'; import path from 'path'; import * as React from 'react'; import { renderToString } from 'react-dom/server'; @@ -20,7 +20,7 @@ export type Options = { }; function baseText(doInject: boolean, component: string, options: Options = {}) { - const files = glob.globSync(`./components/${component}/demo/*.tsx`); + const files = globSync(`./components/${component}/demo/*.tsx`); files.forEach((file) => { // to compatible windows path file = file.split(path.sep).join('/'); diff --git a/tests/shared/imageTest.tsx b/tests/shared/imageTest.tsx index dc2c85cbc1..dcd6f0ca51 100644 --- a/tests/shared/imageTest.tsx +++ b/tests/shared/imageTest.tsx @@ -3,7 +3,7 @@ import React from 'react'; // eslint-disable-next-line import/no-unresolved import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs'; import dayjs from 'dayjs'; -import glob from 'glob'; +import { globSync } from 'glob'; import { configureToMatchImageSnapshot } from 'jest-image-snapshot'; import MockDate from 'mockdate'; import ReactDOMServer from 'react-dom/server'; @@ -78,7 +78,7 @@ type Options = { // eslint-disable-next-line jest/no-export export function imageDemoTest(component: string, options: Options = {}) { let describeMethod = options.skip === true ? describe.skip : describe; - const files = glob.globSync(`./components/${component}/demo/*.tsx`); + const files = globSync(`./components/${component}/demo/*.tsx`); files.forEach((file) => { if (Array.isArray(options.skip) && options.skip.some((c) => file.includes(c))) {