mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-08 01:53:34 +08:00
chore(deps): update dependency chalk to v5 (#52109)
* chore(deps): update dependency chalk to v5 * migrate chalk * Update .github/workflows/test.yml Signed-off-by: afc163 <afc163@gmail.com> --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
4985db9d56
commit
ff52bbcc86
@ -2,7 +2,6 @@ import { createHash } from 'crypto';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import createEmotionServer from '@emotion/server/create-instance';
|
import createEmotionServer from '@emotion/server/create-instance';
|
||||||
import chalk from 'chalk';
|
|
||||||
import type { IApi, IRoute } from 'dumi';
|
import type { IApi, IRoute } from 'dumi';
|
||||||
import ReactTechStack from 'dumi/dist/techStacks/react';
|
import ReactTechStack from 'dumi/dist/techStacks/react';
|
||||||
import sylvanas from 'sylvanas';
|
import sylvanas from 'sylvanas';
|
||||||
@ -126,7 +125,8 @@ class AntdReactTechStack extends ReactTechStack {
|
|||||||
|
|
||||||
const resolve = (p: string): string => require.resolve(p);
|
const resolve = (p: string): string => require.resolve(p);
|
||||||
|
|
||||||
const RoutesPlugin = (api: IApi) => {
|
const RoutesPlugin = async (api: IApi) => {
|
||||||
|
const chalk = await import('chalk').then((m) => m.default);
|
||||||
// const ssrCssFileName = `ssr-${Date.now()}.css`;
|
// const ssrCssFileName = `ssr-${Date.now()}.css`;
|
||||||
|
|
||||||
const writeCSSFile = (key: string, hashKey: string, cssString: string) => {
|
const writeCSSFile = (key: string, hashKey: string, cssString: string) => {
|
||||||
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -175,7 +175,7 @@ jobs:
|
|||||||
CI: 1
|
CI: 1
|
||||||
|
|
||||||
- name: check build files
|
- name: check build files
|
||||||
run: node ./tests/dekko/index.test.js
|
run: bun run test:dekko
|
||||||
|
|
||||||
# Artifact build files
|
# Artifact build files
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
"pretest": "npm run version",
|
"pretest": "npm run version",
|
||||||
"test": "jest --config .jest.js --no-cache",
|
"test": "jest --config .jest.js --no-cache",
|
||||||
"test:all": "sh -e ./scripts/test-all.sh",
|
"test:all": "sh -e ./scripts/test-all.sh",
|
||||||
"test:dekko": "node ./tests/dekko/index.test.js",
|
"test:dekko": "tsx ./tests/dekko/index.test.ts",
|
||||||
"test:image": "jest --config .jest.image.js --no-cache -i -u --forceExit",
|
"test:image": "jest --config .jest.image.js --no-cache -i -u --forceExit",
|
||||||
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
|
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
|
||||||
"test:package-diff": "antd-tools run package-diff",
|
"test:package-diff": "antd-tools run package-diff",
|
||||||
@ -222,7 +222,7 @@
|
|||||||
"antd-style": "^3.7.0",
|
"antd-style": "^3.7.0",
|
||||||
"antd-token-previewer": "^2.0.8",
|
"antd-token-previewer": "^2.0.8",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^5.0.0",
|
||||||
"cheerio": "^1.0.0",
|
"cheerio": "^1.0.0",
|
||||||
"circular-dependency-plugin": "^5.2.2",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
|
@ -58,11 +58,11 @@ fi
|
|||||||
if ! has_arg '--skip-dekko' "$@"; then
|
if ! has_arg '--skip-dekko' "$@"; then
|
||||||
echo "[TEST ALL] dekko dist"
|
echo "[TEST ALL] dekko dist"
|
||||||
echo "[TEST ALL] dekko dist" > ~test-all.txt
|
echo "[TEST ALL] dekko dist" > ~test-all.txt
|
||||||
node ./tests/dekko/dist.test.js
|
tsx ./tests/dekko/dist.test.ts
|
||||||
|
|
||||||
echo "[TEST ALL] dekko lib and es"
|
echo "[TEST ALL] dekko lib and es"
|
||||||
echo "[TEST ALL] dekko lib and es" > ~test-all.txt
|
echo "[TEST ALL] dekko lib and es" > ~test-all.txt
|
||||||
node ./tests/dekko/lib-es.test.js
|
tsx ./tests/dekko/lib-es.test.ts
|
||||||
else
|
else
|
||||||
echo "[TEST ALL] dekko test...skip"
|
echo "[TEST ALL] dekko test...skip"
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const $ = require('dekko');
|
import $ from 'dekko';
|
||||||
const chalk = require('chalk');
|
import chalk from 'chalk';
|
||||||
|
|
||||||
$('dist')
|
$('dist')
|
||||||
.isDirectory()
|
.isDirectory()
|
@ -1,3 +0,0 @@
|
|||||||
require('./dist.test');
|
|
||||||
require('./lib-es.test');
|
|
||||||
require('./use-client.test');
|
|
3
tests/dekko/index.test.ts
Normal file
3
tests/dekko/index.test.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import './dist.test';
|
||||||
|
import './lib-es.test';
|
||||||
|
import './use-client.test';
|
@ -1,24 +0,0 @@
|
|||||||
const $ = require('dekko');
|
|
||||||
const chalk = require('chalk');
|
|
||||||
|
|
||||||
$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');
|
|
||||||
|
|
||||||
$('lib/*')
|
|
||||||
.filter((filename) => !['index.js', 'index.d.ts', '.map'].some((ext) => filename.endsWith(ext)))
|
|
||||||
.isDirectory()
|
|
||||||
.filter((filename) => !['style', '_util', 'locale'].some((ext) => filename.endsWith(ext)))
|
|
||||||
.hasFile('index.js')
|
|
||||||
.hasFile('index.d.ts');
|
|
||||||
|
|
||||||
console.log(chalk.green('✨ `lib` directory is valid.'));
|
|
||||||
|
|
||||||
$('es').isDirectory().hasFile('index.js').hasFile('index.d.ts');
|
|
||||||
|
|
||||||
$('es/*')
|
|
||||||
.filter((filename) => !['index.js', 'index.d.ts', '.map'].some((ext) => filename.endsWith(ext)))
|
|
||||||
.isDirectory()
|
|
||||||
.filter((filename) => !['style', '_util', 'locale'].some((ext) => filename.endsWith(ext)))
|
|
||||||
.hasFile('index.js')
|
|
||||||
.hasFile('index.d.ts');
|
|
||||||
|
|
||||||
console.log(chalk.green('✨ `es` directory is valid.'));
|
|
28
tests/dekko/lib-es.test.ts
Normal file
28
tests/dekko/lib-es.test.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import $ from 'dekko';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
|
||||||
|
$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');
|
||||||
|
|
||||||
|
$('lib/*')
|
||||||
|
.filter(
|
||||||
|
(filename: string) => !['index.js', 'index.d.ts', '.map'].some((ext) => filename.endsWith(ext)),
|
||||||
|
)
|
||||||
|
.isDirectory()
|
||||||
|
.filter((filename: string) => !['style', '_util', 'locale'].some((ext) => filename.endsWith(ext)))
|
||||||
|
.hasFile('index.js')
|
||||||
|
.hasFile('index.d.ts');
|
||||||
|
|
||||||
|
console.log(chalk.green('✨ `lib` directory is valid.'));
|
||||||
|
|
||||||
|
$('es').isDirectory().hasFile('index.js').hasFile('index.d.ts');
|
||||||
|
|
||||||
|
$('es/*')
|
||||||
|
.filter(
|
||||||
|
(filename: string) => !['index.js', 'index.d.ts', '.map'].some((ext) => filename.endsWith(ext)),
|
||||||
|
)
|
||||||
|
.isDirectory()
|
||||||
|
.filter((filename: string) => !['style', '_util', 'locale'].some((ext) => filename.endsWith(ext)))
|
||||||
|
.hasFile('index.js')
|
||||||
|
.hasFile('index.d.ts');
|
||||||
|
|
||||||
|
console.log(chalk.green('✨ `es` directory is valid.'));
|
@ -1,28 +0,0 @@
|
|||||||
const $ = require('dekko');
|
|
||||||
const chalk = require('chalk');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const includeUseClient = (filename) =>
|
|
||||||
fs.readFileSync(filename).toString().includes('"use client"');
|
|
||||||
|
|
||||||
$('dist/*')
|
|
||||||
.isFile()
|
|
||||||
.assert("doesn't contain use client", (filename) => !includeUseClient(filename));
|
|
||||||
$('{es,lib}/index.js')
|
|
||||||
.isFile()
|
|
||||||
.assert('contain use client', (filename) => includeUseClient(filename));
|
|
||||||
$('{es,lib}/*/index.js')
|
|
||||||
.isFile()
|
|
||||||
.assert('contain use client', (filename) => includeUseClient(filename));
|
|
||||||
|
|
||||||
// check tsx files
|
|
||||||
$('{es,lib}/typography/*.js')
|
|
||||||
.isFile()
|
|
||||||
.assert('contain use client', (filename) => includeUseClient(filename));
|
|
||||||
|
|
||||||
$('{es,lib}/typography/Base/*.js')
|
|
||||||
.isFile()
|
|
||||||
.filter((filename) => !filename.endsWith('/util.js'))
|
|
||||||
.assert('contain use client', (filename) => includeUseClient(filename));
|
|
||||||
|
|
||||||
console.log(chalk.green('✨ use client passed!'));
|
|
28
tests/dekko/use-client.test.ts
Normal file
28
tests/dekko/use-client.test.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import $ from 'dekko';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
|
||||||
|
const includeUseClient = (filename: string) =>
|
||||||
|
fs.readFileSync(filename).toString().includes('"use client"');
|
||||||
|
|
||||||
|
$('dist/*')
|
||||||
|
.isFile()
|
||||||
|
.assert("doesn't contain use client", (filename: string) => !includeUseClient(filename));
|
||||||
|
$('{es,lib}/index.js')
|
||||||
|
.isFile()
|
||||||
|
.assert('contain use client', (filename: string) => includeUseClient(filename));
|
||||||
|
$('{es,lib}/*/index.js')
|
||||||
|
.isFile()
|
||||||
|
.assert('contain use client', (filename: string) => includeUseClient(filename));
|
||||||
|
|
||||||
|
// check tsx files
|
||||||
|
$('{es,lib}/typography/*.js')
|
||||||
|
.isFile()
|
||||||
|
.assert('contain use client', (filename: string) => includeUseClient(filename));
|
||||||
|
|
||||||
|
$('{es,lib}/typography/Base/*.js')
|
||||||
|
.isFile()
|
||||||
|
.filter((filename: string) => !filename.endsWith('/util.js'))
|
||||||
|
.assert('contain use client', (filename: string) => includeUseClient(filename));
|
||||||
|
|
||||||
|
console.log(chalk.green('✨ use client passed!'));
|
2
typings/custom-typings.d.ts
vendored
2
typings/custom-typings.d.ts
vendored
@ -27,3 +27,5 @@ declare module '@npmcli/run-script' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module '@microflash/rehype-figure';
|
declare module '@microflash/rehype-figure';
|
||||||
|
|
||||||
|
declare module 'dekko';
|
||||||
|
Loading…
Reference in New Issue
Block a user