Skip to content

Commit

Permalink
fix chalk import
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Jan 6, 2025
1 parent 5dfded8 commit 870ecdb
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 40 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"start": "tsx ./scripts/set-node-options.ts cross-env PORT=8001 dumi dev",
"pretest": "npm run version",
"test": "jest --config .jest.js --no-cache --collect-coverage",
"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
File renamed without changes.
4 changes: 0 additions & 4 deletions tests/dekko/index.test.js

This file was deleted.

4 changes: 4 additions & 0 deletions tests/dekko/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './dist.test';
import './lib.test';
// Not applied yet
// import './use-client.test';
4 changes: 2 additions & 2 deletions tests/dekko/lib.test.js → tests/dekko/lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ $('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');

$('lib/*')
.filter(
(filename) =>
(filename: string) =>
!filename.endsWith('index.js') &&
!filename.endsWith('index.d.ts') &&
!filename.endsWith('.map'),
)
.isDirectory()
.filter(
(filename) =>
(filename: string) =>
!filename.endsWith('style') &&
!filename.endsWith('_util') &&
!filename.endsWith('locale') &&
Expand Down
33 changes: 0 additions & 33 deletions tests/dekko/use-client.test.js

This file was deleted.

33 changes: 33 additions & 0 deletions tests/dekko/use-client.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fs from 'node:fs';
import chalk from 'chalk';
import $ from 'dekko';

const includeUseClient = (filename: string) =>
fs.readFileSync(filename).toString().includes('"use client"');

if (process.env.LIB_DIR === 'dist') {
$('dist/*')
.isFile()
.assert("doesn't contain use client", (filename: string) => !includeUseClient(filename));
} else {
$('{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));
}

// eslint-disable-next-line no-console
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 870ecdb

Please sign in to comment.