|
1 | 1 | import { outro, spinner } from '@clack/prompts';
|
2 | 2 | import { Toolbox } from 'gluegun/build/types/domain/toolbox';
|
| 3 | +import os from 'os'; |
3 | 4 | import { AvailablePackages, CliResults } from '../types';
|
4 | 5 | import { copyBaseAssets } from './copyBaseAssets';
|
| 6 | +import { generateNWUI } from './generateNWUI'; |
5 | 7 | import { getPackageManager, getPackageManagerRunnerX } from './getPackageManager';
|
6 | 8 | import { easConfigure } from './runEasConfigure';
|
7 | 9 | import { ONLY_ERRORS, runSystemCommand } from './systemCommand';
|
8 |
| -import { generateNWUI } from './generateNWUI'; |
9 |
| -import os from 'os'; |
| 10 | +import { appendFile, writeFile } from 'fs/promises'; |
| 11 | + |
| 12 | +const yarnRcFixes = ` |
| 13 | +enableGlobalCache: false |
| 14 | +
|
| 15 | +nodeLinker: node-modules`; |
10 | 16 |
|
11 | 17 | export async function printOutput(
|
12 | 18 | cliResults: CliResults,
|
@@ -47,6 +53,21 @@ export async function printOutput(
|
47 | 53 |
|
48 | 54 | const additionalFlags = isNpm ? '--silent --no-audit --progress=false --legacy-peer-deps' : '--silent';
|
49 | 55 |
|
| 56 | + if (packageManager === 'yarn') { |
| 57 | + // create empty yarn.lock to stop yarn from complaining |
| 58 | + await writeFile(`${projectName}/yarn.lock`, ''); |
| 59 | + |
| 60 | + // apply fixes to .yarnrc.yml to stop issues with PnP and caching |
| 61 | + await appendFile(`${projectName}/.yarnrc.yml`, yarnRcFixes); |
| 62 | + |
| 63 | + await runSystemCommand({ |
| 64 | + toolbox, |
| 65 | + command: `cd ${projectName} && yarn set version stable`, |
| 66 | + stdio: ONLY_ERRORS, |
| 67 | + errorMessage: 'Error setting yarn version' |
| 68 | + }); |
| 69 | + } |
| 70 | + |
50 | 71 | await runSystemCommand({
|
51 | 72 | toolbox,
|
52 | 73 | command: `cd ${projectName} && ${packageManager} install ${additionalFlags}`,
|
|
0 commit comments