ant-design/tests/dekko/use-client.test.js
二货爱吃白萝卜 72ee4517f0
refactor: Use native css for measure css line ellipsis (#47597)
* chore: init

* chore: ellpsis check with native css

* docs: all the lines

* chore: move copied btn out

* chore: add dpes

* fix: logic order

* fix: ellipsis event

* test: update testcase

* chore: use native way

* chore: destructure

* chore: fix lint

* chore: fix lint

* chore: fix lint
2024-02-27 16:56:24 +08:00

34 lines
1014 B
JavaScript

const $ = require('dekko');
const chalk = require('chalk');
const fs = require('fs');
const includeUseClient = (filename) =>
fs.readFileSync(filename).toString().includes('"use client"');
if (process.env.LIB_DIR === 'dist') {
$('dist/*')
.isFile()
.assert("doesn't contain use client", (filename) => !includeUseClient(filename));
} else {
$('{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));
}
// eslint-disable-next-line no-console
console.log(chalk.green('✨ use client passed!'));