Skip to content

Commit

Permalink
chore(deps): update dependency chalk to v5 (#52109)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency chalk to v5

* migrate chalk

* Update .github/workflows/test.yml

Signed-off-by: afc163 <[email protected]>

---------

Signed-off-by: afc163 <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: afc163 <[email protected]>
  • Loading branch information
renovate[bot] and afc163 authored Dec 24, 2024
1 parent 4985db9 commit ff52bbc
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .dumi/theme/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createHash } from 'crypto';
import fs from 'fs';
import path from 'path';
import createEmotionServer from '@emotion/server/create-instance';
import chalk from 'chalk';
import type { IApi, IRoute } from 'dumi';
import ReactTechStack from 'dumi/dist/techStacks/react';
import sylvanas from 'sylvanas';
Expand Down Expand Up @@ -126,7 +125,8 @@ class AntdReactTechStack extends ReactTechStack {

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 writeCSSFile = (key: string, hashKey: string, cssString: string) => {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jobs:
CI: 1

- name: check build files
run: node ./tests/dekko/index.test.js
run: bun run test:dekko

# Artifact build files
- uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"pretest": "npm run version",
"test": "jest --config .jest.js --no-cache",
"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:node": "npm run version && jest --config .jest.node.js --no-cache",
"test:package-diff": "antd-tools run package-diff",
Expand Down Expand Up @@ -222,7 +222,7 @@
"antd-style": "^3.7.0",
"antd-token-previewer": "^2.0.8",
"axios": "^1.7.7",
"chalk": "^4.1.2",
"chalk": "^5.0.0",
"cheerio": "^1.0.0",
"circular-dependency-plugin": "^5.2.2",
"cli-progress": "^3.12.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ fi
if ! has_arg '--skip-dekko' "$@"; then
echo "[TEST ALL] dekko dist"
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" > ~test-all.txt
node ./tests/dekko/lib-es.test.js
tsx ./tests/dekko/lib-es.test.ts
else
echo "[TEST ALL] dekko test...skip"
fi
Expand Down
4 changes: 2 additions & 2 deletions tests/dekko/dist.test.js → tests/dekko/dist.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const $ = require('dekko');
const chalk = require('chalk');
import $ from 'dekko';
import chalk from 'chalk';

$('dist')
.isDirectory()
Expand Down
3 changes: 0 additions & 3 deletions tests/dekko/index.test.js

This file was deleted.

3 changes: 3 additions & 0 deletions tests/dekko/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './dist.test';
import './lib-es.test';
import './use-client.test';
24 changes: 0 additions & 24 deletions tests/dekko/lib-es.test.js

This file was deleted.

28 changes: 28 additions & 0 deletions tests/dekko/lib-es.test.ts
Original file line number Diff line number Diff line change
@@ -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.'));
28 changes: 0 additions & 28 deletions tests/dekko/use-client.test.js

This file was deleted.

28 changes: 28 additions & 0 deletions tests/dekko/use-client.test.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions typings/custom-typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ declare module '@npmcli/run-script' {
}

declare module '@microflash/rehype-figure';

declare module 'dekko';

0 comments on commit ff52bbc

Please sign in to comment.