|
1 | 1 | import * as p from "@clack/prompts"; |
2 | 2 | import { Command } from "commander"; |
| 3 | +import { getUserAgent } from "package-manager-detector/detect"; |
3 | 4 | import c from "picocolors"; |
4 | 5 |
|
5 | 6 | import packageJsonData from "../../package.json"; |
@@ -46,11 +47,33 @@ async function main() { |
46 | 47 | p.intro(c.bold(c.bgBlue(" @solvro/config "))); |
47 | 48 | } |
48 | 49 |
|
| 50 | + const userAgent = getUserAgent(); |
| 51 | + |
| 52 | + if (userAgent !== "npm") { |
| 53 | + const packageManager = userAgent ?? "unknown"; |
| 54 | + const warningMessage = ` |
| 55 | +${c.red(c.bold(`⚠️ OSTRZEŻENIE: ${packageManager} nie jest obsługiwany ⚠️`))} |
| 56 | +
|
| 57 | +Próbujesz uruchomić ten skrypt z ${c.yellow(packageManager)}'em, ale @solvro/config działa tylko z ${c.yellow("npm'em")}. |
| 58 | +
|
| 59 | +Support dla innych menedżerów pakietów nie jest planowany - chcemy jednolitego stacku technologicznego dla projektów w naszym kochanym kole Solvro. |
| 60 | +
|
| 61 | +Użyj zamiast tego npm'a: |
| 62 | +${c.cyan("npx @solvro/config")}`; |
| 63 | + |
| 64 | + if (isNonInteractive) { |
| 65 | + console.error(warningMessage); |
| 66 | + } else { |
| 67 | + p.cancel(warningMessage); |
| 68 | + } |
| 69 | + process.exit(1); |
| 70 | + } |
| 71 | + |
49 | 72 | // Git clean check |
50 | 73 | if (options.force !== true && !isGitClean()) { |
51 | 74 | if (isNonInteractive) { |
52 | 75 | console.error( |
53 | | - "Git repository has uncommitted changes. Use --force to bypass this check.", |
| 76 | + "Repozytorium Git ma niezatwierdzone zmiany. Użyj --force, aby pominąć to sprawdzenie.", |
54 | 77 | ); |
55 | 78 | process.exit(1); |
56 | 79 | } |
@@ -158,7 +181,7 @@ async function main() { |
158 | 181 |
|
159 | 182 | if (toolsToInstall.length === 0) { |
160 | 183 | console.error( |
161 | | - "No tools specified. Use --eslint, --prettier, --gh-action, --commitlint, or --all", |
| 184 | + "Nie wybrano żadnych narzędzi. Użyj --eslint, --prettier, --gh-action, --commitlint, lub --all", |
162 | 185 | ); |
163 | 186 | process.exit(1); |
164 | 187 | } |
@@ -227,16 +250,16 @@ async function main() { |
227 | 250 | await packageJson.clearInstall(); |
228 | 251 |
|
229 | 252 | if (isNonInteractive) { |
230 | | - console.log("✅ Configuration completed successfully!"); |
| 253 | + console.log("✅ Konfiguracja zakończona pomyślnie!"); |
231 | 254 | } else { |
232 | | - p.outro("✅ Configuration completed successfully!"); |
| 255 | + p.outro("✅ Konfiguracja zakończona pomyślnie!"); |
233 | 256 | } |
234 | 257 | } |
235 | 258 |
|
236 | 259 | // Run the main function |
237 | 260 | try { |
238 | 261 | await main(); |
239 | 262 | } catch (error: unknown) { |
240 | | - console.error("An error occurred:", error); |
| 263 | + console.error("Wystąpił błąd:", error); |
241 | 264 | process.exit(1); |
242 | 265 | } |
0 commit comments