Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.92 KB

CONTRIBUTING.md

File metadata and controls

53 lines (33 loc) · 1.92 KB

Contributing

Contributions are always welcome, no matter how large or small.

Running the project

After clonning the codebase, you can install the dependencies, build it, and run it locally:

npm install
npm run build
./bin/elm-generate somecommand

You can also install the npm dependency globally from the local repo:

npm -g install .

Testing

Run all the tests with:

npm run test

You may also run test:unit and test:functional separetly.

The unit tests test individual functions and files, while the functional tests are more end-to-end: it installs the Spades CLI and simulates a user creating a project and executing some commands.

Architecture

Spades is basically split in three parts: the boilerplate, the templates and the transformers.

The boilerplate is the base application that is generated with the elm-generate app command, it is fully-working a standalone aplication, which means that you can run it separelety if you wish to make changes to it.

To run the boilerplate:

cd boilerplate
npm install
npm start

The templates are .ejs template files that are copied into the user's project when it needs a new file, with placeholders to some variables such as the generated component name, they live under src/templates.

The transformers are responsible for updating existing files, such as adding a new route to the routes file. This is a much more complex task as we have to be sure to not generate invalid Elm code as a result.

For creating the transformers we use the elm-syntax library, which decodes Elm codes into an AST where we transform the code, and then encodes it back into valid Elm code.

Everything is then coupled together by the CLI in the src/index.js file by using the commander.js library.