( callerTask: ForgeListrTask<SystemCheckContext>, )
| 156 | }; |
| 157 | |
| 158 | export async function checkSystem( |
| 159 | callerTask: ForgeListrTask<SystemCheckContext>, |
| 160 | ) { |
| 161 | if (!(await fs.pathExists(SKIP_SYSTEM_CHECK))) { |
| 162 | d('checking system, create ~/.skip-forge-system-check to stop doing this'); |
| 163 | return callerTask.newListr<SystemCheckContext>( |
| 164 | [ |
| 165 | { |
| 166 | title: 'Checking git exists', |
| 167 | // We only call the `initGit` helper in the `init` and `import` commands |
| 168 | enabled: (ctx): boolean => |
| 169 | (ctx.command === 'init' || ctx.command === 'import') && ctx.git, |
| 170 | task: async (_, task) => { |
| 171 | const gitVersion = await getGitVersion(); |
| 172 | if (gitVersion) { |
| 173 | task.title = `Found git@${gitVersion}`; |
| 174 | } else { |
| 175 | throw new Error('Could not find git in environment'); |
| 176 | } |
| 177 | }, |
| 178 | }, |
| 179 | { |
| 180 | title: 'Checking package manager version', |
| 181 | task: async (_, task) => { |
| 182 | const packageManager = await checkPackageManager(); |
| 183 | task.title = `Found ${packageManager}`; |
| 184 | }, |
| 185 | }, |
| 186 | ], |
| 187 | { |
| 188 | concurrent: true, |
| 189 | exitOnError: true, |
| 190 | rendererOptions: { |
| 191 | collapseSubtasks: true, |
| 192 | }, |
| 193 | }, |
| 194 | ); |
| 195 | } |
| 196 | d('skipping system check'); |
| 197 | return true; |
| 198 | } |
no test coverage detected