-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(install): lifecycle script changes #8943
Conversation
❌ @dylan-conway 1 files with test failures on bun-darwin-aarch64: |
❌ @dylan-conway 1 files with test failures on linux-x64: |
❌ @dylan-conway 1 files with test failures on linux-x64-baseline: |
❌ @dylan-conway 2 files with test failures on bun-darwin-x64:
|
❌🪟 @dylan-conway, there are 12 test regressions on Windows x86_64
|
src/js_ast.zig
Outdated
@@ -1458,6 +1458,23 @@ pub const E = struct { | |||
|
|||
return array; | |||
} | |||
|
|||
/// debug.assert the array only contains strings before calling |
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.
can you make this an actual debug assert for this function. or uh, i see you do a runtime check for that... so is it an assertion or? i'd like osmething better than this comment
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.
Moved the debug assert inside this function. Also did the same for alphabetizeProperties
. Originally I had the runtime check for extra safety
src/install/lockfile.zig
Outdated
// 0 - package from old lockfile, needs update | ||
// 1 - does not have install scripts | ||
// 2 - has install scripts | ||
__has_install_script: u8, |
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.
instead of a magic number, can this be an enum(u8)
. it would also be nice to add this into the comment on line 4709 when we bump the lockfile version, we should reorder this to:
also proper documentation comments are ///
but that is less relevant.
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.
switched to enum
|
||
await rm(join(packageDir, "node_modules", "electron", "preinstall.txt"), { force: true }); | ||
|
||
// lockfile should save evenn though there are no changes to trustedDependencies due to |
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.
// lockfile should save evenn though there are no changes to trustedDependencies due to | |
// lockfile should save even though there are no changes to trustedDependencies due to |
else => return, | ||
else => { | ||
if (comptime Environment.allow_assert) { | ||
@panic("bad"); |
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.
bad
Co-authored-by: Jarred Sumner <[email protected]>
What does this PR do?
Breaking change: if
trustedDependencies
exists in package.json, bun install will no longer pull from the default list and will only run scripts from thetrustedDependencies
list. If the list is empty, then no scripts will run. The default trusted dependencies list is only used whentrustedDependencies
does not exist in package.json.--trust
. This flags tellsbun add
to automatically trust the dependency and all it's dependencies, running their lifecycle scripts and adding totrustedDependencies
in package.json.warning for skipped lifecycle scripts
file:.
path inpackage.json
dependencies #8899Also included in this pr is
bun pm trusted
. This command without any args will print the current trusted and untrusted dependencies with scripts:If you provide package names, they will be added to
trustedDependencies
and their scripts will run. In the example above, runningbun pm trust es5-ext
will add this to your package.json:You can also pass
--all
to trust all available untrusted dependencies, and--default
to list the default trusted dependencies list.The breaking changes in this pr will be disabled until
v1.1.0
.How did you verify your code works?
new and existing tests