@sentry/wizard 3.38.0 → 3.39.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 +6 -1
- package/README.md +2 -2
- package/dist/e2e-tests/tests/nextjs.test.js +1 -1
- package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +1 -2
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +17 -5
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +12 -2
- package/dist/e2e-tests/utils/index.js +23 -3
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +3 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +2 -3
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/telemetry.d.ts +2 -1
- package/dist/src/telemetry.js +1 -1
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/clack-utils.js +3 -3
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-manager.d.ts +0 -1
- package/dist/src/utils/package-manager.js +9 -10
- package/dist/src/utils/package-manager.js.map +1 -1
- package/e2e-tests/test-applications/nextjs-test-app/package.json +1 -1
- package/e2e-tests/tests/nextjs.test.ts +1 -1
- package/e2e-tests/tests/nuxt-3.test.ts +1 -1
- package/e2e-tests/tests/nuxt-4.test.ts +1 -1
- package/e2e-tests/tests/remix.test.ts +30 -19
- package/e2e-tests/tests/sveltekit.test.ts +79 -50
- package/e2e-tests/utils/index.ts +33 -6
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +4 -1
- package/src/sourcemaps/sourcemaps-wizard.ts +3 -7
- package/src/telemetry.ts +6 -2
- package/src/utils/clack-utils.ts +4 -3
- package/src/utils/package-manager.ts +8 -11
|
@@ -61,24 +61,27 @@ app.all(
|
|
|
61
61
|
app.listen(0, () => console.log('Express server listening'));
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
async function runWizardOnRemixProject(
|
|
65
|
+
projectDir: string,
|
|
66
|
+
integration: Integration,
|
|
67
|
+
fileModificationFn?: (
|
|
68
|
+
projectDir: string,
|
|
69
|
+
integration: Integration,
|
|
70
|
+
) => unknown,
|
|
71
|
+
) {
|
|
66
72
|
const wizardInstance = startWizardInstance(integration, projectDir);
|
|
67
73
|
let packageManagerPrompted = false;
|
|
68
74
|
|
|
69
75
|
if (fileModificationFn) {
|
|
70
76
|
fileModificationFn(projectDir, integration);
|
|
71
77
|
|
|
72
|
-
await wizardInstance.waitForOutput(
|
|
73
|
-
'Do you want to continue anyway?',
|
|
74
|
-
);
|
|
78
|
+
await wizardInstance.waitForOutput('Do you want to continue anyway?');
|
|
75
79
|
|
|
76
80
|
packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(
|
|
77
81
|
[KEYS.ENTER],
|
|
78
82
|
'Please select your package manager.',
|
|
79
83
|
);
|
|
80
84
|
} else {
|
|
81
|
-
|
|
82
85
|
packageManagerPrompted = await wizardInstance.waitForOutput(
|
|
83
86
|
'Please select your package manager.',
|
|
84
87
|
);
|
|
@@ -119,12 +122,16 @@ async function runWizardOnRemixProject(projectDir: string, integration: Integrat
|
|
|
119
122
|
);
|
|
120
123
|
|
|
121
124
|
wizardInstance.kill();
|
|
122
|
-
}
|
|
125
|
+
}
|
|
123
126
|
|
|
124
|
-
function checkRemixProject(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
function checkRemixProject(
|
|
128
|
+
projectDir: string,
|
|
129
|
+
integration: Integration,
|
|
130
|
+
options?: {
|
|
131
|
+
devModeExpectedOutput?: string;
|
|
132
|
+
prodModeExpectedOutput?: string;
|
|
133
|
+
},
|
|
134
|
+
) {
|
|
128
135
|
test('package.json is updated correctly', () => {
|
|
129
136
|
checkPackageJson(projectDir, integration);
|
|
130
137
|
});
|
|
@@ -195,15 +202,21 @@ function checkRemixProject(projectDir: string, integration: Integration, options
|
|
|
195
202
|
});
|
|
196
203
|
|
|
197
204
|
test('builds successfully', async () => {
|
|
198
|
-
await checkIfBuilds(projectDir
|
|
205
|
+
await checkIfBuilds(projectDir);
|
|
199
206
|
});
|
|
200
207
|
|
|
201
208
|
test('runs on dev mode correctly', async () => {
|
|
202
|
-
await checkIfRunsOnDevMode(
|
|
209
|
+
await checkIfRunsOnDevMode(
|
|
210
|
+
projectDir,
|
|
211
|
+
options?.devModeExpectedOutput || 'to expose',
|
|
212
|
+
);
|
|
203
213
|
});
|
|
204
214
|
|
|
205
215
|
test('runs on prod mode correctly', async () => {
|
|
206
|
-
await checkIfRunsOnProdMode(
|
|
216
|
+
await checkIfRunsOnProdMode(
|
|
217
|
+
projectDir,
|
|
218
|
+
options?.prodModeExpectedOutput || '[remix-serve]',
|
|
219
|
+
);
|
|
207
220
|
});
|
|
208
221
|
}
|
|
209
222
|
|
|
@@ -236,13 +249,11 @@ describe('Remix', () => {
|
|
|
236
249
|
|
|
237
250
|
beforeAll(async () => {
|
|
238
251
|
await runWizardOnRemixProject(projectDir, integration, (projectDir) => {
|
|
239
|
-
createFile(
|
|
240
|
-
`${projectDir}/server.mjs`,
|
|
241
|
-
SERVER_TEMPLATE,
|
|
242
|
-
);
|
|
252
|
+
createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);
|
|
243
253
|
|
|
244
254
|
modifyFile(`${projectDir}/package.json`, {
|
|
245
|
-
'"start": "remix-serve ./build/server/index.js"':
|
|
255
|
+
'"start": "remix-serve ./build/server/index.js"':
|
|
256
|
+
'"start": "node ./server.mjs"',
|
|
246
257
|
'"dev": "remix vite:dev"': '"dev": "node ./server.mjs"',
|
|
247
258
|
});
|
|
248
259
|
});
|
|
@@ -41,7 +41,14 @@ export async function handleError({ error, event }) {
|
|
|
41
41
|
}
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
async function runWizardOnSvelteKitProject(
|
|
44
|
+
async function runWizardOnSvelteKitProject(
|
|
45
|
+
projectDir: string,
|
|
46
|
+
integration: Integration,
|
|
47
|
+
fileModificationFn?: (
|
|
48
|
+
projectDir: string,
|
|
49
|
+
integration: Integration,
|
|
50
|
+
) => unknown,
|
|
51
|
+
) {
|
|
45
52
|
const wizardInstance = startWizardInstance(integration, projectDir);
|
|
46
53
|
let packageManagerPrompted = false;
|
|
47
54
|
|
|
@@ -49,9 +56,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
|
|
|
49
56
|
fileModificationFn(projectDir, integration);
|
|
50
57
|
|
|
51
58
|
// As we modified project, we have a warning prompt before we get the package manager prompt
|
|
52
|
-
await wizardInstance.waitForOutput(
|
|
53
|
-
'Do you want to continue anyway?',
|
|
54
|
-
);
|
|
59
|
+
await wizardInstance.waitForOutput('Do you want to continue anyway?');
|
|
55
60
|
|
|
56
61
|
packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(
|
|
57
62
|
[KEYS.ENTER],
|
|
@@ -59,7 +64,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
|
|
|
59
64
|
);
|
|
60
65
|
} else {
|
|
61
66
|
packageManagerPrompted = await wizardInstance.waitForOutput(
|
|
62
|
-
'Please select your package manager'
|
|
67
|
+
'Please select your package manager',
|
|
63
68
|
);
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -72,7 +77,7 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
|
|
|
72
77
|
'to track the performance of your application?',
|
|
73
78
|
{
|
|
74
79
|
timeout: 240_000,
|
|
75
|
-
}
|
|
80
|
+
},
|
|
76
81
|
));
|
|
77
82
|
|
|
78
83
|
const replayOptionPrompted =
|
|
@@ -100,10 +105,14 @@ async function runWizardOnSvelteKitProject(projectDir: string, integration: Inte
|
|
|
100
105
|
wizardInstance.kill();
|
|
101
106
|
}
|
|
102
107
|
|
|
103
|
-
function checkSvelteKitProject(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
function checkSvelteKitProject(
|
|
109
|
+
projectDir: string,
|
|
110
|
+
integration: Integration,
|
|
111
|
+
options?: {
|
|
112
|
+
devModeExpectedOutput: string;
|
|
113
|
+
prodModeExpectedOutput: string;
|
|
114
|
+
},
|
|
115
|
+
) {
|
|
107
116
|
test('should have the correct package.json', () => {
|
|
108
117
|
checkPackageJson(projectDir, integration);
|
|
109
118
|
});
|
|
@@ -113,14 +122,21 @@ function checkSvelteKitProject(projectDir: string, integration: Integration, opt
|
|
|
113
122
|
});
|
|
114
123
|
|
|
115
124
|
test('example page exists', () => {
|
|
116
|
-
checkFileExists(
|
|
117
|
-
|
|
125
|
+
checkFileExists(
|
|
126
|
+
path.resolve(projectDir, 'src/routes/sentry-example/+page.svelte'),
|
|
127
|
+
);
|
|
128
|
+
checkFileExists(
|
|
129
|
+
path.resolve(projectDir, 'src/routes/sentry-example/+server.js'),
|
|
130
|
+
);
|
|
118
131
|
});
|
|
119
132
|
|
|
120
133
|
test('vite.config contains sentry plugin', () => {
|
|
121
|
-
checkFileContents(
|
|
134
|
+
checkFileContents(
|
|
135
|
+
path.resolve(projectDir, 'vite.config.ts'),
|
|
136
|
+
`plugins: [sentrySvelteKit({
|
|
122
137
|
sourceMapsUploadOptions: {
|
|
123
|
-
|
|
138
|
+
`,
|
|
139
|
+
);
|
|
124
140
|
});
|
|
125
141
|
|
|
126
142
|
test('hook files created', () => {
|
|
@@ -129,15 +145,22 @@ function checkSvelteKitProject(projectDir: string, integration: Integration, opt
|
|
|
129
145
|
});
|
|
130
146
|
|
|
131
147
|
test('builds successfully', async () => {
|
|
132
|
-
await checkIfBuilds(projectDir
|
|
148
|
+
await checkIfBuilds(projectDir);
|
|
133
149
|
});
|
|
134
150
|
|
|
135
151
|
test('runs on dev mode correctly', async () => {
|
|
136
|
-
await checkIfRunsOnDevMode(
|
|
152
|
+
await checkIfRunsOnDevMode(
|
|
153
|
+
projectDir,
|
|
154
|
+
options?.devModeExpectedOutput || 'ready in',
|
|
155
|
+
);
|
|
137
156
|
});
|
|
138
157
|
|
|
139
158
|
test('runs on prod mode correctly', async () => {
|
|
140
|
-
await checkIfRunsOnProdMode(
|
|
159
|
+
await checkIfRunsOnProdMode(
|
|
160
|
+
projectDir,
|
|
161
|
+
options?.prodModeExpectedOutput || 'to expose',
|
|
162
|
+
'preview',
|
|
163
|
+
);
|
|
141
164
|
});
|
|
142
165
|
}
|
|
143
166
|
|
|
@@ -161,10 +184,9 @@ describe('Sveltekit', () => {
|
|
|
161
184
|
checkSvelteKitProject(projectDir, integration);
|
|
162
185
|
|
|
163
186
|
test('hooks.client.ts contains sentry', () => {
|
|
164
|
-
checkFileContents(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
`Sentry.init({
|
|
187
|
+
checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [
|
|
188
|
+
`import * as Sentry from '@sentry/sveltekit';`,
|
|
189
|
+
`Sentry.init({
|
|
168
190
|
dsn: '${TEST_ARGS.PROJECT_DSN}',
|
|
169
191
|
|
|
170
192
|
tracesSampleRate: 1.0,
|
|
@@ -179,22 +201,24 @@ describe('Sveltekit', () => {
|
|
|
179
201
|
|
|
180
202
|
// If you don't want to use Session Replay, just remove the line below:
|
|
181
203
|
integrations: [replayIntegration()],
|
|
182
|
-
});`,
|
|
204
|
+
});`,
|
|
205
|
+
'export const handleError = handleErrorWithSentry(',
|
|
206
|
+
]);
|
|
183
207
|
});
|
|
184
208
|
|
|
185
209
|
test('hooks.server.ts contains sentry', () => {
|
|
186
|
-
checkFileContents(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`import * as Sentry from '@sentry/sveltekit';`,
|
|
190
|
-
`Sentry.init({
|
|
210
|
+
checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [
|
|
211
|
+
`import * as Sentry from '@sentry/sveltekit';`,
|
|
212
|
+
`Sentry.init({
|
|
191
213
|
dsn: '${TEST_ARGS.PROJECT_DSN}',
|
|
192
214
|
|
|
193
215
|
tracesSampleRate: 1.0,
|
|
194
216
|
|
|
195
217
|
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
196
218
|
// spotlight: import.meta.env.DEV,
|
|
197
|
-
});`,
|
|
219
|
+
});`,
|
|
220
|
+
'export const handleError = handleErrorWithSentry();',
|
|
221
|
+
]);
|
|
198
222
|
});
|
|
199
223
|
});
|
|
200
224
|
|
|
@@ -206,17 +230,21 @@ describe('Sveltekit', () => {
|
|
|
206
230
|
);
|
|
207
231
|
|
|
208
232
|
beforeAll(async () => {
|
|
209
|
-
await runWizardOnSvelteKitProject(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
233
|
+
await runWizardOnSvelteKitProject(
|
|
234
|
+
projectDir,
|
|
235
|
+
integration,
|
|
236
|
+
(projectDir) => {
|
|
237
|
+
createFile(
|
|
238
|
+
path.resolve(projectDir, 'src/hooks.server.ts'),
|
|
239
|
+
SERVER_HOOK_TEMPLATE,
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
createFile(
|
|
243
|
+
path.resolve(projectDir, 'src/hooks.client.ts'),
|
|
244
|
+
CLIENT_HOOK_TEMPLATE,
|
|
245
|
+
);
|
|
246
|
+
},
|
|
247
|
+
);
|
|
220
248
|
});
|
|
221
249
|
|
|
222
250
|
afterAll(() => {
|
|
@@ -229,27 +257,28 @@ describe('Sveltekit', () => {
|
|
|
229
257
|
// These are removed from the common tests as the content is different
|
|
230
258
|
// when the hooks are merged instead of created from the template
|
|
231
259
|
test('hooks.client.ts contains sentry instrumentation', () => {
|
|
232
|
-
checkFileContents(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
`Sentry.init({
|
|
260
|
+
checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [
|
|
261
|
+
`import * as Sentry from '@sentry/sveltekit';`,
|
|
262
|
+
`Sentry.init({
|
|
236
263
|
dsn: "${TEST_ARGS.PROJECT_DSN}",
|
|
237
264
|
tracesSampleRate: 1,
|
|
238
265
|
replaysSessionSampleRate: 0.1,
|
|
239
266
|
replaysOnErrorSampleRate: 1,
|
|
240
267
|
integrations: [Sentry.replayIntegration()]
|
|
241
|
-
})`,
|
|
268
|
+
})`,
|
|
269
|
+
'export const handleError = Sentry.handleErrorWithSentry(',
|
|
270
|
+
]);
|
|
242
271
|
});
|
|
243
272
|
|
|
244
273
|
test('hooks.server.ts contains sentry init', () => {
|
|
245
|
-
checkFileContents(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
`Sentry.init({
|
|
274
|
+
checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [
|
|
275
|
+
`import * as Sentry from '@sentry/sveltekit';`,
|
|
276
|
+
`Sentry.init({
|
|
249
277
|
dsn: "${TEST_ARGS.PROJECT_DSN}",
|
|
250
278
|
tracesSampleRate: 1
|
|
251
|
-
})`,
|
|
279
|
+
})`,
|
|
280
|
+
'export const handleError = Sentry.handleErrorWithSentry();',
|
|
281
|
+
]);
|
|
252
282
|
});
|
|
253
283
|
});
|
|
254
284
|
});
|
|
255
|
-
|
package/e2e-tests/utils/index.ts
CHANGED
|
@@ -80,6 +80,36 @@ export class WizardTestEnv {
|
|
|
80
80
|
return outputPromise;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Waits for the task to exit with a given `statusCode`.
|
|
85
|
+
*
|
|
86
|
+
* @returns a promise that resolves to `true` if the run ends with the status
|
|
87
|
+
* code, or it rejects when the `timeout` was reached.
|
|
88
|
+
*/
|
|
89
|
+
waitForStatusCode(
|
|
90
|
+
statusCode: number | null,
|
|
91
|
+
options: {
|
|
92
|
+
/** Timeout in ms */
|
|
93
|
+
timeout?: number;
|
|
94
|
+
} = {},
|
|
95
|
+
) {
|
|
96
|
+
const { timeout } = {
|
|
97
|
+
timeout: 60_000,
|
|
98
|
+
...options,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
102
|
+
const timeoutId = setTimeout(() => {
|
|
103
|
+
reject(new Error(`Timeout waiting for status code: ${statusCode}`));
|
|
104
|
+
}, timeout);
|
|
105
|
+
|
|
106
|
+
this.taskHandle.on('exit', (code: number | null) => {
|
|
107
|
+
clearTimeout(timeoutId);
|
|
108
|
+
resolve(code === statusCode);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
83
113
|
/**
|
|
84
114
|
* Waits for the provided output with `.includes()` logic.
|
|
85
115
|
*
|
|
@@ -318,19 +348,16 @@ export function checkEnvBuildPlugin(projectDir: string) {
|
|
|
318
348
|
}
|
|
319
349
|
|
|
320
350
|
/**
|
|
321
|
-
* Check if the project builds
|
|
351
|
+
* Check if the project builds and ends with status code 0.
|
|
322
352
|
* @param projectDir
|
|
323
353
|
*/
|
|
324
|
-
export async function checkIfBuilds(
|
|
325
|
-
projectDir: string,
|
|
326
|
-
expectedOutput: string,
|
|
327
|
-
) {
|
|
354
|
+
export async function checkIfBuilds(projectDir: string) {
|
|
328
355
|
const testEnv = new WizardTestEnv('npm', ['run', 'build'], {
|
|
329
356
|
cwd: projectDir,
|
|
330
357
|
});
|
|
331
358
|
|
|
332
359
|
await expect(
|
|
333
|
-
testEnv.
|
|
360
|
+
testEnv.waitForStatusCode(0, {
|
|
334
361
|
timeout: 120_000,
|
|
335
362
|
}),
|
|
336
363
|
).resolves.toBe(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.39.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -926,7 +926,7 @@ async function createExamplePage(
|
|
|
926
926
|
* It's valuable enough to for users to justify asking the additional question.
|
|
927
927
|
*/
|
|
928
928
|
async function askShouldSetTunnelRoute() {
|
|
929
|
-
return await traceStep('ask-tunnelRoute-option', async () => {
|
|
929
|
+
return await traceStep('ask-tunnelRoute-option', async (span) => {
|
|
930
930
|
const shouldSetTunnelRoute = await abortIfCancelled(
|
|
931
931
|
clack.select({
|
|
932
932
|
message:
|
|
@@ -953,6 +953,9 @@ async function askShouldSetTunnelRoute() {
|
|
|
953
953
|
);
|
|
954
954
|
}
|
|
955
955
|
|
|
956
|
+
span?.setAttribute('tunnelRoute', shouldSetTunnelRoute);
|
|
957
|
+
Sentry.setTag('tunnelRoute', shouldSetTunnelRoute);
|
|
958
|
+
|
|
956
959
|
return shouldSetTunnelRoute;
|
|
957
960
|
});
|
|
958
961
|
}
|
|
@@ -267,13 +267,9 @@ export async function configureCI(
|
|
|
267
267
|
'create-react-app',
|
|
268
268
|
].includes(selectedTool);
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
const authTokenFile =
|
|
274
|
-
isCliBasedFlowTool || usesSentryCliRc
|
|
275
|
-
? SENTRY_CLI_RC_FILE
|
|
276
|
-
: SENTRY_DOT_ENV_FILE;
|
|
270
|
+
const authTokenFile = isCliBasedFlowTool
|
|
271
|
+
? SENTRY_CLI_RC_FILE
|
|
272
|
+
: SENTRY_DOT_ENV_FILE;
|
|
277
273
|
|
|
278
274
|
if (!isUsingCI) {
|
|
279
275
|
clack.log.info(
|
package/src/telemetry.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
setTag,
|
|
10
10
|
startSpan,
|
|
11
11
|
flush,
|
|
12
|
+
Span,
|
|
12
13
|
} from '@sentry/node';
|
|
13
14
|
import packageJson from '../package.json';
|
|
14
15
|
import { WizardOptions } from './utils/types';
|
|
@@ -110,9 +111,12 @@ function createSentryInstance(enabled: boolean, integration: string) {
|
|
|
110
111
|
return { sentryHub: hub, sentryClient: client };
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
export function traceStep<T>(
|
|
114
|
+
export function traceStep<T>(
|
|
115
|
+
step: string,
|
|
116
|
+
callback: (span: Span | undefined) => T,
|
|
117
|
+
): T {
|
|
114
118
|
updateProgress(step);
|
|
115
|
-
return startSpan({ name: step, op: 'wizard.step' }, () => callback());
|
|
119
|
+
return startSpan({ name: step, op: 'wizard.step' }, (span) => callback(span));
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
export function updateProgress(step: string) {
|
package/src/utils/clack-utils.ts
CHANGED
|
@@ -1096,9 +1096,10 @@ async function askForWizardLogin(options: {
|
|
|
1096
1096
|
|
|
1097
1097
|
if (!hasSentryAccount) {
|
|
1098
1098
|
loginUrl.searchParams.set('signup', '1');
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
if (options.platform) {
|
|
1102
|
+
loginUrl.searchParams.set('project_platform', options.platform);
|
|
1102
1103
|
}
|
|
1103
1104
|
|
|
1104
1105
|
if (options.promoCode) {
|
|
@@ -9,7 +9,6 @@ import { getPackageDotJson, updatePackageDotJson } from './clack-utils';
|
|
|
9
9
|
export interface PackageManager {
|
|
10
10
|
name: string;
|
|
11
11
|
label: string;
|
|
12
|
-
lockFile: string;
|
|
13
12
|
installCommand: string;
|
|
14
13
|
buildCommand: string;
|
|
15
14
|
/* The command that the package manager uses to run a script from package.json */
|
|
@@ -22,12 +21,14 @@ export interface PackageManager {
|
|
|
22
21
|
export const BUN: PackageManager = {
|
|
23
22
|
name: 'bun',
|
|
24
23
|
label: 'Bun',
|
|
25
|
-
lockFile: 'bun.lockb',
|
|
26
24
|
installCommand: 'bun add',
|
|
27
25
|
buildCommand: 'bun run build',
|
|
28
26
|
runScriptCommand: 'bun run',
|
|
29
27
|
flags: '',
|
|
30
|
-
detect: () =>
|
|
28
|
+
detect: () =>
|
|
29
|
+
['bun.lockb', 'bun.lock'].some((lockFile) =>
|
|
30
|
+
fs.existsSync(path.join(process.cwd(), lockFile)),
|
|
31
|
+
),
|
|
31
32
|
addOverride: async (pkgName, pkgVersion): Promise<void> => {
|
|
32
33
|
const packageDotJson = await getPackageDotJson();
|
|
33
34
|
const overrides = packageDotJson.overrides || {};
|
|
@@ -44,7 +45,6 @@ export const BUN: PackageManager = {
|
|
|
44
45
|
export const YARN_V1: PackageManager = {
|
|
45
46
|
name: 'yarn',
|
|
46
47
|
label: 'Yarn V1',
|
|
47
|
-
lockFile: 'yarn.lock',
|
|
48
48
|
installCommand: 'yarn add',
|
|
49
49
|
buildCommand: 'yarn build',
|
|
50
50
|
runScriptCommand: 'yarn',
|
|
@@ -52,7 +52,7 @@ export const YARN_V1: PackageManager = {
|
|
|
52
52
|
detect: () => {
|
|
53
53
|
try {
|
|
54
54
|
return fs
|
|
55
|
-
.readFileSync(path.join(process.cwd(),
|
|
55
|
+
.readFileSync(path.join(process.cwd(), 'yarn.lock'), 'utf-8')
|
|
56
56
|
.slice(0, 500)
|
|
57
57
|
.includes('yarn lockfile v1');
|
|
58
58
|
} catch (e) {
|
|
@@ -76,7 +76,6 @@ export const YARN_V1: PackageManager = {
|
|
|
76
76
|
export const YARN_V2: PackageManager = {
|
|
77
77
|
name: 'yarn',
|
|
78
78
|
label: 'Yarn V2/3/4',
|
|
79
|
-
lockFile: 'yarn.lock',
|
|
80
79
|
installCommand: 'yarn add',
|
|
81
80
|
buildCommand: 'yarn build',
|
|
82
81
|
runScriptCommand: 'yarn',
|
|
@@ -84,7 +83,7 @@ export const YARN_V2: PackageManager = {
|
|
|
84
83
|
detect: () => {
|
|
85
84
|
try {
|
|
86
85
|
return fs
|
|
87
|
-
.readFileSync(path.join(process.cwd(),
|
|
86
|
+
.readFileSync(path.join(process.cwd(), 'yarn.lock'), 'utf-8')
|
|
88
87
|
.slice(0, 500)
|
|
89
88
|
.includes('__metadata');
|
|
90
89
|
} catch (e) {
|
|
@@ -107,12 +106,11 @@ export const YARN_V2: PackageManager = {
|
|
|
107
106
|
export const PNPM: PackageManager = {
|
|
108
107
|
name: 'pnpm',
|
|
109
108
|
label: 'PNPM',
|
|
110
|
-
lockFile: 'pnpm-lock.yaml',
|
|
111
109
|
installCommand: 'pnpm add',
|
|
112
110
|
buildCommand: 'pnpm build',
|
|
113
111
|
runScriptCommand: 'pnpm',
|
|
114
112
|
flags: '--ignore-workspace-root-check',
|
|
115
|
-
detect: () => fs.existsSync(path.join(process.cwd(),
|
|
113
|
+
detect: () => fs.existsSync(path.join(process.cwd(), 'pnpm-lock.yaml')),
|
|
116
114
|
addOverride: async (pkgName, pkgVersion): Promise<void> => {
|
|
117
115
|
const packageDotJson = await getPackageDotJson();
|
|
118
116
|
const pnpm = packageDotJson.pnpm || {};
|
|
@@ -133,12 +131,11 @@ export const PNPM: PackageManager = {
|
|
|
133
131
|
export const NPM: PackageManager = {
|
|
134
132
|
name: 'npm',
|
|
135
133
|
label: 'NPM',
|
|
136
|
-
lockFile: 'package-lock.json',
|
|
137
134
|
installCommand: 'npm add',
|
|
138
135
|
buildCommand: 'npm run build',
|
|
139
136
|
runScriptCommand: 'npm run',
|
|
140
137
|
flags: '',
|
|
141
|
-
detect: () => fs.existsSync(path.join(process.cwd(),
|
|
138
|
+
detect: () => fs.existsSync(path.join(process.cwd(), 'package-lock.json')),
|
|
142
139
|
addOverride: async (pkgName, pkgVersion): Promise<void> => {
|
|
143
140
|
const packageDotJson = await getPackageDotJson();
|
|
144
141
|
const overrides = packageDotJson.overrides || {};
|