@rtorcato/repo-tooling 3.8.3 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -95,7 +95,9 @@ export const FILE_CHECKS = [
|
|
|
95
95
|
candidates: ['tsconfig.json'],
|
|
96
96
|
expected: `extends "${PACKAGE}/typescript/*"`,
|
|
97
97
|
matcher: /@rtorcato\/(?:js|repo)-tooling\/typescript\//,
|
|
98
|
-
|
|
98
|
+
// `fix tsconfig`, not `copy tsconfig`: copy drops the whole preset inline,
|
|
99
|
+
// which carries no `extends` for the matcher above to find (#381).
|
|
100
|
+
hint: 'Run `npx @rtorcato/repo-tooling fix tsconfig` to scaffold',
|
|
99
101
|
},
|
|
100
102
|
{
|
|
101
103
|
check: 'Biome',
|
|
@@ -48,6 +48,7 @@ import { WORKSPACE_FILE, dependsOnEsbuild, ensurePnpmSettings, familyGlob, } fro
|
|
|
48
48
|
import { generatePostcss } from '../../cli/generators/postcss.js';
|
|
49
49
|
import { generateCypressConfig, generateVitestConfig } from '../../cli/generators/testing.js';
|
|
50
50
|
import { generateTreeshakeCheck, inferSubpathsFromExports } from '../../cli/generators/treeshake.js';
|
|
51
|
+
import { generateTSConfig } from '../../cli/generators/tsconfig.js';
|
|
51
52
|
import { generateTailwind } from '../../cli/generators/tailwind.js';
|
|
52
53
|
import { generateTurborepo } from '../../cli/generators/turborepo.js';
|
|
53
54
|
import { generateNx } from '../../cli/generators/nx.js';
|
|
@@ -70,7 +71,12 @@ export function inferProjectConfig(pkg) {
|
|
|
70
71
|
return {
|
|
71
72
|
projectName: pkg?.name ?? 'project',
|
|
72
73
|
projectType,
|
|
73
|
-
typescript: {
|
|
74
|
+
typescript: {
|
|
75
|
+
enabled: true,
|
|
76
|
+
// Same mapping the react-app/nextjs-app setup presets use — a react-app on
|
|
77
|
+
// the base preset has no DOM libs, so `document`/`window` don't typecheck.
|
|
78
|
+
config: projectType === 'nextjs-app' ? 'next' : projectType === 'react-app' ? 'react' : 'base',
|
|
79
|
+
},
|
|
74
80
|
linting: {
|
|
75
81
|
tool: 'biome',
|
|
76
82
|
eslintConfig: projectType === 'nextjs-app' ? 'nextjs' : 'base',
|
|
@@ -170,9 +176,18 @@ export const FIXERS = [
|
|
|
170
176
|
appliesTo: ['TypeScript'],
|
|
171
177
|
outputs: ['tsconfig.json', 'package.json (scripts)'],
|
|
172
178
|
canFixDrift: true,
|
|
173
|
-
async run({ targetDir }) {
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
async run({ targetDir, pkg }) {
|
|
180
|
+
// Shares generateTSConfig with the setup path — copyPreset used to inline
|
|
181
|
+
// the whole base preset, which carries no `extends` for doctor's matcher
|
|
182
|
+
// and threw away the project-type settings setup emits (#381).
|
|
183
|
+
const config = inferProjectConfig(pkg);
|
|
184
|
+
// Bun leaves no package.json trace, so inferProjectConfig can't see it; a
|
|
185
|
+
// bunfig.toml is the signal, and without it this would strip `types: ['bun']`
|
|
186
|
+
// off a Bun repo by dropping it back onto the base preset.
|
|
187
|
+
if (await fs.pathExists(path.join(targetDir, 'bunfig.toml')))
|
|
188
|
+
config.bun = true;
|
|
189
|
+
await generateTSConfig(config, targetDir);
|
|
190
|
+
const filesWritten = ['tsconfig.json'];
|
|
176
191
|
// Without `typecheck` the generated CI drops its typecheck job entirely
|
|
177
192
|
// (#377). Shared with non-JS paths, so this is a no-op when there's no
|
|
178
193
|
// package.json to add it to.
|
package/package.json
CHANGED