ivy-lang / ivy-bitcoin

A high-level language and IDE for writing Bitcoin smart contracts.
MIT License
293 stars 38 forks source link

Provide a command-line compiler (as its own npm package) #12

Closed knocte closed 5 years ago

knocte commented 6 years ago

Input files can be in any extension, and the output will just be sameFileName.tpl.

NOTE: chai and mocha were added as deps because otherwise it would throw:

$ ./node_modules/ts-node/dist/bin.js src/main.ts

/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/index.ts:329
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'chai'. (2688)
Cannot find type definition file for 'mocha'. (2688)
    at getOutput (/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/index.ts:329:15)
    at Object.compile (/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/index.ts:515:11)
    at Module.m._compile (/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/index.ts:402:43)
    at Module._extensions..js (module.js:646:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/index.ts:405:12)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at Object.<anonymous> (/Users/andres/Documents/Code/ivy-bitcoin/ivy-compiler/node_modules/ts-node/src/bin.ts:145:12)
knocte commented 5 years ago

@danrobinson should I care rebasing this PR or will you keep not reviewing it?

osoftware commented 5 years ago

This project is dead. You might want to fork it or take a look at Spedn and CashScript.

knocte commented 5 years ago

BCash? lol

danrobinson commented 5 years ago

Thanks for doing this—LGTM! If you don't mind rebasing it I can test it locally and then merge.

knocte commented 5 years ago

@danrobinson thanks for the feedback! I just rebased it.

knocte commented 5 years ago

@danrobinson ping?

canndrew commented 5 years ago

Is there any more work that needs to be done before ivy-bitcoin 0.0.34 can be published on the npm registry? It would make it easier to test this out.

danrobinson commented 5 years ago

Published version 0.0.34.

c410-f3r commented 5 years ago

@danrobinson The suggested changes were applied with the latest public ivy-bitcoin package.

knocte commented 5 years ago

@danrobinson The suggested changes were applied

@danrobinson ping

knocte commented 5 years ago

@danrobinson ping

canndrew commented 5 years ago

I ran npm update in the ivy-compiler dir. This fixed the build errors I was seeing so I've added a commit with the updated package-lock.json

knocte commented 5 years ago

@danrobinson ping :)

danrobinson commented 5 years ago

@knocte How would you feel about outputting to stdout by default, rather than a file? I don't have a strong preference but it seems more Unix-y.

Otherwise looks good to me!

canndrew commented 5 years ago

@danrobinson

Outputting to a file with a name based on the input file name is more compiler-y though. Not that I have a strong preference either.

knocte commented 5 years ago

Exactly, I don't know any unix-y compiler that outputs to stdout by default.

danrobinson commented 5 years ago

SGTM! Curious what you're planning to use this for. (Please don't use Ivy in production!)

canndrew commented 5 years ago

@danrobinson Would it be possible to publish ivy-compiler as it's own npm package?

danrobinson commented 5 years ago

@canndrew You could go ahead and do that yourself, couldn't you? Not sure you need me