mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-20 12:28:10 +08:00
f0c105d262
* feat: remove the hardcode of `use client` * chore: update `@ant-design/tools` * test: update * fix: incorrect dictionary * chore: update dep * ci: check use client * chore: update ci * fix: should be LIB_DIR * ci: should only run in dist * chore: update check tsx files
33 lines
956 B
JavaScript
33 lines
956 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()
|
|
.assert('contain use client', (filename) => includeUseClient(filename));
|
|
}
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.log(chalk.green('✨ use client passed!'));
|