Files
Colin McDonnellandGitHub 55b6ed1b1b Switch to zshy (#4777)
* 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
2025-07-02 00:43:43 -07:00

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();