@sentry/wizard 4.4.0 → 4.6.0
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 +23 -1
- package/README.md +23 -19
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +4 -5
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +3 -5
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +1 -1
- package/dist/e2e-tests/utils/index.js +20 -2
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +2 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/File.d.ts +1 -1
- package/dist/lib/Helper/File.js +1 -3
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Logging.d.ts +3 -0
- package/dist/lib/Helper/Logging.js +3 -0
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/Package.d.ts +5 -3
- package/dist/lib/Helper/Package.js +2 -2
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/SentryCli.d.ts +20 -7
- package/dist/lib/Helper/SentryCli.js +21 -13
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +9 -5
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +21 -4
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.d.ts +3 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +1 -2
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +14 -10
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.d.ts +4 -1
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.d.ts +3 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.d.ts +4 -1
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.d.ts +42 -1
- package/dist/lib/Steps/SentryProjectSelector.js +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.d.ts +3 -1
- package/dist/lib/Steps/WaitForSentry.js +4 -4
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Types.d.ts +14 -0
- package/dist/lib/Types.js +3 -0
- package/dist/lib/Types.js.map +1 -0
- package/dist/lib/__tests__/Env.js +6 -13
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/android/android-wizard.js +15 -12
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/code-tools.js +1 -1
- package/dist/src/android/code-tools.js.map +1 -1
- package/dist/src/android/gradle.js +4 -4
- package/dist/src/android/gradle.js.map +1 -1
- package/dist/src/android/manifest.js +1 -1
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/apple/apple-wizard.d.ts +2 -2
- package/dist/src/apple/apple-wizard.js +37 -118
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -0
- package/dist/src/apple/check-installed-cli.js +60 -0
- package/dist/src/apple/check-installed-cli.js.map +1 -0
- package/dist/src/apple/cocoapod.js +1 -1
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/apple/code-tools.js +1 -1
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/configure-fastlane.d.ts +5 -0
- package/dist/src/apple/configure-fastlane.js +66 -0
- package/dist/src/apple/configure-fastlane.js.map +1 -0
- package/dist/src/apple/fastlane.d.ts +1 -1
- package/dist/src/apple/fastlane.js +5 -5
- package/dist/src/apple/fastlane.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +7 -0
- package/dist/src/apple/lookup-xcode-project.js +98 -0
- package/dist/src/apple/lookup-xcode-project.js.map +1 -0
- package/dist/src/apple/options.d.ts +4 -0
- package/dist/src/apple/options.js +3 -0
- package/dist/src/apple/options.js.map +1 -0
- package/dist/src/apple/search-xcode-project-at-path.d.ts +1 -0
- package/dist/src/apple/search-xcode-project-at-path.js +70 -0
- package/dist/src/apple/search-xcode-project-at-path.js.map +1 -0
- package/dist/src/apple/xcode-manager.js +1 -1
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/code-tools.js +3 -3
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +21 -15
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +4 -4
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +118 -67
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +11 -3
- package/dist/src/nextjs/templates.js +193 -71
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +21 -16
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-example.js +3 -3
- package/dist/src/nuxt/sdk-example.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +9 -9
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.js +173 -58
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/utils.js +6 -3
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +1 -1
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.js +4 -4
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +4 -4
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/javascript.js +7 -7
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.js +8 -8
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.d.ts +1 -1
- package/dist/src/react-native/react-native-wizard.js +36 -31
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/uninstall.js +8 -5
- package/dist/src/react-native/uninstall.js.map +1 -1
- package/dist/src/react-native/xcode.d.ts +2 -1
- package/dist/src/react-native/xcode.js +1 -2
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +4 -1
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +23 -18
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +163 -64
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +11 -7
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +3 -1
- package/dist/src/run.js +29 -9
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +30 -28
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.js +3 -3
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.js +3 -3
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
- package/dist/src/sourcemaps/tools/esbuild.js +6 -6
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.js +5 -5
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +6 -6
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +23 -16
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +6 -6
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +12 -12
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +10 -10
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +2 -2
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +5 -5
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.js +7 -7
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +1 -1
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +15 -14
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +25 -20
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +126 -37
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/telemetry.js +11 -0
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/{clack-utils.d.ts → clack/index.d.ts} +54 -15
- package/dist/src/utils/{clack-utils.js → clack/index.js} +107 -24
- package/dist/src/utils/clack/index.js.map +1 -0
- package/dist/src/utils/debug.js +1 -1
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/find-files-with-extension.d.ts +1 -0
- package/dist/src/utils/find-files-with-extension.js +39 -0
- package/dist/src/utils/find-files-with-extension.js.map +1 -0
- package/dist/src/utils/package-manager.d.ts +6 -1
- package/dist/src/utils/package-manager.js +32 -27
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/sentrycli-utils.js +0 -1
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/android/code-tools.test.js +0 -1
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +1 -1
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +1 -1
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +1 -1
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +26 -2
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +0 -2
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +23 -23
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +127 -133
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +1 -1
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +1 -1
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +1 -1
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +14 -3
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/utils/{clack-utils.test.js → clack/index.test.js} +131 -41
- package/dist/test/utils/clack/index.test.js.map +1 -0
- package/dist/test/utils/package-manager.test.d.ts +1 -0
- package/dist/test/utils/package-manager.test.js +29 -0
- package/dist/test/utils/package-manager.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/utils/clack-utils.js.map +0 -1
- package/dist/test/utils/clack-utils.test.js.map +0 -1
- /package/dist/test/utils/{clack-utils.test.d.ts → clack/index.test.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
- feat(nextjs): Switch to injecting `instrumentation-client.ts` ([#918](https://github.com/getsentry/sentry-wizard/pull/918))
|
|
6
|
+
- feat(remix): New Remix example page ([#917](https://github.com/getsentry/sentry-wizard/pull/917))
|
|
7
|
+
- feat(nuxt): New Nuxt example page ([#916](https://github.com/getsentry/sentry-wizard/pull/916))
|
|
8
|
+
- feat(sveltekit): New Sveltekit example page ([#913](https://github.com/getsentry/sentry-wizard/pull/913))
|
|
9
|
+
- feat(nextjs): New NextJS example page ([#899](https://github.com/getsentry/sentry-wizard/pull/899))
|
|
10
|
+
- feat(telemetry): Add `is_binary` tag to distinguish fossilized binaries ([#857](https://github.com/getsentry/sentry-wizard/pull/857))
|
|
11
|
+
- fix(utils): Bail package manager detection if multiple candidates are detected ([#864](https://github.com/getsentry/sentry-wizard/pull/864))
|
|
12
|
+
- fix(nextjs): Create root layout for example page if it doesn't exist([#863](https://github.com/getsentry/sentry-wizard/pull/863))
|
|
13
|
+
- ref(utils): Unify `getPackageManger` and `detectPackageManager` ([#865](https://github.com/getsentry/sentry-wizard/pull/865))
|
|
14
|
+
- feat: add option to ignore git changes ([#898](https://github.com/getsentry/sentry-wizard/pull/898))
|
|
15
|
+
- fix(apple): Add additional types to `xcode.d.ts` ([#900](https://github.com/getsentry/sentry-wizard/pull/900))
|
|
16
|
+
- fix: enable debug logs for option `--debug` ([#902](https://github.com/getsentry/sentry-wizard/pull/902))
|
|
17
|
+
|
|
18
|
+
## 4.5.0
|
|
19
|
+
|
|
20
|
+
- feat(nextjs): Remove react component annotation prompt and insertion ([#858](https://github.com/getsentry/sentry-wizard/pull/858))
|
|
21
|
+
- fix: Prevent addition of multiple `sentry:sourcemaps` commands ([#840](https://github.com/getsentry/sentry-wizard/pull/840))
|
|
22
|
+
- ref(clack-utils): Use child_process spawn instead of exec when to install package ([#859](https://github.com/getsentry/sentry-wizard/pull/859))
|
|
23
|
+
|
|
3
24
|
## 4.4.0
|
|
4
25
|
|
|
5
26
|
- feat(react-native): Adds wrapping root app component with `Sentry.wrap` ([#835](https://github.com/getsentry/sentry-wizard/pull/835))
|
|
@@ -10,8 +31,9 @@
|
|
|
10
31
|
- feat(deps): Bump axios from 1.7.4 to 1.8.2 ([#844](https://github.com/getsentry/sentry-wizard/pull/844))
|
|
11
32
|
- feat(sourcemaps): Remove NextJS and Remix flows from sourcemaps wizard ([#849](https://github.com/getsentry/sentry-wizard/pull/849))
|
|
12
33
|
|
|
13
|
-
The NextJS and Remix flows have been removed when running the wizard with `npx @sentry/wizard -i sourcemaps`.
|
|
34
|
+
The NextJS and Remix flows have been removed when running the wizard with `npx @sentry/wizard -i sourcemaps`.
|
|
14
35
|
Please use `npx @sentry/wizard -i nextjs` and `npx @sentry/wizard -i remix` instead.
|
|
36
|
+
|
|
15
37
|
- ref: Reword Replay feature selection ([#847](https://github.com/getsentry/sentry-wizard/pull/847))
|
|
16
38
|
- ref: Fix auth token env variable wording in flutter and apple wizards ([#853](https://github.com/getsentry/sentry-wizard/pull/853))
|
|
17
39
|
|
package/README.md
CHANGED
|
@@ -48,30 +48,34 @@ yarn sentry-wizard
|
|
|
48
48
|
npx @sentry/wizard
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
At the current moment, the wizard can be used for Next.js, react-native, iOS,
|
|
51
|
+
At the current moment, the wizard can be used for Next.js, react-native, iOS,
|
|
52
|
+
Flutter, Nuxt, Remix, Sveltekit, Android, Electron, Cordova, and for sourcemaps
|
|
53
|
+
setup. If you have other platforms you would like the wizard to support, please
|
|
54
|
+
open a [GitHub issue](https://github.com/getsentry/sentry-wizard/issues)!
|
|
52
55
|
|
|
53
56
|
# Options
|
|
54
57
|
|
|
55
58
|
The following CLI arguments are available:
|
|
56
59
|
|
|
57
|
-
| Option
|
|
58
|
-
|
|
|
59
|
-
| `--help`
|
|
60
|
-
| `--version`
|
|
61
|
-
| `--debug`
|
|
62
|
-
| `--uninstall`
|
|
63
|
-
| `--skip-connect`
|
|
64
|
-
| `--quiet`
|
|
65
|
-
| `-i, --integration`
|
|
66
|
-
| `-p, --platform`
|
|
67
|
-
| `-u, --url`
|
|
68
|
-
| `--project`
|
|
69
|
-
| `--org`
|
|
70
|
-
| `--saas`
|
|
71
|
-
| `-s, --signup`
|
|
72
|
-
| `--disable-telemetry`
|
|
73
|
-
| `--force-install`
|
|
74
|
-
| `--coming-from`
|
|
60
|
+
| Option | Description | Type | Default | Choices | Environment Variable |
|
|
61
|
+
| ---------------------- | ----------------------------------------------------------------- | ------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
|
62
|
+
| `--help` | Show help | boolean | | | |
|
|
63
|
+
| `--version` | Show version number | boolean | | | |
|
|
64
|
+
| `--debug` | Enable verbose logging | boolean | `false` | | `SENTRY_WIZARD_DEBUG` |
|
|
65
|
+
| `--uninstall` | Revert project setup process. Not available for all integrations. | boolean | `false` | | `SENTRY_WIZARD_UNINSTALL` |
|
|
66
|
+
| `--skip-connect` | Skips the connection to the server | boolean | `false` | | `SENTRY_WIZARD_SKIP_CONNECT` |
|
|
67
|
+
| `--quiet` | Do not fallback to prompting user asking questions | boolean | `false` | | `SENTRY_WIZARD_QUIET` |
|
|
68
|
+
| `-i, --integration` | Choose the integration to setup | choices | Select integration during setup | "reactNative", "flutter", ios", "android", "cordova", "electron", "nextjs", "nuxt", "remix", "sveltekit", "sourcemaps" | `SENTRY_WIZARD_INTEGRATION` |
|
|
69
|
+
| `-p, --platform` | Choose platform(s) | array | Select platform(s) during setup | "ios", "android" | `SENTRY_WIZARD_PLATFORM` |
|
|
70
|
+
| `-u, --url` | The URL to your Sentry installation | string | `https://sentry.io` | | `SENTRY_WIZARD_URL` |
|
|
71
|
+
| `--project` | The Sentry project slug to use | string | Select project during setup | | |
|
|
72
|
+
| `--org` | The Sentry org slug to use | string | Select org during setup | | |
|
|
73
|
+
| `--saas` | Skip the self-hosted or SaaS URL selection process | boolean | Select self-hosted or SaaS during setup | | |
|
|
74
|
+
| `-s, --signup` | Redirect to signup page if not logged in | boolean | `false` | | |
|
|
75
|
+
| `--disable-telemetry` | Don't send telemetry data to Sentry | boolean | `false` | | |
|
|
76
|
+
| `--force-install` | Force install the SDK NPM package (use with caution!) | boolean | `false` | | |
|
|
77
|
+
| `--coming-from` | Specify the partner organization initiating this command. | string | | | |
|
|
78
|
+
| `--ignore-git-changes` | Ignore git changes in the project and not prompt for confirmation | boolean | `false` | | |
|
|
75
79
|
|
|
76
80
|
## Resources
|
|
77
81
|
|
package/dist/bin.js
CHANGED
|
@@ -62,6 +62,13 @@ const PRESELECTED_PROJECT_OPTIONS = {
|
|
|
62
62
|
describe: 'Preselected organization slug',
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
|
+
const xcodeProjectDirOption = {
|
|
66
|
+
default: undefined,
|
|
67
|
+
describe: 'Path to the project containing the Xcode project file. Only applies to the Apple wizard.',
|
|
68
|
+
type: 'string',
|
|
69
|
+
// This is a hidden option because it is used as an internal option
|
|
70
|
+
hidden: true,
|
|
71
|
+
};
|
|
65
72
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
66
73
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv), process.cwd())
|
|
67
74
|
.options({
|
|
@@ -139,6 +146,12 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv), process.
|
|
|
139
146
|
describe: 'Force install the SDK NPM package',
|
|
140
147
|
type: 'boolean',
|
|
141
148
|
},
|
|
149
|
+
'ignore-git-changes': {
|
|
150
|
+
default: false,
|
|
151
|
+
describe: 'Ignore git changes in the project',
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
},
|
|
154
|
+
'xcode-project-dir': xcodeProjectDirOption,
|
|
142
155
|
...PRESELECTED_PROJECT_OPTIONS,
|
|
143
156
|
})
|
|
144
157
|
// This prevents `yargs` from trying to read the local package.json
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,mCAAmC;AACnC,kDAA2C;AAE3C,kDAA0B;AAC1B,2CAAwC;AAExC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,kCAAkC,kBAAkB,2BAA2B,OAAO,CAAC,OAAO,wCAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,+CAAwD;AACxD,mCAAgC;AAChC,2CAA+C;AAE/C,8CAA4B;AAE5B,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,mCAAmC;AACnC,kDAA2C;AAE3C,kDAA0B;AAC1B,2CAAwC;AAExC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,kCAAkC,kBAAkB,2BAA2B,OAAO,CAAC,OAAO,wCAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,+CAAwD;AACxD,mCAAgC;AAChC,2CAA+C;AAE/C,8CAA4B;AA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E,SAAS;KAChB;IACD,mBAAmB,EAAE,qBAAqB;IAC1C,GAAG,2BAA2B;CAC/B,CAAC;IACF,mEAAmE;IACnE,gFAAgF;KAC/E,OAAO,CAAC,wBAAc,CAAC,CAAC,IAAI,CAAC;AAEhC,0FAA0F;AAC1F,sFAAsF;AACtF,mEAAmE;AACnE,KAAK,IAAA,SAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=18.20.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\nimport { WIZARD_VERSION } from './src/version';\n\nexport * from './lib/Setup';\n\nconst PRESELECTED_PROJECT_OPTIONS: Record<string, yargs.Options> = {\n 'preSelectedProject.authToken': {\n describe: 'Preselected project auth token',\n },\n 'preSelectedProject.selfHosted': {\n describe: 'Preselected project is self-hosted',\n },\n 'preSelectedProject.dsn': {\n describe: 'Preselected project DSN',\n },\n 'preSelectedProject.id': {\n describe: 'Preselected project id',\n },\n 'preSelectedProject.projectSlug': {\n describe: 'Preselected project slug',\n },\n 'preSelectedProject.projectName': {\n describe: 'Preselected project name',\n },\n 'preSelectedProject.orgId': {\n describe: 'Preselected organization id',\n },\n 'preSelectedProject.orgName': {\n describe: 'Preselected organization name',\n },\n 'preSelectedProject.orgSlug': {\n describe: 'Preselected organization slug',\n },\n};\nconst xcodeProjectDirOption: yargs.Options = {\n default: undefined,\n describe:\n 'Path to the project containing the Xcode project file. Only applies to the Apple wizard.',\n type: 'string',\n // This is a hidden option because it is used as an internal option\n hidden: true,\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv), process.cwd())\n .options({\n debug: {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n },\n uninstall: {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n },\n 'skip-connect': {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n },\n quiet: {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n },\n i: {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe:\n 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n },\n p: {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n },\n u: {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n },\n project: {\n type: 'string',\n describe: 'The Sentry project slug to use',\n defaultDescription: 'Select project during setup',\n default: undefined,\n },\n org: {\n type: 'string',\n describe: 'The Sentry org slug to use',\n defaultDescription: 'Select org during setup',\n default: undefined,\n },\n saas: {\n default: false,\n describe: 'Skip the self-hosted or SaaS URL selection process',\n defaultDescription: 'Select self-hosted or SaaS during setup',\n type: 'boolean',\n },\n s: {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n },\n 'disable-telemetry': {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n },\n 'promo-code': {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n },\n 'force-install': {\n default: false,\n describe: 'Force install the SDK NPM package',\n type: 'boolean',\n },\n 'ignore-git-changes': {\n default: false,\n describe: 'Ignore git changes in the project',\n type: 'boolean',\n },\n 'xcode-project-dir': xcodeProjectDirOption,\n ...PRESELECTED_PROJECT_OPTIONS,\n })\n // This prevents `yargs` from trying to read the local package.json\n // as it's not available in the Node Single Executable Binary artifacts versions\n .version(WIZARD_VERSION).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
|
|
@@ -41,9 +41,7 @@ describe('NextJS-14', () => {
|
|
|
41
41
|
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', {
|
|
42
42
|
timeout: 240000,
|
|
43
43
|
}));
|
|
44
|
-
const
|
|
45
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to enable React component annotations'));
|
|
46
|
-
const tracingOptionPrompted = reactComponentAnnotationsPrompted &&
|
|
44
|
+
const tracingOptionPrompted = routeThroughNextJsPrompted &&
|
|
47
45
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
48
46
|
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
49
47
|
'to track the performance of your application?'));
|
|
@@ -74,19 +72,20 @@ describe('NextJS-14', () => {
|
|
|
74
72
|
(0, utils_1.checkEnvBuildPlugin)(projectDir);
|
|
75
73
|
});
|
|
76
74
|
test('example page exists', () => {
|
|
75
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/app/layout.tsx`);
|
|
77
76
|
(0, utils_3.checkFileExists)(`${projectDir}/src/app/sentry-example-page/page.tsx`);
|
|
78
77
|
(0, utils_3.checkFileExists)(`${projectDir}/src/app/api/sentry-example-api/route.ts`);
|
|
79
78
|
});
|
|
80
79
|
test('config files created', () => {
|
|
81
80
|
(0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
|
|
82
|
-
(0, utils_3.checkFileExists)(`${projectDir}/sentry.client.config.ts`);
|
|
83
81
|
(0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
|
|
84
82
|
});
|
|
85
83
|
test('global error file exists', () => {
|
|
86
84
|
(0, utils_3.checkFileExists)(`${projectDir}/src/app/global-error.tsx`);
|
|
87
85
|
});
|
|
88
|
-
test('instrumentation
|
|
86
|
+
test('instrumentation files exists', () => {
|
|
89
87
|
(0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation.ts`);
|
|
88
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
|
|
90
89
|
});
|
|
91
90
|
test('instrumentation file contains Sentry initialization', () => {
|
|
92
91
|
(0, utils_3.checkFileContents)(`${projectDir}/src/instrumentation.ts`, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-14.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-14.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAOkB;AAElB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QAEF,MAAM,0BAA0B,GAC9B,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,Y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node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\n\ndescribe('NextJS-14', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-14-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/layout.tsx`);\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.mjs`, [\n \"import {withSentryConfig} from '@sentry/nextjs'\",\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n});\n"]}
|
|
@@ -41,9 +41,7 @@ describe('NextJS-15', () => {
|
|
|
41
41
|
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', {
|
|
42
42
|
timeout: 240000,
|
|
43
43
|
}));
|
|
44
|
-
const
|
|
45
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to enable React component annotations'));
|
|
46
|
-
const tracingOptionPrompted = reactComponentAnnotationsPrompted &&
|
|
44
|
+
const tracingOptionPrompted = routeThroughNextJsPrompted &&
|
|
47
45
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
48
46
|
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
49
47
|
'to track the performance of your application?'));
|
|
@@ -79,14 +77,14 @@ describe('NextJS-15', () => {
|
|
|
79
77
|
});
|
|
80
78
|
test('config files created', () => {
|
|
81
79
|
(0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
|
|
82
|
-
(0, utils_3.checkFileExists)(`${projectDir}/sentry.client.config.ts`);
|
|
83
80
|
(0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
|
|
84
81
|
});
|
|
85
82
|
test('global error file exists', () => {
|
|
86
83
|
(0, utils_3.checkFileExists)(`${projectDir}/src/app/global-error.tsx`);
|
|
87
84
|
});
|
|
88
|
-
test('instrumentation
|
|
85
|
+
test('instrumentation files exists', () => {
|
|
89
86
|
(0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation.ts`);
|
|
87
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
|
|
90
88
|
});
|
|
91
89
|
test('instrumentation file contains Sentry initialization', () => {
|
|
92
90
|
(0, utils_3.checkFileContents)(`${projectDir}/src/instrumentation.ts`, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-15.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-15.test.ts"],"names":[],"mappings":";;;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BAAiB,EAAE;YAChD,iDAAiD;YACjD,+CAA+C;SAChD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable jest/expect-expect */\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\n\ndescribe('NextJS-15', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-15-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import {withSentryConfig} from \"@sentry/nextjs\"',\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n});\n"]}
|
|
@@ -18,7 +18,7 @@ export declare const TEST_ARGS: {
|
|
|
18
18
|
export declare const log: {
|
|
19
19
|
success: (message: string) => void;
|
|
20
20
|
info: (message: string) => void;
|
|
21
|
-
error: (message:
|
|
21
|
+
error: (message: unknown) => void;
|
|
22
22
|
};
|
|
23
23
|
export declare class WizardTestEnv {
|
|
24
24
|
taskHandle: ChildProcess;
|
|
@@ -50,7 +50,25 @@ exports.log = {
|
|
|
50
50
|
(0, Logging_1.dim)(`[INFO] ${message}`);
|
|
51
51
|
},
|
|
52
52
|
error: (message) => {
|
|
53
|
-
(
|
|
53
|
+
function formatMessage(message, depth) {
|
|
54
|
+
if (depth > 3) {
|
|
55
|
+
return '...';
|
|
56
|
+
}
|
|
57
|
+
if (message instanceof Error) {
|
|
58
|
+
return JSON.stringify({
|
|
59
|
+
name: message.name,
|
|
60
|
+
message: message.message,
|
|
61
|
+
stack: message.stack,
|
|
62
|
+
...(message.cause
|
|
63
|
+
? {
|
|
64
|
+
cause: formatMessage(message.cause, depth + 1),
|
|
65
|
+
}
|
|
66
|
+
: {}),
|
|
67
|
+
}, null, 2);
|
|
68
|
+
}
|
|
69
|
+
return String(message);
|
|
70
|
+
}
|
|
71
|
+
(0, Logging_1.red)(`[ERROR] ${formatMessage(message, 0)}`);
|
|
54
72
|
},
|
|
55
73
|
};
|
|
56
74
|
class WizardTestEnv {
|
|
@@ -96,7 +114,7 @@ class WizardTestEnv {
|
|
|
96
114
|
return new Promise((resolve, reject) => {
|
|
97
115
|
const timeoutId = setTimeout(() => {
|
|
98
116
|
this.kill();
|
|
99
|
-
reject(new Error(`Timeout waiting for status code: ${statusCode}`));
|
|
117
|
+
reject(new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`));
|
|
100
118
|
}, timeout);
|
|
101
119
|
this.taskHandle.on('error', (err) => {
|
|
102
120
|
clearTimeout(timeoutId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAGlC,2DAAqD;AAErD,sDAA2D;AAE9C,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;IACnE,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0CAA0C;IAC3E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe;IACxD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;CACrE,CAAC;AAEW,QAAA,GAAG,GAAG;IACjB,OAAO,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,IAAA,eAAK,EAAC,aAAa,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EA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D,oDAYC;AAED;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,cAAsB,EACtB,YAAY,GAAG,OAAO;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE;QAC9D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAC;IAEH,MAAM,MAAM,CACV,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QACpC,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAfD,sDAeC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: string) => {\n red(`[ERROR] ${message}`);\n },\n};\n\nexport class WizardTestEnv {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n sendStdin(input: string) {\n this.taskHandle.stdin?.write(input);\n }\n\n /**\n * Sends the input and waits for the output.\n * @returns a promise that resolves when the output was found\n * @throws an error when the output was not found within the timeout\n */\n sendStdinAndWaitForOutput(\n input: string | string[],\n output: string,\n options?: { timeout?: number; optional?: boolean },\n ) {\n const outputPromise = this.waitForOutput(output, options);\n\n if (Array.isArray(input)) {\n for (const i of input) {\n this.sendStdin(i);\n }\n } else {\n this.sendStdin(input);\n }\n return outputPromise;\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(new Error(`Timeout waiting for status code: ${statusCode}`));\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.stdout?.on('data', (data) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n });\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nexport function initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n\n/**\n * Cleanup the git repository in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n * @param projectDir\n */\nexport function cleanupGit(projectDir: string): void {\n try {\n // Remove the .git directory\n execSync(`rm -rf ${projectDir}/.git`);\n } catch (e) {\n log.error('Error cleaning up git');\n log.error(e);\n }\n}\n\n/**\n * Revert local changes in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n *\n * @param projectDir\n */\nexport function revertLocalChanges(projectDir: string): void {\n try {\n // Revert tracked files\n execSync('git checkout .', { cwd: projectDir });\n // Revert untracked files\n execSync('git clean -fd .', { cwd: projectDir });\n } catch (e) {\n log.error('Error reverting local changes');\n log.error(e);\n }\n}\n\n/**\n * Start the wizard instance with the given integration and project directory\n * @param integration\n * @param projectDir\n *\n * @returns WizardTestEnv\n */\nexport function startWizardInstance(\n integration: Integration,\n projectDir: string,\n debug = false,\n): WizardTestEnv {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n initGit(projectDir);\n\n return new WizardTestEnv(\n binPath,\n [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n ],\n { cwd: projectDir, debug },\n );\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the package.json contains the given integration\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(projectDir: string, integration: Integration) {\n checkFileContents(`${projectDir}/package.json`, `@sentry/${integration}`);\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const testEnv = new WizardTestEnv('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n await expect(\n testEnv.waitForStatusCode(0, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n testEnv.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const testEnv = new WizardTestEnv('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n testEnv.kill();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAGlC,2DAAqD;AAErD,sDAA2D;AAE9C,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;IACnE,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0CAA0C;IAC3E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe;IACxD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;CACrE,CAAC;AAEW,QAAA,GAAG,GAAG;IACjB,OAAO,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,IAAA,eAAK,EAAC,aAAa,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,IAAA,aAAG,EAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,KAAK,EAAE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,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAfD,oDAeC;AAED;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CACxC,UAAkB,EAClB,cAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;IAE9E,MAAM,MAAM,CACV,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QACpC,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAZD,oDAYC;AAED;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,cAAsB,EACtB,YAAY,GAAG,OAAO;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE;QAC9D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAC;IAEH,MAAM,MAAM,CACV,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QACpC,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAfD,sDAeC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: unknown) => {\n function formatMessage(message: unknown, depth: number): string {\n if (depth > 3) {\n return '...';\n }\n\n if (message instanceof Error) {\n return JSON.stringify(\n {\n name: message.name,\n message: message.message,\n stack: message.stack,\n ...(message.cause\n ? {\n cause: formatMessage(message.cause, depth + 1),\n }\n : {}),\n },\n null,\n 2,\n );\n }\n return String(message);\n }\n red(`[ERROR] ${formatMessage(message, 0)}`);\n },\n};\n\nexport class WizardTestEnv {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n sendStdin(input: string) {\n this.taskHandle.stdin?.write(input);\n }\n\n /**\n * Sends the input and waits for the output.\n * @returns a promise that resolves when the output was found\n * @throws an error when the output was not found within the timeout\n */\n sendStdinAndWaitForOutput(\n input: string | string[],\n output: string,\n options?: { timeout?: number; optional?: boolean },\n ) {\n const outputPromise = this.waitForOutput(output, options);\n\n if (Array.isArray(input)) {\n for (const i of input) {\n this.sendStdin(i);\n }\n } else {\n this.sendStdin(input);\n }\n return outputPromise;\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(\n new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`),\n );\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.stdout?.on('data', (data) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n });\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nexport function initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n\n/**\n * Cleanup the git repository in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n * @param projectDir\n */\nexport function cleanupGit(projectDir: string): void {\n try {\n // Remove the .git directory\n execSync(`rm -rf ${projectDir}/.git`);\n } catch (e) {\n log.error('Error cleaning up git');\n log.error(e);\n }\n}\n\n/**\n * Revert local changes in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n *\n * @param projectDir\n */\nexport function revertLocalChanges(projectDir: string): void {\n try {\n // Revert tracked files\n execSync('git checkout .', { cwd: projectDir });\n // Revert untracked files\n execSync('git clean -fd .', { cwd: projectDir });\n } catch (e) {\n log.error('Error reverting local changes');\n log.error(e);\n }\n}\n\n/**\n * Start the wizard instance with the given integration and project directory\n * @param integration\n * @param projectDir\n *\n * @returns WizardTestEnv\n */\nexport function startWizardInstance(\n integration: Integration,\n projectDir: string,\n debug = false,\n): WizardTestEnv {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n initGit(projectDir);\n\n return new WizardTestEnv(\n binPath,\n [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n ],\n { cwd: projectDir, debug },\n );\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the package.json contains the given integration\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(projectDir: string, integration: Integration) {\n checkFileContents(`${projectDir}/package.json`, `@sentry/${integration}`);\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const testEnv = new WizardTestEnv('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n await expect(\n testEnv.waitForStatusCode(0, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n testEnv.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const testEnv = new WizardTestEnv('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n await expect(\n testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).resolves.toBe(true);\n testEnv.kill();\n}\n"]}
|
package/dist/lib/Constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IA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AI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAkBY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function patchMatchingFile(globPattern: string, func:
|
|
1
|
+
export declare function patchMatchingFile(globPattern: string, func: (content: string, match: string, ...args: unknown[]) => Promise<string | void>, ...args: unknown[]): Promise<void>;
|
|
2
2
|
export declare function matchFiles(globPattern: string): string[];
|
|
3
3
|
export declare function exists(globPattern: string): boolean;
|
|
4
4
|
export declare function matchesContent(globPattern: string, contentPattern: RegExp): boolean;
|
package/dist/lib/Helper/File.js
CHANGED
|
@@ -39,9 +39,7 @@ function patchMatchingFile(globPattern, func, ...args) {
|
|
|
39
39
|
rv = rv
|
|
40
40
|
.then(() => func(contents, match, ...args))
|
|
41
41
|
.then((newContents) => {
|
|
42
|
-
if (newContents
|
|
43
|
-
newContents !== undefined &&
|
|
44
|
-
contents !== newContents) {
|
|
42
|
+
if (newContents != null && contents !== newContents) {
|
|
45
43
|
fs.writeFileSync(match, newContents);
|
|
46
44
|
}
|
|
47
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../lib/Helper/File.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,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AJD,gCAIC;AAED,SAAgB,MAAM,CAAC,WAAmB;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,cAAc;KACvB,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,IAAa,EAAE,KAAa,EAAE,EAAE;QACrD,OAAO,IAAI,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAVD,wBAUC;AAED,SAAgB,cAAc,CAC5B,WAAmB,EACnB,cAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,cAAc;KACvB,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,IAAa,EAAE,KAAa,EAAE,EAAE;QACrD,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAbD,wCAaC","sourcesContent":["import * as fs from 'fs';\nimport * as glob from 'glob';\n\nconst IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];\n\nexport function patchMatchingFile(\n globPattern: string,\n func: (\n content: string,\n match: string,\n ...args: unknown[]\n ) => Promise<string | void>,\n ...args: unknown[]\n): Promise<void> {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n let rv = Promise.resolve();\n matches.forEach((match: string) => {\n const contents = fs.readFileSync(match, {\n encoding: 'utf-8',\n });\n rv = rv\n .then(() => func(contents, match, ...args))\n .then((newContents) => {\n if (newContents != null && contents !== newContents) {\n fs.writeFileSync(match, newContents);\n }\n });\n });\n return rv;\n}\n\nexport function matchFiles(globPattern: string): string[] {\n return glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n}\n\nexport function exists(globPattern: string): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return prev && fs.existsSync(match);\n }, true);\n}\n\nexport function matchesContent(\n globPattern: string,\n contentPattern: RegExp,\n): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return !!(prev && fs.readFileSync(match).toString().match(contentPattern));\n }, true);\n}\n"]}
|
|
@@ -6,4 +6,7 @@ export declare function red(msg: string): void;
|
|
|
6
6
|
export declare function dim(msg: string): void;
|
|
7
7
|
export declare function yellow(msg: string): void;
|
|
8
8
|
export declare function cyan(msg: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `debug` from `src/utils/debug.ts` instead.
|
|
11
|
+
*/
|
|
9
12
|
export declare function debug(msg: any): void;
|
|
@@ -44,6 +44,9 @@ function cyan(msg) {
|
|
|
44
44
|
return l(chalk_1.default.cyan(prepareMessage(msg)));
|
|
45
45
|
}
|
|
46
46
|
exports.cyan = cyan;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use `debug` from `src/utils/debug.ts` instead.
|
|
49
|
+
*/
|
|
47
50
|
function debug(msg) {
|
|
48
51
|
return l(chalk_1.default.italic.yellow(prepareMessage(msg)));
|
|
49
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logging.js","sourceRoot":"","sources":["../../../lib/Helper/Logging.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,SAAgB,cAAc,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AED,SAAgB,KAAK,CAAC,GAAQ;IAC5B,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,sBAEC","sourcesContent":["import Chalk from 'chalk';\n\nexport function prepareMessage(msg: unknown): string {\n if (typeof msg === 'string') {\n return msg;\n }\n if (msg instanceof Error) {\n return `${msg.stack || ''}`;\n }\n return JSON.stringify(msg, null, '\\t');\n}\n\nexport function l(msg: string): void {\n // eslint-disable-next-line no-console\n console.log(msg);\n}\n\nexport function nl(): void {\n return l('');\n}\n\nexport function green(msg: string): void {\n return l(Chalk.green(prepareMessage(msg)));\n}\n\nexport function red(msg: string): void {\n return l(Chalk.red(prepareMessage(msg)));\n}\n\nexport function dim(msg: string): void {\n return l(Chalk.dim(prepareMessage(msg)));\n}\n\nexport function yellow(msg: string): void {\n return l(Chalk.yellow(prepareMessage(msg)));\n}\n\nexport function cyan(msg: string): void {\n return l(Chalk.cyan(prepareMessage(msg)));\n}\n\nexport function debug(msg: any): void {\n return l(Chalk.italic.yellow(prepareMessage(msg)));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Logging.js","sourceRoot":"","sources":["../../../lib/Helper/Logging.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,SAAgB,cAAc,CAAC,GAAY;IACzC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;KAC7B;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AARD,wCAQC;AAED,SAAgB,CAAC,CAAC,GAAW;IAC3B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAHD,cAGC;AAED,SAAgB,EAAE;IAChB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACf,CAAC;AAFD,gBAEC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,MAAM,CAAC,GAAW;IAChC,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAFD,wBAEC;AAED,SAAgB,IAAI,CAAC,GAAW;IAC9B,OAAO,CAAC,CAAC,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAFD,oBAEC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,GAAQ;IAC5B,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,sBAEC","sourcesContent":["import Chalk from 'chalk';\n\nexport function prepareMessage(msg: unknown): string {\n if (typeof msg === 'string') {\n return msg;\n }\n if (msg instanceof Error) {\n return `${msg.stack || ''}`;\n }\n return JSON.stringify(msg, null, '\\t');\n}\n\nexport function l(msg: string): void {\n // eslint-disable-next-line no-console\n console.log(msg);\n}\n\nexport function nl(): void {\n return l('');\n}\n\nexport function green(msg: string): void {\n return l(Chalk.green(prepareMessage(msg)));\n}\n\nexport function red(msg: string): void {\n return l(Chalk.red(prepareMessage(msg)));\n}\n\nexport function dim(msg: string): void {\n return l(Chalk.dim(prepareMessage(msg)));\n}\n\nexport function yellow(msg: string): void {\n return l(Chalk.yellow(prepareMessage(msg)));\n}\n\nexport function cyan(msg: string): void {\n return l(Chalk.cyan(prepareMessage(msg)));\n}\n\n/**\n * @deprecated Use `debug` from `src/utils/debug.ts` instead.\n */\nexport function debug(msg: any): void {\n return l(Chalk.italic.yellow(prepareMessage(msg)));\n}\n"]}
|