ant-design/tests/dekko/use-client.test.js
renovate[bot] 863f61d908
chore(deps): update dependency eslint to v9 (#50690)
Co-authored-by: afc163 <afc163@gmail.com>
2024-09-19 03:30:19 +08:00

29 lines
891 B
JavaScript

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!'));