@sentry/wizard 3.34.0 → 3.34.2
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.
- package/CHANGELOG.md +9 -0
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +33 -26
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +1 -1
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +5 -1
- package/dist/src/utils/clack-utils.js +34 -22
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +8 -6
- package/src/sveltekit/templates.ts +21 -30
- package/src/utils/clack-utils.ts +36 -21
package/src/utils/clack-utils.ts
CHANGED
|
@@ -233,7 +233,7 @@ The wizard will create and update files.`,
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
function isInGitRepo() {
|
|
236
|
+
export function isInGitRepo() {
|
|
237
237
|
try {
|
|
238
238
|
childProcess.execSync('git rev-parse --is-inside-work-tree', {
|
|
239
239
|
stdio: 'ignore',
|
|
@@ -244,7 +244,7 @@ function isInGitRepo() {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
function getUncommittedOrUntrackedFiles(): string[] {
|
|
247
|
+
export function getUncommittedOrUntrackedFiles(): string[] {
|
|
248
248
|
try {
|
|
249
249
|
const gitStatus = childProcess
|
|
250
250
|
.execSync('git status --porcelain=v1')
|
|
@@ -358,7 +358,7 @@ export async function installPackage({
|
|
|
358
358
|
packageName: string;
|
|
359
359
|
alreadyInstalled: boolean;
|
|
360
360
|
askBeforeUpdating?: boolean;
|
|
361
|
-
}): Promise<
|
|
361
|
+
}): Promise<{ packageManager?: PackageManager }> {
|
|
362
362
|
return traceStep('install-package', async () => {
|
|
363
363
|
if (alreadyInstalled && askBeforeUpdating) {
|
|
364
364
|
const shouldUpdatePackage = await abortIfCancelled(
|
|
@@ -370,7 +370,7 @@ export async function installPackage({
|
|
|
370
370
|
);
|
|
371
371
|
|
|
372
372
|
if (!shouldUpdatePackage) {
|
|
373
|
-
return;
|
|
373
|
+
return {};
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -428,6 +428,8 @@ export async function installPackage({
|
|
|
428
428
|
packageName,
|
|
429
429
|
)} with ${chalk.bold(packageManager.label)}.`,
|
|
430
430
|
);
|
|
431
|
+
|
|
432
|
+
return { packageManager };
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
435
|
|
|
@@ -672,22 +674,9 @@ async function addCliConfigFileToGitIgnore(filename: string): Promise<void> {
|
|
|
672
674
|
|
|
673
675
|
export async function runPrettierIfInstalled(): Promise<void> {
|
|
674
676
|
return traceStep('run-prettier', async () => {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (prettierInstalled) {
|
|
679
|
-
// prompt the user if they want to run prettier
|
|
680
|
-
const shouldRunPrettier = await abortIfCancelled(
|
|
681
|
-
clack.confirm({
|
|
682
|
-
message:
|
|
683
|
-
'Looks like you have Prettier in your project. Do you want to run it on your files?',
|
|
684
|
-
}),
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
if (!shouldRunPrettier) {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
} else {
|
|
677
|
+
if (!isInGitRepo()) {
|
|
678
|
+
// We only run formatting on changed files. If we're not in a git repo, we can't find
|
|
679
|
+
// changed files. So let's early-return without showing any formatting-related messages.
|
|
691
680
|
return;
|
|
692
681
|
}
|
|
693
682
|
|
|
@@ -697,6 +686,32 @@ export async function runPrettierIfInstalled(): Promise<void> {
|
|
|
697
686
|
})
|
|
698
687
|
.join(' ');
|
|
699
688
|
|
|
689
|
+
if (!changedOrUntrackedFiles.length) {
|
|
690
|
+
// Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
const packageJson = await getPackageDotJson();
|
|
695
|
+
const prettierInstalled = hasPackageInstalled('prettier', packageJson);
|
|
696
|
+
|
|
697
|
+
Sentry.setTag('prettier-installed', prettierInstalled);
|
|
698
|
+
|
|
699
|
+
if (!prettierInstalled) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// prompt the user if they want to run prettier
|
|
704
|
+
const shouldRunPrettier = await abortIfCancelled(
|
|
705
|
+
clack.confirm({
|
|
706
|
+
message:
|
|
707
|
+
'Looks like you have Prettier in your project. Do you want to run it on your files?',
|
|
708
|
+
}),
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
if (!shouldRunPrettier) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
|
|
700
715
|
const prettierSpinner = clack.spinner();
|
|
701
716
|
prettierSpinner.start('Running Prettier on your files.');
|
|
702
717
|
|
|
@@ -715,7 +730,7 @@ export async function runPrettierIfInstalled(): Promise<void> {
|
|
|
715
730
|
});
|
|
716
731
|
} catch (e) {
|
|
717
732
|
prettierSpinner.stop('Prettier failed to run.');
|
|
718
|
-
clack.log.
|
|
733
|
+
clack.log.warn(
|
|
719
734
|
'Prettier failed to run. There may be formatting issues in your updated files.',
|
|
720
735
|
);
|
|
721
736
|
return;
|