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

updating to node 20 #69

Merged
merged 2 commits into from
Sep 12, 2023
Merged

updating to node 20 #69

merged 2 commits into from
Sep 12, 2023

Conversation

tegefaulkes
Copy link
Contributor

@tegefaulkes tegefaulkes commented Sep 12, 2023

Description

In this PR we are updating to node 20. This includes nix changes and package updates.

Issues Fixed

  • This doesn't directly fix any issues

Tasks

  1. Update nix config to use node 20.
  2. Update node dependencies to the appropriate versions. Using js-quic as reference.
  3. Build js-db with the new versions.
  4. Make sure all tests are working.

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@ghost
Copy link

ghost commented Sep 12, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@tegefaulkes
Copy link
Contributor Author

Looks like almost everything is working. All but two tests are failing.

  1. parallelized batch put and del
  2. parallelized get and put and del

With the following errors.

GLOBAL SETUP

/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/dist/transpilers/swc.js:202
            throw new Error(`${swcDepName} threw an error when attempting to validate swc compiler options.\n` +
            ^

Error: @swc/core threw an error when attempting to validate swc compiler options.
You may be using an old version of swc which does not support the options used by ts-node.
Try upgrading to the latest version of swc.
Error message from swc:
Failed to deserialize buffer as swc::config::Options
JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"commonjs","strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"decorators":true,"dynamicImport":true,"importAssertions":true},"target":"es2022","transform":{"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":true,"experimental":{"keepImportAssertions":true}}}

Caused by:
    unknown field `keepImportAssertions`, expected one of `plugins`, `keepImportAttributes`, `emitAssertForImportAttributes`, `cacheRoot`, `disableBuiltinTransformsForInternalTesting` at line 1 column 413
    at createVariant (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:262:13)
    at createSwcOptions (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:211:25)
    at create (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:56:41)
    at createTranspiler (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:784:16)
    at createTranspileOnlyGetOutputFunction (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:1341:28)
    at createFromPreloadedConfig (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:1404:34)
    at create (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:624:10)
    at Object.register (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:591:15)
    at Object.<anonymous> (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/register/transpile-only.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)

/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/dist/transpilers/swc.js:202
            throw new Error(`${swcDepName} threw an error when attempting to validate swc compiler options.\n` +
            ^

Error: @swc/core threw an error when attempting to validate swc compiler options.
You may be using an old version of swc which does not support the options used by ts-node.
Try upgrading to the latest version of swc.
Error message from swc:
Failed to deserialize buffer as swc::config::Options
JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"commonjs","strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"decorators":true,"dynamicImport":true,"importAssertions":true},"target":"es2022","transform":{"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":true,"experimental":{"keepImportAssertions":true}}}

Caused by:
    unknown field `keepImportAssertions`, expected one of `plugins`, `keepImportAttributes`, `emitAssertForImportAttributes`, `cacheRoot`, `disableBuiltinTransformsForInternalTesting` at line 1 column 413
    at createVariant (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:262:13)
    at createSwcOptions (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:211:25)
    at create (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/transpilers/swc.ts:56:41)
    at createTranspiler (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:784:16)
    at createTranspileOnlyGetOutputFunction (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:1341:28)
    at createFromPreloadedConfig (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:1404:34)
    at create (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:624:10)
    at Object.register (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/src/index.ts:591:15)
    at Object.<anonymous> (/home/faulkes/matrixcode/polykey/js-db/node_modules/ts-node/register/transpile-only.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)

I'm still looking into this.

@CMCDragonkai
Copy link
Member

You also need to update all scripts to support node 20 too. See MatrixAI/js-async-init@300d01e

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Sep 12, 2023

Should also update .eslintrc MatrixAI/js-async-init@7679c5b

You also need to update js-errors:

    "@matrixai/errors": "^1.2.0",

The js-async-init staging is on ESM. Use the 1.9.x series.

The js-errors staging is on ESM. Use the 1.2.x series.

@CMCDragonkai
Copy link
Member

If your swc is broken, try:

rm -rf ./node_modules
rm package-lock.json
exit
nix-shell

If that doesn't work, do the same thing but also delete rm -rf ~/.npm.

@tegefaulkes
Copy link
Contributor Author

AS per MatrixAI/js-workers#13, @swc/core needs to be pinned to 1.3.82

This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.
@tegefaulkes
Copy link
Contributor Author

tegefaulkes commented Sep 12, 2023

Looks good, merging. I'll update the `js-workers dep in staging. getting a headstart on CI.

@tegefaulkes tegefaulkes marked this pull request as ready for review September 12, 2023 07:33
@tegefaulkes tegefaulkes merged commit 1af93de into staging Sep 12, 2023
1 check passed
@CMCDragonkai
Copy link
Member

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants