-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat!: add packageManger information + make jsWorkspace packagePaths relative #4643
Conversation
5b91787
to
8185a24
Compare
9a340ae
to
b8112d9
Compare
b8112d9
to
5f7629c
Compare
5f3f37c
to
b9befb8
Compare
"main": "./lib/main.js", | ||
"types": "./lib/main.d.ts", | ||
"exports": { | ||
".": "./lib/index.js" |
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.
restrict subpath imports (this should help to not introduce breaking changes that easily)
Only functions that are exported from lib/index.js
are public api surface
import { exit, argv } from 'process' | ||
|
||
import yargs, { Arguments } from 'yargs' |
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 is the entrypoint you should use with ESModules according to the documentation:
Which has a slightly different api on the .command
https://github.com/yargs/yargs
@@ -23,7 +23,7 @@ export type ContextOptions = { | |||
|
|||
export type Context = { | |||
projectDir: string | |||
rootDir: string | |||
rootDir?: string |
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.
The root dir must not be set (could be only projectDir
as well in the regular case of being not a mono repository)
@@ -0,0 +1 @@ | |||
export { getBuildInfo } from './get-build-info.js' |
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 is now the only public API surface we expose every change to this function signature is considered breaking.
All other functions are not on the API surface (except the behaviour is changed)
b9befb8
to
558415b
Compare
558415b
to
f85cd7c
Compare
Assuming a user specifies the NETLIFY_USE_YARN env variable but then specifes pnpm in package.json's |
Yea but we cannot do better there the env variable needs to override (to not break excisting behaviours) but corepack only respects that. Once this is out we don't need the environment variables anymore. or what would be your suggestion |
This pull request adds or modifies JavaScript ( |
We have enough information to detect the clash between the environment variable and the packageManager field. We could either
|
Would love to get @JGAntunes ideas here as we cannot log here to the user (currently) The log output is used to print just the json out. We have multiple options:
like if os.Getenv("NETLIFY_USE_PNPM") == "true" && info.PackageManager.Name != "pnpm" {
b.ClientLog.Errorf("We've detected that you are setting the NETLIFY_USE_PNPM environment variable but you are not using pnpm instead you are using %s", info.PackageManager.Name)
} Inside buildbot we can still control which package manager needs to be used |
This is what I was thinking as well. |
@jobala But then this PR should be good to go? |
We could also have this module return an array of detected package managers which could work based on precedence? (Similar to framework-info - https://github.com/netlify/framework-info) Buildbot could then act based on that output (say, if we've detected you have |
Created 2332 to track the issue ⬆️ |
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.
Left a comment/question. Not a blocker at all 👍
} | ||
|
||
// find the correct lock file the tree up | ||
const lockFilePath = await findUp(Object.keys(lockFileMap), { cwd }) |
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.
We have access to the repo's root. If provided shall we stop searching at that level?
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 point will adapt 👍
…relative (#4643) * feat!: add packageManger information + make jsWorkspace packagePaths relative * chore: add further tests * chore: fix typo * chore: updates * chore: latest discussions * chore: fix tests on windows and old node * chore: add stopAt parameter for look up * chore: clean up
🎉 Thanks for submitting a pull request! 🎉
Summary
This is needed for https://github.com/netlify/pillar-workflow/issues/895
This is a breaking change as we changed the jsWorkspace paths to be relatives than absolute ones.
The breaking change won't have an influence in buildbots usage as we just check if the property is present. There are no other users of
@netlify/build-info
at the moment in our organization:For us to review and ship your PR efficiently, please perform the following steps:
we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
something that`s on fire 🔥 (e.g. incident related), you can skip this step.
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)