Skip to content
Open
Show file tree
Hide file tree
Changes from 13 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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunocroh i tried but nothing happened.

I think this is probably because of LF and CRLF thing. Changing that also didn't revert this change

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"[markdown]": {
"editor.wordWrap": "off"
}
}
}
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions recipes/crypto-fips/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# `crypto.fips` DEP0093

This recipe transforms the usage from the deprecated `crypto.fips` to `crypto.getFips()` and `crypto.setFips()`.

See [DEP0093](https://nodejs.org/api/deprecations.html#DEP0093).

## Examples

**Before:**

```js
import crypto from "node:crypto";
import { fips } from "node:crypto";

// Using crypto.fips
crypto.fips;
fips;

// Using crypto.fips = true
crypto.fips = true;
fips = true;

// Using crypto.fips = false
crypto.fips = false;
fips = false;
```

**After:**

```js
import crypto from "node:crypto";
import { getFips, setFips } from "node:crypto";

// Using crypto.getFips()
crypto.getFips();
getFips();

// Using crypto.setFips(true)
crypto.setFips(true);
setFips(true);

// Using crypto.setFips(false)
crypto.setFips(false);
setFips(false);
```
21 changes: 21 additions & 0 deletions recipes/crypto-fips/codemod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
schema_version: "1.0"
name: "@nodejs/crypto-fips"
version: 1.0.0
description: Handle DEP0093 via transforming `crypto.fips` to `crypto.getFips()` and `crypto.setFips()`
author: Usman S.
license: MIT
workflow: workflow.yaml
category: migration

targets:
languages:
- javascript
- typescript

keywords:
- transformation
- migration

registry:
access: public
visibility: public
24 changes: 24 additions & 0 deletions recipes/crypto-fips/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@nodejs/crypto-fips",
"version": "1.0.0",
"description": "Handle DEP0093 via transforming `crypto.fips` to `crypto.getFips()` and `crypto.setFips()`",
"type": "module",
"scripts": {
"test": "npx codemod jssg test -l typescript ./src/workflow.ts ./"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/userland-migrations.git",
"directory": "recipes/crypto-fips",
"bugs": "https://github.com/nodejs/userland-migrations/issues"
},
"author": "Usman S.",
"license": "MIT",
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/crypto-fips/README.md",
"devDependencies": {
"@codemod.com/jssg-types": "^1.0.3"
},
"dependencies": {
"@nodejs/codemod-utils": "*"
}
}
Loading
Loading