|
1 | 1 | import { camelCase, pascalCase, pathCase } from "change-case"; |
2 | 2 | import consola from "consola"; |
3 | | -import { ensureDir, readJson } from "fs-extra/esm"; |
| 3 | +import { ensureDir, pathExists, readJson } from "fs-extra/esm"; |
4 | 4 | import Handlebars from "handlebars"; |
5 | 5 | import { readFile, writeFile } from "node:fs/promises"; |
6 | 6 | import { dirname, join, relative } from "node:path"; |
7 | | -import { cwd, stdout } from "node:process"; |
| 7 | +import { cwd } from "node:process"; |
8 | 8 | import { fileURLToPath } from "node:url"; |
9 | 9 | import { resolveConfig, type Config } from "./config.js"; |
10 | 10 | import { FileReference } from "./file-reference.js"; |
@@ -117,10 +117,17 @@ export function defineGenerator({ |
117 | 117 | signature: entityNameCases.pascal + "Signature", |
118 | 118 | }, |
119 | 119 | package: packageJson, |
| 120 | + testHelpersImportPath: |
| 121 | + (await pathExists(join(packagePath, "tests", "helpers.js"))) || |
| 122 | + (await pathExists(join(packagePath, "tests", "helpers.ts"))) |
| 123 | + ? `${packageJson.name}/tests/helpers` |
| 124 | + : "ember-qunit", |
120 | 125 | }); |
121 | 126 |
|
122 | 127 | if (resolvedArgs.log) { |
123 | | - const border = "─".repeat(stdout.columns ? stdout.columns / 2 : 120); |
| 128 | + const border = "─".repeat( |
| 129 | + Math.max(...templateCompiled.split("\n").map((line) => line.length)), |
| 130 | + ); |
124 | 131 |
|
125 | 132 | consola.log(border); |
126 | 133 | consola.log(""); |
|
0 commit comments