fromdeno / deno2node

Compile your Deno project to run on Node.js.
MIT License
115 stars 3 forks source link

Replace `fixMissingImports()` with `"shim"` option #7

Closed wojpawlik closed 3 years ago

wojpawlik commented 3 years ago

Fixes #4. Try it out: $ deno run --unstable --allow-read --allow-write https://raw.githubusercontent.com/wojpawlik/deno2node/shim/src/cli.ts <tsConfigFilePath>

KnorpelSenf commented 3 years ago

Is is supposed to compile this project's main branch?

~/git/deno2node$ deno run --unstable --allow-read --allow-write https://raw.githubusercontent.com/wojpawlik/deno2node/shim/src/cli.ts src/tsconfig.json 
src/cli.ts:4:5 - error TS2304: Cannot find name 'Deno'.

4 if (Deno.args.length !== 1 || Deno.args[0].startsWith("-")) {
      ~~~~
src/cli.ts:4:31 - error TS2304: Cannot find name 'Deno'.

4 if (Deno.args.length !== 1 || Deno.args[0].startsWith("-")) {
                                ~~~~
src/cli.ts:6:3 - error TS2304: Cannot find name 'Deno'.

6   Deno.exit(2);
    ~~~~
src/cli.ts:9:23 - error TS2304: Cannot find name 'Deno'.

9 emitAndExit(deno2node(Deno.args[0]));
                        ~~~~
src/emit_and_exit.ts:6:33 - error TS2322: Type 'any' is not assignable to type 'never'.

6   if (diagnostics.length === 0) return Deno.exit(0);
                                  ~~~~~~~~~~~~~~~~~~~~
src/emit_and_exit.ts:6:40 - error TS2304: Cannot find name 'Deno'.

6   if (diagnostics.length === 0) return Deno.exit(0);
                                         ~~~~
src/emit_and_exit.ts:9:3 - error TS2322: Type 'any' is not assignable to type 'never'.

9   return Deno.exit(1);
    ~~~~~~~~~~~~~~~~~~~~
src/emit_and_exit.ts:9:10 - error TS2304: Cannot find name 'Deno'.

9   return Deno.exit(1);
           ~~~~

Found 8 errors.
wojpawlik commented 3 years ago

No, it's marked [breaking] for a reason :)

CI passed, but if you wanna build it anyway:

$ git switch shim
$ npm run prepare

I'd rather you tried using it on grammy.

KnorpelSenf commented 3 years ago

Works smoothly on grammY runner :rocket: