Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,5 @@ typings/

### Manually ignored files
/src/main/resources/public/
/src/frontend/src/braze-model.d.ts
**/*.mv.db
7 changes: 7 additions & 0 deletions .idea/compiler.xml

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

5 changes: 4 additions & 1 deletion .idea/misc.xml

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

33 changes: 28 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@file:Suppress("HasPlatformType", "PropertyName")

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
var kotlinVersion: String by extra
kotlinVersion = "1.3.20"
kotlinVersion = "1.3.21"

repositories {
mavenCentral()
Expand All @@ -20,9 +22,9 @@ plugins {
idea
maven

kotlin("jvm") version "1.3.20"
kotlin("plugin.spring") version "1.3.20"
kotlin("plugin.jpa") version "1.3.20"
kotlin("jvm") version "1.3.21"
kotlin("plugin.spring") version "1.3.21"
kotlin("plugin.jpa") version "1.3.21"

id("org.springframework.boot") version "2.0.4.RELEASE"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
Expand All @@ -36,6 +38,7 @@ val retrofitVersion = "2.4.0"
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}

dependencies {
Expand All @@ -55,11 +58,15 @@ dependencies {

compile("com.h2database", "h2")

compile("com.github.ntrrgc", "ts-generator", "1.1.1")

testCompile("org.testng", "testng", "6.14.3")
testCompile("org.springframework", "spring-test")
testCompile("org.springframework.boot", "spring-boot-starter-test")
}

// todo: replace with tasks{} block

val bootJar by tasks.getting
val assemble by tasks.getting
val install by tasks.getting
Expand All @@ -74,11 +81,23 @@ val cleanStatic by tasks.creating(Delete::class) {
delete("src/main/resources/public")
}

val generateDefinitions by tasks.creating(JavaExec::class) {
classpath = sourceSets["main"].runtimeClasspath
main = "com.forresthopkinsa.braze.model.TypeDefGeneratorKt"
standardOutput = File(buildDir, "braze-model.d.ts").outputStream()
}

val copyDefinitions by tasks.creating(Copy::class) {
dependsOn(generateDefinitions)
from(File(buildDir, "braze-model.d.ts"))
destinationDir = File(projectDir, "src/frontend/src")
}

npm_run_build.dependsOn(cleanStatic)

bootJar.mustRunAfter(npm_run_build)

assemble.dependsOn(npm_run_build)
assemble.dependsOn(npm_run_build, copyDefinitions)

install.dependsOn(assemble)

Expand All @@ -90,6 +109,10 @@ tasks.withType<Test> {
useTestNG()
}

springBoot {
mainClassName = "com.forresthopkinsa.braze.spring.ApplicationKt"
}

node {
nodeModulesDir = file("${project.projectDir}/src/frontend")
}
Expand Down
1 change: 1 addition & 0 deletions src/frontend/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/dist/
/*.js
/test/unit/coverage/
**/braze-model.d.ts
39 changes: 21 additions & 18 deletions src/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
// https://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
parserOptions: {
project: './tsconfig.json',
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
'plugin:vue/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier',
'prettier/@typescript-eslint',
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
plugins: ['@typescript-eslint', 'prettier'],
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
'no-param-reassign': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
settings: {
'import/resolver': {
webpack: {
config: 'build/webpack.base.conf.js',
},
},
},
};
4 changes: 4 additions & 0 deletions src/frontend/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: "es5"
}
1 change: 1 addition & 0 deletions src/frontend/build/vue-loader.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
sourceMap: sourceMapEnabled,
extract: isProduction
}),
esModule: true,
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
Expand Down
14 changes: 11 additions & 3 deletions src/frontend/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function resolve (dir) {
}

const createLintingRule = () => ({
test: /\.(js|vue)$/,
test: /\.(ts|js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
Expand All @@ -22,7 +22,7 @@ const createLintingRule = () => ({
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
app: './src/main.ts'
},
output: {
path: config.build.assetsRoot,
Expand All @@ -32,7 +32,7 @@ module.exports = {
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
extensions: ['.ts', '.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
Expand All @@ -46,6 +46,14 @@ module.exports = {
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
appendTsSuffixTo: [/\.vue$/]
}
},
{
test: /\.js$/,
loader: 'babel-loader',
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,

// these devServer options should be customized in /config/index.js
// these devServer options should be customized in /config/index.ts
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
Expand Down
Loading