Contributing to Spectral: how to run from source?

I’d like to contribute to spectral. The CONTRIBUTING file shows me how to install the dependencies and run the tests, but not how to run the tool. How can I run spectral from local source to try things out on my development platform? I’m am experienced programmer but not exactly nodejs-native and I’m lost.

Hey @lornajane!

You are totally right. The contributing doc does gloss over that part, and I will work on fixing that.

In the meanwhile, are you looking to use it from the CLI or programmatically within JavaScript program?

To build it for the CLI option (which I am assuming is what a lot of people really want):

yarn build
cd dist
bin/run lint my-openapi-file.json

I’m running through the steps for it programmatically right now to make sure I don’t lead you down the wrong path for that one.

Thanks, and you saw my patch on the docs. Just noting that something interesting happened with your “Sign in with GitHub” link and now I have @github1 as a username … Do youi want me to report this somewhere?

@lornajane I tried to figure out why this happened, but no idea. I haven’t seen this bug before. I’m going to keep watching it. If you have another one you want to use, we can change your username manually to something else.

I’d like “@lornajane” please since that’s my github username

@lornajane just fixed it!

1 Like

Did something change? I’m getting errors about oclif when I try to run from source now. Including the things I think I should need manually in package.json isn’t helping. Even trying to run dist/bin/run help gives me a command lint not found error. Advice appreciated! I will also try installing the tool from npm but I’d like to be able to contribute as well as consume.

@lornajane It looks like our contributing docs are a little out of date, but you should just be able to run:

yarn build
node dist/cli/index.js lint /path/to/spec.json

(assuming you’re running from develop) I’ll open an issue on the contributing docs.