dependabot[bot]
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
16 additions and
16 deletions
-
components/__tests__/node.test.tsx
-
package.json
-
scripts/batch/convert-demo.js
-
scripts/check-demo.js
-
scripts/check-ts-demo.js
-
scripts/generate-cssinjs.js
-
tests/shared/demoTest.tsx
-
tests/shared/imageTest.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
|
|
|
|
|
|
@ -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", |
|
|
|
|
|
@ -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); |
|
|
|
|
|
@ -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); |
|
|
|
|
|
@ -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); |
|
|
|
|
|
@ -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)', |
|
|
|
|
|
@ -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('/'); |
|
|
|
|
|
@ -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))) { |
|
|
|