-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrename-types.js
More file actions
35 lines (35 loc) · 1.19 KB
/
rename-types.js
File metadata and controls
35 lines (35 loc) · 1.19 KB
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// rename-types.ts
var fs = require("fs");
var path = require("path");
var bundles = {
es: "dist/bundle-es",
cjs: "dist/bundle-cjs",
browser: "dist/payment-module",
};
// Define the path to the original and new file
var folders = [
path.resolve(__dirname, bundles.browser),
path.resolve(__dirname, bundles.cjs),
path.resolve(__dirname, bundles.es),
];
// Function to rename `index.d.ts` to `multi-entry.d.ts` in each folder
folders.forEach(function (typesDir) {
var oldFile = path.join(typesDir, "index.d.ts");
var newFile = path.join(typesDir, "multi-entry.d.ts");
// Check if `index.d.ts` exists in the folder, then rename it
if (fs.existsSync(oldFile)) {
fs.rename(oldFile, newFile, function (err) {
if (err) {
console.error("Error renaming index.d.ts in ".concat(typesDir, ":"), err);
}
else {
console.log("index.d.ts has been renamed to multi-entry.d.ts in ".concat(typesDir));
}
});
}
else {
console.log("index.d.ts not found in ".concat(typesDir, ", skipping rename."));
}
});