Skip to content

Commit

Permalink
Merge pull request #180 from modelix/feature/samples-with-model-client
Browse files Browse the repository at this point in the history
Feature/samples with model client
  • Loading branch information
odzhychko authored Nov 7, 2023
2 parents f38abce + 80627c6 commit 613e082
Show file tree
Hide file tree
Showing 80 changed files with 24,173 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
model-server:
# Keep the version in sync with the modelix version in gradle/libs.versions.toml
image: modelix/modelix-model:3.11.0
ports:
- 28101:28101
volumes:
- ./model-server/courses.modelserver.dump:/courses.modelserver.dump
command: ["./run-model-server.sh", "-inmemory", "-dumpin", "/courses.modelserver.dump"]
spa-overview-angular:
image: nginx
ports:
- 4200:80
volumes:
- ./spa-overview-angular/dist/spa-overview-angular:/usr/share/nginx/html
spa-management-vue:
image: nginx
ports:
- 3000:80
volumes:
- ./spa-management-vue/dist:/usr/share/nginx/html
7 changes: 6 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ specificlanguagesMps = "1.5.0"
mpsGradlePlugin = "1.7.288.4ea765f"

# modelix
# Keep the version in sync with the modelix version in
# * ../docker-compose.yaml
# * mps/metamodel-api-ts/package.json
# * spa-management-vue/package.json
# * spa-overview-angular/package.json
modelixCore = "3.11.0"
mpsModelServerSyncPlugin = "2021.2.145"
mpsModelServerSyncPlugin = "2021.2.157"

# backend 1 / SPA
ktor = "2.3.5"
Expand Down
210 changes: 153 additions & 57 deletions model-server/courses.modelserver.dump

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions mps/metamodel-api-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions mps/metamodel-api-ts/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@modelix:registry=https://artifacts.itemis.cloud/repository/npm-open
30 changes: 17 additions & 13 deletions mps/metamodel-api-ts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
// INFO: This sub-project is not yet used. It is included to show the generated TS files from the model-api-gen.
//
//
import com.github.gradle.node.npm.task.NpmTask

plugins {
application
alias(libs.plugins.kotlin.jvm)
base
alias(libs.plugins.node.gradle)
}

dependencies {
}

node {
download.set(true)
version.set(libs.versions.node)
}

//val npmRun by tasks.creating(com.github.gradle.node.npm.task.NpmTask::class) {
// dependsOn(tasks.getByName("build"))
// args.addAll("run-script", "ng", "serve")
//}
tasks.named("npm_run_build") {
dependsOn(":mps:generateMetaModelSources")
}

//tasks.getByName("build").dependsOn("npmInstall")
tasks.named<NpmTask>("npm_pack") {
val packageDirectory = project.layout.buildDirectory.dir("packages").get().asFile
dependsOn("npm_run_build")
doFirst {
packageDirectory.mkdirs()
}
args.addAll("--pack-destination", packageDirectory.path)
}

tasks.assemble {
dependsOn("npm_pack")
}
69 changes: 69 additions & 0 deletions mps/metamodel-api-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions mps/metamodel-api-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "metamodel-api-ts",
"version": "1.0.0",
"description": "TypeScript code generated from the meta model",
"main": "build/dist/index.js",
"types": "build/dist/index.d.ts",
"files": [
"build/dist"
],
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.2",
"typescript": "^5.1.6"
},
"dependencies": {
},
"peerDependencies": {
"@modelix/ts-model-api": "3.11.0"
}
}
12 changes: 12 additions & 0 deletions mps/metamodel-api-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": {
"outDir": "./build/dist",
"declaration": true,
"module": "esnext",
"moduleResolution": "bundler"
},
"include": [
"src/**/*"
]
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ include("rest-api-model-server")
//
// a single page application which can use any of the APIs
include("spa-dashboard-angular")
// a single page application which can write on the model through a model client
include("spa-management-vue")
include("spa-overview-angular")
4 changes: 4 additions & 0 deletions spa-management-vue/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
5 changes: 5 additions & 0 deletions spa-management-vue/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
17 changes: 17 additions & 0 deletions spa-management-vue/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
],
rules: {
'vue/multi-word-component-names': 'off',
"vue/valid-v-slot": ["error", {
"allowModifiers": false
}]
},
}
22 changes: 22 additions & 0 deletions spa-management-vue/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions spa-management-vue/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@modelix:registry=https://artifacts.itemis.cloud/repository/npm-open
11 changes: 11 additions & 0 deletions spa-management-vue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Compiles and hot-reloads for development

```sh
../gradlew :spa-management-vue:npm_run_dev
```

# Compiles and minifies for production

```sh
../gradlew :spa-management-vue:build
```
32 changes: 32 additions & 0 deletions spa-management-vue/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import com.github.gradle.node.npm.task.NpmTask

plugins {
base
alias(libs.plugins.node.gradle)
}

node {
download.set(true)
version.set(libs.versions.node)
}

val metamodelApiTsProject = project(":mps:metamodel-api-ts")
val metamodelApiTsPackagePath: String = metamodelApiTsProject.layout.buildDirectory
.file("packages/metamodel-api-ts-1.0.0.tgz").get().asFile.path

val updateMetaModelApiTs = tasks.register<NpmTask>("updateMetaModelApiTs") {
dependsOn(metamodelApiTsProject.tasks.assemble)
args.set(listOf("install", metamodelApiTsPackagePath))
}

tasks.npmInstall {
dependsOn(updateMetaModelApiTs)
}

tasks.assemble {
dependsOn("npm_run_build")
}

tasks.check {
dependsOn("npm_run_lint")
}
15 changes: 15 additions & 0 deletions spa-management-vue/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Course Management</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>

</html>
Loading

0 comments on commit 613e082

Please sign in to comment.