forked from nextui-org/tailwind-variants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-types.cjs
36 lines (30 loc) · 869 Bytes
/
copy-types.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const fs = require("fs");
const path = require("path");
const srcPath = path.join(__dirname, "src");
const typesPath = path.join(__dirname, "dist");
// Check if the "types" folder exists, if not, create it
if (!fs.existsSync(typesPath)) {
fs.mkdirSync(typesPath);
}
// Read the files in the "src" folder
fs.readdir(srcPath, (err, files) => {
if (err) {
console.error(err);
return;
}
// Iterate through the files in the "src" folder
files.forEach((file) => {
// Check if the file is a .d.ts file
if (file.endsWith(".d.ts")) {
// Construct the source and destination file paths
const srcFile = path.join(srcPath, file);
const destFile = path.join(typesPath, file);
// Copy the file
fs.copyFile(srcFile, destFile, (err) => {
if (err) {
console.error(err);
}
});
}
});
});