mirror of
https://github.com/hanzoai/zod.git
synced 2026-09-24 17:04:49 +00:00
* Initial move * Move files * WIP * WIP * WIP * WIP * Add rolldown.cjs.js * WIP * WIP * Clean package.json * WIP * WIP * WIP * WIP * WIP * Add tsdown * WIP * WIP * WIP * WIP * Rename zbuild * Rename zbuild * WIP * WIP * WIP * WIP * WIP * WIP * Improve zshy * WIP * WIP * WIP * Tweak * Remove old build files * Add resolution tests * Fix all noUncheckedIndexedAccess issues * WIP * Clean up * Fix lint * Add ATTW test * Update snaps * Update snaps * Update snaps
99 lines
2.3 KiB
TypeScript
99 lines
2.3 KiB
TypeScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { execa } from "execa";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
async function buildZshy() {
|
|
console.log("๐จ Building project with zshy...");
|
|
try {
|
|
await execa("zshy", [], {
|
|
cwd: __dirname,
|
|
stdio: "inherit",
|
|
});
|
|
// console.log('โ
Build completed successfully!');
|
|
} catch (error) {
|
|
console.error("โ Error building project:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function buildTsc() {
|
|
console.log("๐จ Building project with tsc...");
|
|
try {
|
|
await execa("tsc", ["--project", "tsconfig.build.json"], {
|
|
cwd: __dirname,
|
|
stdio: "inherit",
|
|
});
|
|
// console.log('โ
Build completed successfully!');
|
|
} catch (error) {
|
|
console.error("โ Error building project:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function testCjs() {
|
|
console.log("๐งช Testing CommonJS build...");
|
|
try {
|
|
await execa("node", ["./dist/index.cjs"], {
|
|
cwd: __dirname,
|
|
stdio: "inherit",
|
|
});
|
|
console.log("โ
CommonJS test passed!");
|
|
} catch (error) {
|
|
console.error("โ CommonJS test failed:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function testMjs() {
|
|
console.log("๐งช Testing CommonJS build...");
|
|
try {
|
|
await execa("node", ["./dist/index.mjs"], {
|
|
cwd: __dirname,
|
|
stdio: "inherit",
|
|
});
|
|
console.log("โ
CommonJS test passed!");
|
|
} catch (error) {
|
|
console.error("โ CommonJS test failed:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function testJs() {
|
|
console.log("๐งช Testing ES Module build...");
|
|
try {
|
|
await execa("node", ["./dist/index.js"], {
|
|
cwd: __dirname,
|
|
stdio: "inherit",
|
|
});
|
|
console.log("โ
ES Module test passed!");
|
|
} catch (error) {
|
|
console.error("โ ES Module test failed:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
async function runAllTests() {
|
|
console.log("๐ Starting comprehensive resolution tests...\n");
|
|
|
|
try {
|
|
await buildZshy();
|
|
await testCjs();
|
|
await testJs();
|
|
|
|
await buildTsc();
|
|
await testMjs();
|
|
await testCjs();
|
|
|
|
console.log("๐ All tests passed successfully!");
|
|
} catch (error) {
|
|
console.error("๐ฅ Test suite failed:", error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the test suite
|
|
runAllTests();
|