adonisjs / upgrade-kit

CLI tool for migrating from Adonis.js 5 to Adonis.js 6
MIT License
5 stars 3 forks source link

Migrate from import assertion to import attribution #11

Open codmajik opened 3 months ago

codmajik commented 3 months ago

Package version

1.5.0

Describe the bug

NodeJS v22 dropped import assertion completely according to NodeJS docs, this was deprecated on v18.20 and completely dropped in v22. image

Due to this, running the upgrade kit on anything above v21 will cause a syntax error as show in the screenshot image

Reproduction repo

No response

RomainLanz commented 3 months ago

Hey @codmajik! 👋🏻

I am not sure I understand the table correctly, does that mean we can freely use the with syntax in older Node.js versions?

guledali commented 2 months ago

I'm getting this as well

Node.js v22.3.0

dmazoli commented 2 months ago

Same here, trying to run upgrade-kit at an adonis 5.8.0 project.

` npx @adonisjs/upgrade-kit upgrade-packages --path={{pathToProject}} file:///usr/local/lib/node_modules/@adonisjs/upgrade-kit/node_modules/@adonisjs/ace/build/src/helpers.js:3 import schema from '../schemas/command_metadata_schema.json' assert { type: 'json' }; ^^^^^^

SyntaxError: Unexpected identifier 'assert' at compileSourceTextModule (node:internal/modules/esm/utils:337:16) at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18) at callTranslator (node:internal/modules/esm/loader:436:14) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:30)

Node.js v22.7.0 `

zakariamehbi commented 2 months ago

Working like a charm with the LTS version of node.

CodeSyncr commented 2 weeks ago

+1

file:///Users/yashkumar/.npm/_npx/632aa895c0dbb5b6/node_modules/@adonisjs/ace/build/src/helpers.js:3 import schema from '../schemas/command_metadata_schema.json' assert { type: 'json' }; ^^^^^^

SyntaxError: Unexpected identifier 'assert' at compileSourceTextModule (node:internal/modules/esm/utils:340:16) at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18) at #translate (node:internal/modules/esm/loader:433:12)

Using Latest LTS v22.11.0
CodeSyncr commented 2 weeks ago

Temporary solution would be nvm use 21