Repository navigation
fix(cli): remove punycode deprecation warnings #543
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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,5 @@ | ||
| --- | ||
| '@offckb/cli': patch | ||
| --- | ||
|
|
||
| Fix the DEP0040 punycode deprecation warning when starting the CLI on recent Node.js versions, including `offckb fiber status`. Patch the legacy node-fetch URL dependencies to use the userland punycode module while preserving HTTP proxy support. |
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,12 @@ | ||
| diff --git a/index.js b/index.js | ||
| index 9ce12ca2d026fa202f7a0d32e0a7c8526660ed78..7c3b5d7ff1624d2bfbb5b83f69a9b460e38dbeab 100644 | ||
| --- a/index.js | ||
| +++ b/index.js | ||
| @@ -1,6 +1,6 @@ | ||
| "use strict"; | ||
|
|
||
| -var punycode = require("punycode"); | ||
| +var punycode = require("punycode/"); | ||
| var mappingTable = require("./lib/mappingTable.json"); | ||
|
|
||
| var PROCESSING_OPTIONS = { |
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,11 @@ | ||
| diff --git a/lib/url-state-machine.js b/lib/url-state-machine.js | ||
| index c25dbc2c486289fbd7446baed24dc6343f0226f6..e1681d27501013c5e6aa9b720b32338c177b692c 100644 | ||
| --- a/lib/url-state-machine.js | ||
| +++ b/lib/url-state-machine.js | ||
| @@ -1,5 +1,5 @@ | ||
| "use strict"; | ||
| -const punycode = require("punycode"); | ||
| +const punycode = require("punycode/"); | ||
| const tr46 = require("tr46"); | ||
|
|
||
| const specialSchemes = { |
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
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,23 @@ | ||
| import { execFileSync, spawnSync } from 'child_process'; | ||
| import path from 'path'; | ||
|
|
||
| it('starts the bundled CLI without deprecation warnings', () => { | ||
| const root = path.resolve(__dirname, '..'); | ||
| // Build here because the test suite runs before the build step in CI. | ||
| execFileSync(process.execPath, [path.join(root, 'scripts/build.js')], { cwd: root, timeout: 120000 }); | ||
|
|
||
| const env = { ...process.env }; | ||
| delete env.NODE_OPTIONS; | ||
| delete env.NODE_NO_WARNINGS; | ||
|
|
||
| const result = spawnSync( | ||
| process.execPath, | ||
| ['--pending-deprecation', '--throw-deprecation', path.join(root, 'build/index.js'), '--help'], | ||
| { cwd: root, env, encoding: 'utf8', timeout: 15000 }, | ||
| ); | ||
|
|
||
| expect(result.error).toBeUndefined(); | ||
| expect(result.stderr).toBe(''); | ||
| expect(result.status).toBe(0); | ||
| expect(result.stdout).toContain('Usage: offckb'); | ||
| }, 120000); |
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.
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.
Add a regression test for the warning fix.
This PR adds no regression test.
docs/develop.mdrequires tests for fixes. (raw.githubusercontent.com) Add a test that runs the built CLI with--pending-deprecation --throw-deprecationand checks that startup succeeds withoutDEP0040.