asarazan / martok

https://www.npmjs.com/package/martok
10 stars 0 forks source link

breaks on Node 20 #83

Open janecakemaster opened 17 hours ago

janecakemaster commented 17 hours ago

our martok script stopped working when converting our project from node 16 to node 20

Generating types for sketchy...
/Users/jane/faceoff-backend/node_modules/martok/dist/typescript/MemberHelpers.js:71
        throw new Error(`Cannot find ${typeWithIssue} in ${source.fileName}`);
              ^
Error: Command failed: martok ./src/games/sketchy/types -o ../faceoff-mobile/shared/src/commonMain/kotlin/com/volley/faceoff/types/games/sketchy --package com.volley.faceoff.types.games.sketchy
martok <path>

Convert a file to kotlin

Options:
      --version             Show version number                        [boolean]
  -o, --out                 output file                                 [string]
  -p, --package             the kotlin package name[string] [default: "example"]
  -t, --dedupeTaggedUnions  Experimental feature that will try to remove any
                            component types of a tagged union and replace
                            references with the optimized class.
                                                      [boolean] [default: false]
  -s, --snakeToCamelCase    convert json-friendly snake_case to Kotlin-friendly
                            camelCase                 [boolean] [default: false]
  -a, --annotationNewLines  Aesthetic option to always put a newline between
                            annotations and declarations
                                                      [boolean] [default: false]
  -i, --importStar          Just throw in an import kotlinx.serialization.*
                                                      [boolean] [default: false]
      --help                Show help                                  [boolean]

Error: Cannot find object in /Users/jane/faceoff-backend/src/games/sketchy/types/Events.ts
    at getMemberType (/Users/jane/faceoff-backend/node_modules/martok/dist/typescript/MemberHelpers.js:71:15)
    at KlassGenerator.generateMemberOrCtorArg (/Users/jane/faceoff-backend/node_modules/martok/dist/martok/declarations/KlassGenerator.js:113:62)
    at /Users/jane/faceoff-backend/node_modules/martok/dist/martok/declarations/KlassGenerator.js:79:29
    at Array.map (<anonymous>)
    at KlassGenerator._generate (/Users/jane/faceoff-backend/node_modules/martok/dist/martok/declarations/KlassGenerator.js:78:34)
    at KlassGenerator.generate (/Users/jane/faceoff-backend/node_modules/martok/dist/martok/declarations/KlassGenerator.js:26:29)
    at /Users/jane/faceoff-backend/node_modules/martok/dist/martok/declarations/TaggedUnionGenerator.js:158:63
    at /Users/jane/faceoff-backend/node_modules/lodash/lodash.js:3585:27
    at /Users/jane/faceoff-backend/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/Users/jane/faceoff-backend/node_modules/lodash/lodash.js:3032:24)

here seems like its not able to resolve (typeof SketchyGame)['routes']

// src/games/sketchy/types/Events.ts
/**
 * @ignore
 */
import { SketchyGame } from '..';

/**
 * @expand
 */
export type SketchyEvents = EventsRecordToMartok<
  (typeof SketchyGame)['routes']
>;
asarazan commented 17 hours ago

Hi Jane nice to meet you! I'm traveling rn but I will def try to look into this shortly. Thanks for filing and say hi to the team for me!