-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nuxt): Improve logs about adding Node option 'import' #13726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -59,3 +59,29 @@ describe('findDefaultSdkInitFile', () => { | |||
expect(result).toBe('sentry.server.config.js'); | |||
}); | |||
}); | |||
|
|||
describe('getStringDiff', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l:
describe('getStringDiff', () => { | |
describe('getStringSuffixDiff', () => { |
expect(getStringSuffixDiff('', 'abc')).toBe(''); | ||
}); | ||
|
||
it('should return the suffix of the longer string when the shorter string is a prefix', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l (no action required): what happens if the longer string is shorter (but not empty) that the shorter string param? 😅
packages/nuxt/src/module.ts
Outdated
`[Sentry] Using your \`${serverConfigFile}\` file for the server-side Sentry configuration. In case you have a \`public/instrument.server\` file, the \`public/instrument.server\` file will be ignored. Make sure the file path in your node \`--import\` option matches the Sentry server config file in your \`.output\` folder and has a \`.mjs\` extension.`, | ||
); | ||
}); | ||
const serverConfigRelativePath = `.${getStringSuffixDiff(serverConfigPath, nitro.options.rootDir)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no strong opinions but shouldn't path.relative
basically do what you're trying to do here? (I might be missing something though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yes 😅
packages/nuxt/src/module.ts
Outdated
); | ||
}); | ||
// For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs | ||
const serverConfigRelativePath = `./${path.relative(nitro.options.rootDir, serverConfigPath)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use path.join
instead of ./
as the /
separator does not work in windows. In this case doesn't matter a ton, but always good to it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch with windows! I could not use path.join
in this case as this would not keep the folder name with the dot (.output
). But I was able to achieve this with .${path.sep}${path.relative(...)}
# Conflicts: # packages/nuxt/src/module.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the node option can be a confusing step. This adds a log output which already includes the correct file path to add. It looks like this: