@@ -13,6 +13,8 @@ import { installGithubActions } from "./install-ga";
1313import { installLintStaged } from "./install-lint-staged" ;
1414import { installPrettier } from "./install-prettier" ;
1515
16+ const REPO_URL = "https://github.com/Solvro/lib-web-solvro-config" ;
17+
1618// Types
1719interface CliOptions {
1820 force ?: boolean ;
@@ -54,9 +56,9 @@ async function main() {
5456 const warningMessage = `
5557${ c . red ( c . bold ( `⚠️ OSTRZEŻENIE: ${ packageManager } nie jest obsługiwany ⚠️` ) ) }
5658
57- Próbujesz uruchomić ten skrypt z ${ c . yellow ( packageManager ) } 'em, ale @solvro/config działa tylko z ${ c . yellow ( "npm'em " ) } .
59+ Próbujesz uruchomić ten skrypt z ${ c . yellow ( packageManager ) } 'em, ale @solvro/config obecnie działa tylko z ${ c . yellow ( "npm" ) } 'em.
5860
59- Support dla innych menedżerów pakietów nie jest planowany - chcemy jednolitego stacku technologicznego dla projektów w naszym kochanym kole Solvro .
61+ Support dla innych menedżerów pakietów jest planowany w nadchodzących wersjach - zagwiazdkuj i spróbuj ponownie wkrótce! .
6062
6163Użyj zamiast tego npm'a:
6264${ c . cyan ( "npx @solvro/config" ) } `;
@@ -249,18 +251,33 @@ ${c.cyan("npx @solvro/config")}`;
249251
250252 await packageJson . clearInstall ( ) ;
251253
252- if ( isNonInteractive ) {
253- console . log ( "✅ Konfiguracja zakończona pomyślnie!" ) ;
254- } else {
255- p . outro ( "✅ Konfiguracja zakończona pomyślnie!" ) ;
256- }
254+ const printSuccess = isNonInteractive ? console . info : p . outro ;
255+ printSuccess ( "✅ Konfiguracja zakończona pomyślnie!" ) ;
257256}
258257
259- // Run the main function
260- try {
261- // eslint-disable-next-line unicorn/prefer-top-level-await
262- void main ( ) ;
263- } catch ( error : unknown ) {
264- console . error ( "Wystąpił błąd:" , error ) ;
265- process . exit ( 1 ) ;
258+ async function mainWrapper ( ) {
259+ try {
260+ await main ( ) ;
261+ } catch ( error : unknown ) {
262+ if ( process . env . NODE_ENV === "development" ) {
263+ console . error (
264+ c . red ( "Unhandled error in main:" ) ,
265+ error instanceof Error ? error . message : error ,
266+ ) ;
267+ } else {
268+ const errorMessage =
269+ "Wystąpił nieoczekiwany błąd :( Proszę zgłosić go twórcom:" ;
270+ const errorLink = `${ REPO_URL } /issues/new` ;
271+ if ( isNonInteractive ) {
272+ console . error ( errorMessage ) ;
273+ console . error ( errorLink ) ;
274+ } else {
275+ p . cancel ( `${ errorMessage } ${ errorLink } ` ) ;
276+ }
277+ }
278+ process . exit ( 1 ) ;
279+ }
266280}
281+
282+ // eslint-disable-next-line unicorn/prefer-top-level-await
283+ void mainWrapper ( ) ;
0 commit comments