Skip to content

Commit 06ddc22

Browse files
chore(deps-dev): bump chalk from 4.1.2 to 5.4.1 (#423)
* chore(deps-dev): bump chalk from 4.1.2 to 5.4.1 Bumps [chalk](https://github.com/chalk/chalk) from 4.1.2 to 5.4.1. - [Release notes](https://github.com/chalk/chalk/releases) - [Commits](chalk/chalk@v4.1.2...v5.4.1) --- updated-dependencies: - dependency-name: chalk dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * fix chalk import * fix chalk import --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: afc163 <[email protected]>
1 parent 2189b5f commit 06ddc22

10 files changed

+49
-48
lines changed

.dumi/theme/plugin.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { createHash } from 'crypto';
22
import fs from 'fs';
33
import path from 'path';
44
import createEmotionServer from '@emotion/server/create-instance';
5-
import chalk from 'chalk';
65
import type { IApi, IRoute } from 'dumi';
76
import ReactTechStack from 'dumi/dist/techStacks/react';
87
import sylvanas from 'sylvanas';
@@ -126,9 +125,9 @@ class AntdReactTechStack extends ReactTechStack {
126125

127126
const resolve = (p: string): string => require.resolve(p);
128127

129-
const RoutesPlugin = (api: IApi) => {
128+
const RoutesPlugin = async (api: IApi) => {
130129
// const ssrCssFileName = `ssr-${Date.now()}.css`;
131-
130+
const chalk = await import('chalk').then((m) => m.default);
132131
const writeCSSFile = (key: string, hashKey: string, cssString: string) => {
133132
const fileName = `style-${key}.${getHash(hashKey)}.css`;
134133

bun.lockb

432 Bytes
Binary file not shown.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
7171
"pretest": "npm run version",
7272
"test": "jest --config .jest.js --no-cache --collect-coverage",
73-
"test:dekko": "node ./tests/dekko/index.test.js",
73+
"test:dekko": "tsx ./tests/dekko/index.test.ts",
7474
"test:image": "jest --config .jest.image.js --no-cache -i -u --forceExit",
7575
"test:node": "npm run version && jest --config .jest.node.js --no-cache",
7676
"test:package-diff": "antd-tools run package-diff",
@@ -164,7 +164,7 @@
164164
"axios": "^1.7.7",
165165
"browserslist": "^4.23.3",
166166
"browserslist-to-esbuild": "^2.1.1",
167-
"chalk": "^4.1.2",
167+
"chalk": "^5.4.1",
168168
"cheerio": "^1.0.0",
169169
"circular-dependency-plugin": "^5.2.2",
170170
"cli-progress": "^3.12.0",

tests/dekko/dist.test.js tests/dekko/dist.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const $ = require('dekko');
2-
const chalk = require('chalk');
1+
import chalk from 'chalk';
2+
import $ from 'dekko';
33

44
$('dist').isDirectory().hasFile('antdx.js').hasFile('antdx.min.js').hasFile('antdx.min.js.map');
55

tests/dekko/index.test.js

-4
This file was deleted.

tests/dekko/index.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './dist.test';
2+
import './lib.test';
3+
// Not applied yet
4+
// import './use-client.test';

tests/dekko/lib.test.js tests/dekko/lib.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
const $ = require('dekko');
2-
const chalk = require('chalk');
1+
import chalk from 'chalk';
2+
import $ from 'dekko';
33

44
$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');
55

66
$('lib/*')
77
.filter(
8-
(filename) =>
8+
(filename: string) =>
99
!filename.endsWith('index.js') &&
1010
!filename.endsWith('index.d.ts') &&
1111
!filename.endsWith('.map'),
1212
)
1313
.isDirectory()
1414
.filter(
15-
(filename) =>
15+
(filename: string) =>
1616
!filename.endsWith('style') &&
1717
!filename.endsWith('_util') &&
1818
!filename.endsWith('locale') &&

tests/dekko/use-client.test.js

-33
This file was deleted.

tests/dekko/use-client.test.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import fs from 'node:fs';
2+
import chalk from 'chalk';
3+
import $ from 'dekko';
4+
5+
const includeUseClient = (filename: string) =>
6+
fs.readFileSync(filename).toString().includes('"use client"');
7+
8+
if (process.env.LIB_DIR === 'dist') {
9+
$('dist/*')
10+
.isFile()
11+
.assert("doesn't contain use client", (filename: string) => !includeUseClient(filename));
12+
} else {
13+
$('{es,lib}/index.js')
14+
.isFile()
15+
.assert('contain use client', (filename: string) => includeUseClient(filename));
16+
17+
$('{es,lib}/*/index.js')
18+
.isFile()
19+
.assert('contain use client', (filename: string) => includeUseClient(filename));
20+
21+
// check tsx files
22+
$('{es,lib}/typography/*.js')
23+
.isFile()
24+
.assert('contain use client', (filename: string) => includeUseClient(filename));
25+
26+
$('{es,lib}/typography/Base/*.js')
27+
.isFile()
28+
.filter((filename: string) => !filename.endsWith('/util.js'))
29+
.assert('contain use client', (filename: string) => includeUseClient(filename));
30+
}
31+
32+
// eslint-disable-next-line no-console
33+
console.log(chalk.green('✨ use client passed!'));

typings/custom-typings.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ declare module '@npmcli/run-script' {
2727
}
2828

2929
declare module '@microflash/rehype-figure';
30+
31+
declare module 'dekko';

0 commit comments

Comments
 (0)