eeue56 / derw

An Elm-inspired language that transpiles to TypeScript
BSD 3-Clause "New" or "Revised" License
378 stars 9 forks source link

Unable to run sample test #5

Closed zainhoda closed 2 years ago

zainhoda commented 2 years ago
[nix-shell:~/git/derw-playground]$ npx derw test
Compiling package...
Generating 2 files...
Processed: [ 'src/sample.derw', 'src/sample_test.derw' ]
Looking for tsconfig...
Looking for tests in src/**/*...
Found /Users/zain/git/derw-playground/src/sample_test.ts
(node:71715) UnhandledPromiseRejectionWarning: TSError: ⨯ Unable to compile TypeScript:
src/sample_test.ts:1:24 - error TS2307: Cannot find module 'Test' or its corresponding type declarations.

1 import { equals } from "Test";
                         ~~~~~~

    at createTSError (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:750:12)
    at reportTSError (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:754:19)
    at getOutput (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:941:36)
    at Object.compile (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:1243:30)
    at Module.m._compile (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:1370:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/zain/git/derw-playground/node_modules/ts-node/src/index.ts:1374:12)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:71715) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:71715) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I separately installed @eeue56/bach so I'm not sure exactly what I'm missing.

eeue56 commented 2 years ago

Can you share the code for the derw files?

zainhoda commented 2 years ago

Sure: Archive.zip

eeue56 commented 2 years ago

Got it - so right now, the way you import packages is actually like:

import "../derw-packages/derw-lang/stdlib/src/Test" exposing (equals)

testMath: boolean -> void
testMath a? =
    equals 1 1

The path is relative to the file it's running from. Later on this will be simpler

zainhoda commented 2 years ago

Thank you! Is there a standard way to install derw packages?

eeue56 commented 2 years ago

Yep, if you do derw install --name derw-lang/stdlib --version main it'll add that package with that git reference to the derw-package.json and grab it from github