-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add manifest path support to conditional reporter #206
Conversation
const getPackages = require('get-monorepo-packages'); | ||
const isInside = require('path-is-inside'); | ||
const minimatch = require('minimatch'); | ||
const _path = require('path'); |
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.
Why is it underscored?
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.
I believe this was because the original creator wanted to use path
as a variable 😅 .
I might just refactor the plugin to address the issues you mentioned
'' + | ||
pkg.package.name + | ||
(subPackagePath !== '.' ? '/' + subPackagePath : ''); | ||
const path = _path.parse(basePath).dir; |
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.
Just parse once
message: `Import for monorepo package '${pkg.package.name}' should be absolute.`, | ||
fix: (fixer) => { | ||
const basePath = | ||
'' + |
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.
Remove this?
return fixer.replaceText( | ||
node, | ||
"'" + | ||
(name !== '.' && name !== 'index' ? path + '/' + name : path) + |
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.
(name !== '.' && name !== 'index' ? path + '/' + name : path) + | |
(name !== '.' && name !== 'index' ? `${path}/${name}` : path) + |
|}; | ||
|
||
// Exported for testing | ||
export async function getConfig({ |
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.
/nit this can just be in its own file, then you don't need the comment and you can just read the reporter logic without worrying about config at a glance
logger: PluginLogger, | ||
tracer: PluginTracer, | ||
|}): Async<void> { | ||
const {filename} = await getConfig(options); |
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.
This should only be retrieved on buildSuccess
, otherwise it will slow down builds since reporter events are emitted all the time. Therefore, you can just have an early return when it's not a success event
packages/reporters/conditional-manifest/src/ConditionalManifestReporter.js
Show resolved
Hide resolved
4ce44f6
to
2bf59de
Compare
eaf7f43
to
3382ddf
Compare
Motivation
Add a configuration option to
package.json
so we can configure the path for the manifest. This is important as jira needs a separate directory for non-hashed file paths.Changes
Checklist