forked from finos/morphir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfered all Documentation from Morphir-elm repo
- Loading branch information
1 parent
52a5990
commit 791817c
Showing
41 changed files
with
4,970 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Contribution Guide | ||
|
||
The purpose of this document is to make it easier for new contributors to get up-to-speed on the project. | ||
|
||
## Project Setup | ||
|
||
### JavaScript Tooling | ||
|
||
The project uses Node.js and NPM as the runtime and package manager. You can download them from | ||
[this link](https://nodejs.org/en/download/). | ||
|
||
We use [Gulp](https://gulpjs.com/) as our build tool. You can use NPM to install it: | ||
|
||
``` | ||
npm install -g gulp | ||
``` | ||
|
||
### Elm Tooling | ||
|
||
The easiest way to install the Elm tooling is using NPM. Here's a list of Elm tools we use: | ||
|
||
- `npm install -g elm` | ||
- `npm install -g elm-test` | ||
- `npm install -g elm-format` | ||
- `npm install -g elm-live` | ||
|
||
#### Installing an elm-format git pre-commit hook | ||
|
||
If you wish to run elm-format on files that you are commiting to git, copy the following script to morphir-elm/.git/pre-commit and make it executable: | ||
|
||
``` | ||
#!/usr/bin/env bash | ||
STAGED_ELM_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep ".elm$") | ||
# If any elm-format command fails, exit immediately with that command's exit status | ||
set -eo pipefail | ||
if [[ -n "$STAGED_ELM_FILES" ]] ; then | ||
GIT_DIR=$(pwd) | ||
# Run elm-format against staged elm files for this commit | ||
for ELM_FILE in $STAGED_ELM_FILES ; do | ||
ELM_PATH="$GIT_DIR/$ELM_FILE" | ||
elm-format --yes "$ELM_PATH" | ||
done | ||
fi | ||
``` | ||
|
||
By default elm-format will be run for each file ending in '.elm', when they are commited. | ||
If you don't wish to run elm-format, use the '--no-verify' option with your commit command. | ||
|
||
### IDE | ||
|
||
Most contributors are using [IntelliJ](https://www.jetbrains.com/idea/download) with the | ||
[Elm plugin](https://plugins.jetbrains.com/plugin/10268-elm). [VS Code](https://code.visualstudio.com/download) with the | ||
[Elm plugin](https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode) is another popular choice. | ||
|
||
## Learning Material | ||
|
||
In order to contribute to this project you need to be familiar with Elm and understand some language processing / compiler concepts that are core to Morphir. | ||
We collected a series of learning materials for you to make it easier to fill any knowledge gaps. Feel free to skip any of these if you feel like you are an expert. | ||
If you have any doubts though it's better to glance through them. We included the length of each video so that you understand the amount of effort involved. | ||
|
||
- Programming in Elm | ||
- Language Overview | ||
- [Official language guide](https://guide.elm-lang.org/) | ||
- [Quick overview of Elm with comparisons to JavaScript](https://www.youtube.com/watch?v=um0jxfgboNo) (10 mins) | ||
- [Longer overview with a focus on how Elm makes your app more reliable](https://www.youtube.com/watch?v=kEitFAY7Gc8) (45 mins) | ||
- Working with Types | ||
- [Chapter on Types from the official language guide](https://guide.elm-lang.org/types/) | ||
- [Elm type system basics](https://www.youtube.com/watch?v=F_bx2J8En9w) (2 mins) | ||
- [Algebraic Data Types](https://www.youtube.com/watch?v=JYWJzaiCtEw) (10 mins) | ||
- [Deeper dive into how types can help you](https://www.youtube.com/watch?v=memIRXFSNkU) (30 mins) | ||
- Language processing | ||
- Abstract Syntax Trees | ||
- [Intro](https://www.youtube.com/watch?v=jpfaXK4xCYE) (3 mins) | ||
- [Deeper dive](https://www.youtube.com/watch?v=VKM1eLoN-gI) (12 mins) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
This document describes how maintainers can push new releases of `morphir-elm` into NPM and the Elm package repo. | ||
|
||
# Publishing the Elm package | ||
|
||
The latest elm tooling (0.19.1) has some [issues with large docs](https://github.com/elm/compiler/issues?q=is%3Aissue+is%3Aopen+loading+docs) which impacts `finos/morphir-elm`. Because of this we had to turn-off the automation so the publishing can only be done manually by a maintainer. | ||
|
||
Here are the steps: | ||
|
||
1. Clone the `finos/morphir-elm` repo to a local workspace. Make sure that it's not a clone of your fork but a clone of the main repo. | ||
2. Make sure that the clone is up-to-date and you are on the `main` branch. | ||
3. Run `elm bump`. | ||
4. If this fails with the `PROBLEM LOADING DOCS` error you will have to use an older version of Elm. | ||
5. You can install the previous version using `npm install -g [email protected]`. | ||
6. Run `elm bump` again. | ||
7. This will update the `elm.json` so you need to add an commit it: | ||
- `git add elm.json` | ||
- `git commit -m "Bump Elm package version"` | ||
8. Now you need to create a tag that matches the Elm package version: | ||
- `git tag -a <elm_package_version> -m "new Elm package release"` | ||
- `git push origin <elm_package_version>` | ||
9. Now you are ready to publish the Elm package: | ||
- `elm publish` | ||
|
||
|
||
# Publishing the NPM package | ||
|
||
1. Clone the `finos/morphir-elm` github repo or pull the latest from the master branch if you have a clone already. | ||
``` | ||
git clone https://github.com/finos/morphir-elm.git | ||
``` | ||
or | ||
``` | ||
git pull origin master | ||
``` | ||
2. Build the CLI. | ||
``` | ||
npm run build | ||
``` | ||
3. Run `np` for publishing. | ||
- If you don't have `np` installed yet, install it with `npm install -g np` | ||
4. `np` will propmpt you to select the next semantic version number so you'll have to decide if your changes are major, minor or patch. | ||
- **Note**: `np` might say that there has not been any commits. This is normal if you just published the Elm package since it picks up | ||
the tag from that one. It is safe to respond `y` to that question because the rest of the process will use the version number from the | ||
`package.json` and push a tag with a prefix `v` so it does not collide with Elm which does not use a prefix. | ||
5. `np` will also ask you for credentials. | ||
# Verification Instructions | ||
The purpose of this document is to provide a detailed explanation of how to verify a new released version of ```morphir-elm```. The following instructions are to be followed after every release in order to make sure that the release is valid. | ||
### Who this Guide is Designed For | ||
1. Business users of Morphir who would want to update the morphir-elm version to the latest release | ||
2. Developers who would want to verify the validity of a release | ||
### Upgrading ```morphir-elm``` to the latest version | ||
- Run ```npm install morphir-elm``` to upgrade to the latest version. This is the only step you need as a business user to upgrade to a new release of ```morphir-elm``` | ||
### Verifying a ```morphir-elm``` release | ||
After upgrade, a series of commands must be run on a model to verify the release, below are steps to create a minimal model. | ||
#### Creating a Model | ||
This is to create a sample model to validate the release. The sample model is called ```schedule``` | ||
Create a directory: | ||
``` | ||
mkdir schedule | ||
cd schedule | ||
``` | ||
Next setup the Morphir project and configuration file, morphir.json | ||
``` | ||
mkdir src | ||
echo '{ "name": "Morphir.Example.App", "sourceDirectory": "src", "exposedModules": [ ] }' > morphir.json | ||
``` | ||
Next create the Elm file we would be working with | ||
``` | ||
mkdir src/Morphir | ||
mkdir src/Morphir/Example | ||
touch src/Morphir/Example/Schedule.elm | ||
``` | ||
Next update the ```morphir.json``` to reflect the current module. | ||
``` | ||
{ | ||
"name": "Morphir.Example", | ||
"sourceDirectory": "src", | ||
"exposedModules": [ | ||
"Schedule" | ||
] | ||
} | ||
``` | ||
Finally, to finish up the model paste the following logic in Schedule.elm | ||
``` | ||
module Morphir.Example.Schedule exposing (..) | ||
|
||
|
||
plan : String -> String | ||
plan day = | ||
"Work Day" | ||
|
||
``` | ||
Now we have minimal model to run commands on. Run the following commands to verify a release. | ||
- Run ```Run morphir-elm make``` to verify that an IR(```morphir-ir.json```) is created. | ||
- Use the ```-o,--output``` flag to specify the location where the Morphir IR will be saved (default: ```morphir-ir.json```) | ||
- Use ```-p,--project-dir``` flag to specify the root directory where the ```morphir.json``` is located. | ||
- Create ```morphir-tests.json``` in the same directory as ```morphir-ir.json```. This would contain tests generated from the Morphir Develop UI. | ||
- Run ```morphir-elm develop -o localhost``` and in your browser navigate to ```http://localhost:3000``` to access the UI | ||
- Create and save tests using the Morphir develop UI | ||
- Run ```morphir-elm test``` tests in your terminal to validate that all tests pass. | ||
- Run ```morphir-elm gen``` to generate target code. Default code generated is Scala. To change the target language generated use the ```-t``` option. Eg. ```morhir-elm gen -t TypeScript```. | ||
- Run ```morphir-elm gen -c true``` to copy the dependencies used by the generated code to the output path | ||
- Run ```morphir-stats``` to generate feature statistics. This command generates a folder ```stats``` which contains information about features available in the IR | ||
## Rollback Instructions | ||
In the case where an invalid version is published , the developer has to rollback to a previous working version on npm. This involves changing the ```latest``` tag on npm to point to a previous working version. | ||
- Go to [Morphir Elm](https://www.npmjs.com/package/morphir-elm) , click on the versions tab. The last working version is usually a version behind the latest version released. You can find version numbers under ```Version History``` | ||
- Run the command ```npm dist-tag add morphir-elm@<version> latest``` | ||
This command tags the version specified as the ```latest``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Morphir Developers' Guide | ||
The purpose of the document is to provide a detailed explanation of how various Morphir code artefacts work. | ||
It also documents the standard coding practices adopted for the Morphir project. | ||
Finally, it provides a step by step walk-throughs on how various Morphir components are build. | ||
|
||
### Who this Guide Designed For | ||
1. New joiners to the Morphir project to get up to speed the various building blocks of Morphir | ||
2. Existing team members intending to improve their abilities on Language Design concepts | ||
|
||
##Content | ||
1. [Getting Started with Morphir](../README.md) <br> | ||
2. [Overview of Morphir](#) | ||
3. [The Morphir Architecture](#) <br> | ||
4. [The Morphir SDK](#) <br> | ||
5. [Morphir Commands Processing](Morphir-elm Commands Processing) <br> | ||
1. [morphir-elm make](#) <br> | ||
2. [morphir-elm gen](#) <br> | ||
3. [morphir-elm test](#) <br> | ||
4. [morphir-elm develop](#) <br> | ||
6. [Interoperability With JavaScript](#) <br> | ||
7. [Testing Framework](#) <br> | ||
1. [CSV testing guide ](files/spark-testing-framework.md) | ||
8. [The Morphir IR](#) <br> | ||
1. [Overview of the Morphir IR](#) <br> | ||
2. [Distribution](#) <br> | ||
3. [Package](#) <br> | ||
4. [Module](#) <br> | ||
5. [Types](#) <br> | ||
6. [Values](#) <br> | ||
7. [Names](#) <br> | ||
9. [The Morphir Frontends](#) <br> | ||
1. [Elm Frontend](#) <br> | ||
2. [Elm Incremental Frontend](#) <br> | ||
10. [The Morphir Backends](#) <br> | ||
1. [Scala Backend](files/scala-backend.md) | ||
2. [Spark Backend](files/spark-backend.md) | ||
3. [Relational IR Backends](files/relational-backend.md) | ||
4. [Scala Json Codecs Backend](files/scala-backend.md) | ||
5. [Json Schema Backend](files/json-schema-mappings.md) | ||
11. [Working with CODECS](#) <br> | ||
1. [Introduction to Encoding/Decoding](#) <br> | ||
2. [JSON Decoder Building Blocks](#) <br> | ||
3. [Combining Decoders](#) <br> | ||
4. [JSON Decode Pipeline](#) <br> | ||
5. [Writing Encoders and Decoders in Elm](#) <br> | ||
6. [Standard Codecs in Morphir](#) <br> | ||
12. [NPM and Elm Packages](#) <br> | ||
13. [Introduction to Combinator Parsing in Scala](#) <br> | ||
1. [Overview of Combinator Parsing](#) <br> | ||
2. [Parser or Basic Arithmetic Expression](#) <br> | ||
3. [Implementing Parsers in Scala](#) <br> | ||
4. [Regular Expressions Parser](#) <br> | ||
5. [JSON Parser](#) <br> | ||
6. [Low-Level Pull Parser API](#) <br> | ||
|
Oops, something went wrong.