-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat(fs-truncate-fd-deprecation
): introduce
#135
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
Open
AugustinMauroy
wants to merge
32
commits into
main
Choose a base branch
from
feat(`fs-truncate-fs-depreciation`)
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4349931
scaffold codemod
AugustinMauroy c4dd3ba
add first draft
AugustinMauroy b46d7af
fix: typo
AugustinMauroy 9e0365a
refracto to use AST
AugustinMauroy a4d4938
refracto
AugustinMauroy aa4a23d
WARNING: edge-case
AugustinMauroy 13c2ddc
WIP
AugustinMauroy f989d4f
clean chore files
AugustinMauroy 095b88a
improve security
AugustinMauroy ef62f5c
chore(`codemod.yaml`): use righ file ext + correct scope
AugustinMauroy b406468
Update workflow.ts
AugustinMauroy 062b329
scaffold codemod
AugustinMauroy ac59325
add first draft
AugustinMauroy 83c0cf8
fix: typo
AugustinMauroy 7d4665c
refracto to use AST
AugustinMauroy f4250a1
refracto
AugustinMauroy 8a7741e
WARNING: edge-case
AugustinMauroy 2441b8e
WIP
AugustinMauroy 88e8c25
clean chore files
AugustinMauroy b84169d
improve security
AugustinMauroy f631355
chore(`codemod.yaml`): use righ file ext + correct scope
AugustinMauroy cbf2867
Update workflow.ts
AugustinMauroy 9a52487
Merge branch 'feat(`fs-truncate-fs-depreciation`)' of https://github.…
AugustinMauroy d2864ff
Update package-lock.json
AugustinMauroy 0745ea3
Merge branch 'main' into feat(`fs-truncate-fs-depreciation`)
AugustinMauroy 48a64f8
Update workflow.ts
AugustinMauroy 0da4e0d
Merge branch 'main' into feat(`fs-truncate-fs-depreciation`)
AugustinMauroy 0cd173d
Update package-lock.json
AugustinMauroy ca0bd07
update
AugustinMauroy d286fa9
fix
AugustinMauroy b193d74
Update workflow.ts
AugustinMauroy 3f1655e
Merge branch 'main' into feat(`fs-truncate-fs-depreciation`)
AugustinMauroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# DEP0081: `fs.truncate()` using a file descriptor | ||
|
||
This recipe transforms the usage of `fs.truncate()` to `fs.ftruncateSync()` when a file descriptor is used. | ||
|
||
See [DEP0081](https://nodejs.org/api/deprecations.html#DEP0081). | ||
|
||
## Example | ||
|
||
**Before:** | ||
```js | ||
const { truncate, open, close } = require('node:fs'); | ||
|
||
open('file.txt', 'w', (err, fd) => { | ||
if (err) throw err; | ||
truncate(fd, 10, (err) => { | ||
if (err) throw err; | ||
close(fd, () => {}); | ||
}); | ||
}); | ||
``` | ||
|
||
**After:** | ||
```js | ||
const { ftruncate, open, close } = require('node:fs'); | ||
|
||
open('file.txt', 'w', (err, fd) => { | ||
if (err) throw err; | ||
ftruncate(fd, 10, (err) => { | ||
if (err) throw err; | ||
close(fd, () => {}); | ||
}); | ||
}); | ||
``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
schema_version: "1.0" | ||
name: "@nodejs/fs-truncate-fd-deprecation" | ||
version: 1.0.0 | ||
description: Handle DEP0081 via transforming `truncate` to `ftruncateSync` when using a file descriptor. | ||
author: Augustin Mauroy | ||
license: MIT | ||
workflow: workflow.yaml | ||
category: migration | ||
|
||
targets: | ||
languages: | ||
- javascript | ||
- typescript | ||
|
||
keywords: | ||
- transformation | ||
- migration | ||
|
||
registry: | ||
access: public | ||
visibility: public |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "@nodejs/fs-truncate-fd-deprecation", | ||
"version": "1.0.0", | ||
"description": "Handle DEP0081 via transforming `truncate` to `ftruncateSync` when using a file descriptor.", | ||
"type": "module", | ||
"scripts": { | ||
"test": "npx codemod@next jssg test -l typescript ./src/workflow.ts ./" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/nodejs/userland-migrations.git", | ||
"directory": "recipes/fs-truncate-fd-deprecation", | ||
"bugs": "https://github.com/nodejs/userland-migrations/issues" | ||
}, | ||
"author": "Augustin Mauroy", | ||
"license": "MIT", | ||
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/fs-truncate-fd-deprecation/README.md", | ||
"devDependencies": { | ||
"@codemod.com/jssg-types": "^1.0.3" | ||
}, | ||
"dependencies": { | ||
"@nodejs/codemod-utils": "*" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.