Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nwokafor-choongsaeng committed Jan 30, 2024
2 parents 955f84d + 39ca775 commit f023918
Show file tree
Hide file tree
Showing 130 changed files with 16,366 additions and 3,115 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,51 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache NPM
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Elm
uses: actions/cache@v3
with:
path: ~/.elm
key: ${{ runner.os }}-elm-${{ hashFiles('**/elm.json') }}
restore-keys: |
${{ runner.os }}-elm-
${{ runner.os }}-elm-
- name: Download dependencies
run: npm ci

- name: Build
run: npm run build --if-present

- name: Running Test
run: npm test

# CVE scanning
# CVE scanning
cvescan:
name: CVE Scanning
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand All @@ -76,7 +76,7 @@ jobs:
# Skip any PR created by dependabot to avoid permission issues
if: (github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: semgrep scan --config auto --severity ERROR
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ redistributable/Scala
cli/web/insightapp.js
cli/treeStuff.js
cli/index.html
cli2/lib/
lib/geneated
cadl-Frontend/cadl-output
Morphir.Elm.CLI.js
Morphir.Elm.Generator.js
docs.json
/.coverage/
tests-integration/reference-model/Dockerfile
tests-integration/reference-model/Dockerfile

.scala-build/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ structure follows the structure of the IR. Here's a list of concepts in a top-do

## Contributing

[Contribution Guide](docs/contribution-guide.md)
[Contribution Guide](CONTRIBUTING.md)

1. Fork it (<https://github.com/finos/morphir-elm/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
Expand All @@ -206,7 +206,7 @@ _NOTE:_ Commits and pull requests to FINOS repositories will only be accepted fr

### Publishing new releases

[Steps for publishing a new release](docs/publishing.md)
[Steps for publishing a new release](publishing.md)

## License

Expand Down
12 changes: 10 additions & 2 deletions cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ async function gen(input, outputPath, options) {
opts.limitToModules = options.modulesToInclude ? options.modulesToInclude.split(",") : null
opts.includeCodecs = options.includeCodecs ? true : false
opts.filename = options.filename == '' ? '' : options.filename
const fileMap = await generate(opts, JSON.parse(morphirIrJson.toString()))

if (options.decorations) {
if (await fileExist(path.resolve(options.decorations))) {
options.decorationsObj = JSON.parse(await readFile(path.resolve(options.decorations)))
}
}

const fileMap = await generate(opts, JSON.parse(morphirIrJson.toString()))
const writePromises =
fileMap.map(async ([
[dirPath, fileName], content
Expand Down Expand Up @@ -134,7 +140,9 @@ function copyRedistributables(options, outputPath) {
copyScalaFeature('core')
} else if (options.target == 'TypeScript') {
copyFiles('TypeScript/', outputPath)
}
} else if (options.target == 'Snowpark') {
copyFiles('Snowpark/', outputPath)
}
}

function copyRecursiveSync(src, dest) {
Expand Down
5 changes: 4 additions & 1 deletion cli/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"elm/regex": "1.0.0",
"elm/svg": "1.0.1",
"elm/url": "1.0.0",
"elm/time": "1.0.0",
"elm-community/array-extra": "2.6.0",
"elm-community/graph": "6.0.0",
"elm-community/list-extra": "8.7.0",
Expand All @@ -30,6 +31,7 @@
"lattyware/elm-fontawesome": "6.0.0",
"matthewsj/elm-ordering": "2.0.0",
"mdgriffith/elm-ui": "1.1.8",
"perzanko/elm-loading": "2.0.5",
"pzp1997/assoc-list": "1.0.0",
"rundis/elm-bootstrap": "5.2.0",
"stil4m/elm-syntax": "7.2.9"
Expand All @@ -39,11 +41,12 @@
"avh4/elm-fifo": "1.0.4",
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3",
"elm-community/intdict": "3.0.0",
"miniBill/elm-unicode": "1.0.3",
"myrho/elm-round": "1.0.5",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-css": "17.1.1",
"rtfeldman/elm-hex": "1.0.0",
"stil4m/structured-writer": "1.0.3"
}
Expand Down
17 changes: 16 additions & 1 deletion cli/morphir-elm-develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const webDir = path.join(__dirname, "web");


app.use(express.static(webDir, { index: false }));
app.use(express.json());
app.use(express.json({limit: "100mb"}));

app.get("/", wrap(async (req, res, next) => {
res.setHeader('Content-type', 'text/html')
Expand Down Expand Up @@ -102,6 +102,21 @@ app.post(
})
);

app.post(
"/server/morphir-ir.json",
wrap(async (req, res, next) => {
const morphirIRJsonPath = path.join(
program.opts().projectDir,
"morphir-ir.json"
);
var jsonContent = JSON.stringify(req.body, null, 4);
await writeFile(morphirIRJsonPath, jsonContent);
const morphirIRJsonContent = await readFile(morphirIRJsonPath);
const morphirIRJson = JSON.parse(morphirIRJsonContent.toString());
res.send(morphirIRJson);
})
);

app.get("*", wrap(async (req, res, next) => {
res.setHeader('Content-type', 'text/html')
res.send(await indexHtmlWithVersion());
Expand Down
1 change: 1 addition & 0 deletions cli/morphir-elm-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ program
.option('-s, --include-codecs', 'Generate JSON codecs', false)
.option('-f, --filename <filename>', 'Filename of the generated JSON Schema.', '')
.option('-ls, --include <comma.separated,list.of,strings>', 'Limit what will be included.', '')
.option('-dec, --decorations <filename>', 'JSON file with decorations')
.parse(process.argv)

cli.gen(program.opts().input, path.resolve(program.opts().output), program.opts())
Expand Down
3 changes: 2 additions & 1 deletion cli/morphir-elm-make.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ program
.option('-o, --output <path>', 'Target file location where the Morphir IR will be saved.', 'morphir-ir.json')
.option('-t, --types-only', 'Only include type information in the IR, no values.', false)
.option('-f, --fallback-cli', 'Use old cli make function.', false)
.option('-i, --indent-json', 'Use indentation in the generated JSON file.', false)
.parse(process.argv)

const programOptions = program.opts()
Expand All @@ -43,7 +44,7 @@ function make(projectDir, opts) {
cli.make(projectDir, opts)
.then((packageDef) => {
console.log(`Writing file ${opts.output}.`)
cli.writeFile(opts.output, JSON.stringify(packageDef, null, 4))
cli.writeFile(opts.output, JSON.stringify(packageDef, null, opts.indentJson ? 4 : 0))
.then(() => {
console.log('Done.')
})
Expand Down
10 changes: 8 additions & 2 deletions cli/src/Morphir/Elm/CLI.elm
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,14 @@ update msg model =
let
resultIR : Result Decode.Error Distribution
resultIR =
distributionJson
|> Decode.decodeValue DistributionCodec.decodeVersionedDistribution
case distributionJson |> Decode.decodeValue DistributionCodec.decodeVersionedDistribution of
Ok packageDist ->
case packageDist of
Library packageName dependencies packageDef ->
Ok (Library packageName (Dict.union Frontend.defaultDependencies dependencies) packageDef)

Err err ->
Err err
in
case resultIR of
Ok ir ->
Expand Down
8 changes: 8 additions & 0 deletions cli/src/Morphir/Elm/Target.elm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Morphir.SpringBoot.Backend.Codec
import Morphir.TypeScript.Backend
import Morphir.TypeSpec.Backend
import Morphir.TypeSpec.Backend.Codec
import Morphir.Snowpark.Backend



Expand All @@ -34,6 +35,7 @@ type BackendOptions
| SparkOptions Morphir.Scala.Spark.Backend.Options
| JsonSchemaOptions Morphir.JsonSchema.Backend.Options
| TypeSpecOptions Morphir.TypeSpec.Backend.Options
| SnowparkOptions Morphir.Snowpark.Backend.Options


decodeOptions : Result Error String -> Decode.Decoder BackendOptions
Expand All @@ -53,6 +55,9 @@ decodeOptions gen =

Ok "Spark" ->
Decode.map SparkOptions (Decode.succeed Morphir.Scala.Spark.Backend.Options)

Ok "Snowpark" ->
Decode.map SnowparkOptions Morphir.Snowpark.Backend.decodeOptions

Ok "JsonSchema" ->
Decode.map JsonSchemaOptions Morphir.JsonSchema.Backend.Codec.decodeOptions
Expand Down Expand Up @@ -85,6 +90,9 @@ mapDistribution back dist =

SparkOptions options ->
Ok <| Morphir.Spark.Backend.mapDistribution options dist

SnowparkOptions options ->
Ok <| Morphir.Snowpark.Backend.mapDistribution options dist

JsonSchemaOptions options ->
Morphir.JsonSchema.Backend.mapDistribution options dist
Expand Down
Loading

0 comments on commit f023918

Please sign in to comment.