Skip to content
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

Support modifying .yarnrc if has hidden attr #8410

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Changelog

<!-- -->

Please add one entry in this file for each change in Yarn's behavior. Use the same format for all entries, including the third-person verb. Make sure you don't add more than one line of text to keep it clean. Thanks!

## 1.22.12

- Support modifying .yarnrc if has hidden attr: https://github.com/yarnpkg/yarn/issues/4306

## 1.22.11

This version fixes a problem where Yarn wasn't forwarding SIGTERM to the binary spawned via `yarnPath`. It also makes `yarn init -2` compatible with [Corepack](https://github.com/nodejs/corepack). The behaviour of `yarn init` (without `-2`) doesn't change.
Expand Down Expand Up @@ -69,15 +75,15 @@ Those versions didn't contain any changes and were just triggered by our infra w
- Allows some dots in binary names again

[#7811](https://github.com/yarnpkg/yarn/pull/7811) - [**Valery Bugakov**](https://github.com/valerybugakov)

- Better error handling on `yarn set version`

[#7848](https://github.com/yarnpkg/yarn/pull/7848) - [**Nick Olinger**](https://github.com/olingern)

- Passes arguments following `--` when running a workspace script (`yarn workspace pkg run command -- arg`)

[#7776](https://github.com/yarnpkg/yarn/pull/7776) - [**Jeff Valore**](https://twitter.com/rally25rs)

- Fixes an issue where the archive paths were incorrectly sanitized

[#7831](https://github.com/yarnpkg/yarn/pull/7831) - [**Maël Nison**](https://twitter.com/arcanis)
Expand All @@ -99,7 +105,7 @@ Those versions didn't contain any changes and were just triggered by our infra w
- Implements `yarn init --install <version>`

[#7723](https://github.com/yarnpkg/yarn/pull/7723) - [**Maël Nison**](https://twitter.com/arcanis)

## 1.19.2

- Folders like `.cache` won't be pruned from the `node_modules` after each install.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yarn",
"installationMethod": "unknown",
"version": "1.23.0-0",
"version": "1.23.1-0",
"license": "BSD-2-Clause",
"preferGlobal": true,
"description": "📦🐈 Fast, reliable, and secure dependency management.",
Expand Down
16 changes: 14 additions & 2 deletions src/util/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const constants =
export const lockQueue = new BlockingQueue('fs lock');

export const readFileBuffer = promisify(fs.readFile);
export const open: (path: string, flags: string, mode?: number) => Promise<Array<string>> = promisify(fs.open);
export const open: (path: string, flags: string, mode?: number) => Promise<number> = promisify(fs.open);
export const close: (fd: number) => Promise<void> = promisify(fs.close);
export const ftruncate: (fd: number) => Promise<void> = promisify(fs.ftruncate);
export const write: (fd: number, data: string | Buffer) => Promise<void> = promisify(fs.write);
export const writeFile: (path: string, data: string | Buffer, options?: Object) => Promise<void> = promisify(
fs.writeFile,
);
Expand Down Expand Up @@ -786,7 +789,16 @@ export async function writeFilePreservingEol(path: string, data: string): Promis
if (eol !== '\n') {
data = data.replace(/\n/g, eol);
}
await writeFile(path, data);

if (os.platform() === 'win32' && await exists(path)) {
// Support modifying the file if has hidden attr
const fd = await open(path, "r+");
await ftruncate(fd);
await write(fd, data);
await close(fd);
} else {
await writeFile(path, data);
}
}

export async function hardlinksWork(dir: string): Promise<boolean> {
Expand Down