(config: ResolvedConfig, options: DeployCommandOptions)
| 1630 | } |
| 1631 | |
| 1632 | async function typecheckProject(config: ResolvedConfig, options: DeployCommandOptions) { |
| 1633 | return await tracer.startActiveSpan("typecheckProject", async (span) => { |
| 1634 | try { |
| 1635 | const typecheckSpinner = spinner(); |
| 1636 | typecheckSpinner.start("Typechecking project"); |
| 1637 | |
| 1638 | const tscTypecheck = execa("npm", ["exec", "tsc", "--", "--noEmit"], { |
| 1639 | cwd: config.projectDir, |
| 1640 | }); |
| 1641 | |
| 1642 | const stdouts: string[] = []; |
| 1643 | const stderrs: string[] = []; |
| 1644 | |
| 1645 | tscTypecheck.stdout?.on("data", (chunk) => stdouts.push(chunk.toString())); |
| 1646 | tscTypecheck.stderr?.on("data", (chunk) => stderrs.push(chunk.toString())); |
| 1647 | |
| 1648 | try { |
| 1649 | await new Promise((resolve, reject) => { |
| 1650 | tscTypecheck.addListener("exit", (code) => (code === 0 ? resolve(code) : reject(code))); |
| 1651 | }); |
| 1652 | } catch (error) { |
| 1653 | typecheckSpinner.stop( |
| 1654 | `Typechecking failed, check the logs below to view the issues. To skip typechecking, pass the --skip-typecheck flag` |
| 1655 | ); |
| 1656 | |
| 1657 | logger.log(""); |
| 1658 | |
| 1659 | for (const stdout of stdouts) { |
| 1660 | logger.log(stdout); |
| 1661 | } |
| 1662 | |
| 1663 | span.recordException(new Error(stdouts.join("\n"))); |
| 1664 | span.end(); |
| 1665 | |
| 1666 | return false; |
| 1667 | } |
| 1668 | |
| 1669 | typecheckSpinner.stop(`Typechecking passed with 0 errors`); |
| 1670 | |
| 1671 | span.end(); |
| 1672 | return true; |
| 1673 | } catch (e) { |
| 1674 | recordSpanException(span, e); |
| 1675 | |
| 1676 | span.end(); |
| 1677 | |
| 1678 | return false; |
| 1679 | } |
| 1680 | }); |
| 1681 | } |
| 1682 | |
| 1683 | // Returns the dependencies that are required by the output that are found in output and the CLI package dependencies |
| 1684 | // Returns the dependency names and the version to use (taken from the CLI deps package.json) |
no test coverage detected
searching dependent graphs…