luis vor 6 Jahren
Commit
b140ba4634

+ 18 - 0
.boiler/config.yml

@@ -0,0 +1,18 @@
+description: My personal backend/frontend project structure
+vars: 
+  - {name: binary, default: '{{.projName}}'}
+  - {name: author}
+  - {name: email}
+  - {name: maingo, default: '{{.binary}}/cmd/main.go', question: 'main go file'}
+generators:
+ gofile:
+    aliases: [.go]
+    description: Creates a go file based on template                   # Description for --help
+    files:                                                             # Files or folders to be processed, these files are relative to $PROJROOT/.boiler/template/...
+      - {source: gofile.go.boiler, target: "{{.curdir}}/{{.name}}"}    # Target is processed with template
+    vars:                                                              # List of variables for unit creation
+      - name: package                                                  # Var name {{.package}}
+        default: "{{.projName}}"                                       # Default value 
+        flag: "package, p"                                             # command flags to set this var
+        question: package name of the new file                         # question to be shown on interactive input
+        description: Package to place on package thing                 # description of the var '--help'

+ 0 - 0
.boiler/templates/gofile.go.boiler


+ 37 - 0
Makefile.boiler

@@ -0,0 +1,37 @@
+
+all: DIST/{{.binary}} 
+
+clean:
+	rm -rf DIST
+
+DIST:
+	mkdir -p DIST
+
+DIST/{{.binary}}: DIST
+	cd go;make
+	cp go/DIST/* DIST/
+
+
+frontend/node_modules:
+	cd frontend; yarn
+frontend/dist: flow-ui/node_modules
+	cd frontend; yarn build
+
+
+backend: DIST/{{.binary}}
+frontend: {{.frontend}}/dist
+
+dev: clean backend
+	tmux split "DEBUG=1 DIST/{{.binary}};$$SHELL"
+	cd frontend; yarn dev
+
+test: 
+	make -C go test
+
+generate:
+	make -C go generate
+
+
+
+.PHONY: all clean frontend backend builder generate DIST/{{.binary}} 
+

+ 1 - 0
env.sh

@@ -0,0 +1 @@
+export GOPATH=$(pwd)/go/deps;GOPATH=$(pwd)/go

+ 6 - 0
frontend/.babelrc

@@ -0,0 +1,6 @@
+{
+  "presets": [
+    ["env", { "modules": false }],
+    "stage-3"
+  ]
+}

+ 9 - 0
frontend/.editorconfig

@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true

+ 7 - 0
frontend/.eslintrc.js

@@ -0,0 +1,7 @@
+module.exports = {
+  extends: [ 'standard', 'plugin:vue/recommended'],
+  rules: {
+    'vue/valid-v-model':'warning',
+    'vue/attribute-hyphenation':'none'
+  }
+}

+ 12 - 0
frontend/.gitignore

@@ -0,0 +1,12 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log
+yarn-error.log
+
+# Editor directories and files
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln

+ 18 - 0
frontend/README.md

@@ -0,0 +1,18 @@
+# frontend
+
+> desc
+
+## Build Setup
+
+``` bash
+# install dependencies
+npm install
+
+# serve with hot reload at localhost:8080
+npm run dev
+
+# build for production with minification
+npm run build
+```
+
+For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).

+ 11 - 0
frontend/index.html.boiler

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+		<title>{{.projName}}</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script src="/dist/build.js"></script>
+  </body>
+</html>

+ 42 - 0
frontend/package.json.boiler

@@ -0,0 +1,42 @@
+{
+  "name": "{{.projName}}",
+  "description": "desc",
+  "version": "1.0.0",
+  "author": "{{.author}} {{.email}}",
+  "license": "MIT",
+  "private": true,
+  "scripts": {
+    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
+    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
+  },
+  "dependencies": {
+    "vue": "^2.5.11"
+  },
+  "browserslist": ["> 1%", "last 2 versions", "not ie <= 8"],
+  "devDependencies": {
+    "babel-core": "^6.26.0",
+    "babel-loader": "^7.1.2",
+    "babel-preset-env": "^1.6.0",
+    "babel-preset-stage-3": "^6.24.1",
+    "cross-env": "^5.0.5",
+    "css-loader": "^0.28.7",
+    "file-loader": "^1.1.4",
+    "node-sass": "^4.5.3",
+    "sass-loader": "^6.0.6",
+    "vue-loader": "^13.0.5",
+    "vue-template-compiler": "^2.4.4",
+    "webpack": "^3.6.0",
+    "webpack-dev-server": "^2.9.1",
+    "eslint": "^4.16.0",
+    "eslint-config-esnext": "2.0.0",
+    "eslint-config-node": "^2.0.0",
+    "eslint-config-standard": "^11.0.0-beta.0",
+    "eslint-plugin-babel": "^4.1.2",
+    "eslint-plugin-import": "^2.8.0",
+    "eslint-plugin-node": "^5.2.1",
+    "eslint-plugin-promise": "^3.6.0",
+    "eslint-plugin-standard": "^3.0.1",
+    "eslint-plugin-vue": "^4.2.0",
+ 
+  }
+}

+ 60 - 0
frontend/src/App.vue

@@ -0,0 +1,60 @@
+<template>
+  <div id="app">
+    <img src="./assets/logo.png">
+    <h1>{{ msg }}</h1>
+    <h2>Essential Links</h2>
+    <ul>
+      <li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
+      <li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
+      <li><a href="https://chat.vuejs.org" target="_blank">Community Chat</a></li>
+      <li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
+    </ul>
+    <h2>Ecosystem</h2>
+    <ul>
+      <li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
+      <li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
+      <li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
+      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
+    </ul>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'app',
+  data () {
+    return {
+      msg: 'Welcome to Your Vue.js App'
+    }
+  }
+}
+</script>
+
+<style lang="scss">
+#app {
+  font-family: 'Avenir', Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  text-align: center;
+  color: #2c3e50;
+  margin-top: 60px;
+}
+
+h1, h2 {
+  font-weight: normal;
+}
+
+ul {
+  list-style-type: none;
+  padding: 0;
+}
+
+li {
+  display: inline-block;
+  margin: 0 10px;
+}
+
+a {
+  color: #42b983;
+}
+</style>

BIN
frontend/src/assets/logo.png


+ 7 - 0
frontend/src/main.js

@@ -0,0 +1,7 @@
+import Vue from 'vue'
+import App from './App.vue'
+
+new Vue({
+  el: '#app',
+  render: h => h(App)
+})

+ 110 - 0
frontend/webpack.config.js

@@ -0,0 +1,110 @@
+var path = require('path')
+var webpack = require('webpack')
+
+module.exports = {
+  entry: './src/main.js',
+  output: {
+    path: path.resolve(__dirname, './dist'),
+    publicPath: '/dist/',
+    filename: 'build.js'
+  },
+  module: {
+    rules: [
+      {
+        test: /\.css$/,
+        use: [
+          'vue-style-loader',
+          'css-loader'
+        ],
+      },
+      {
+        test: /\.scss$/,
+        use: [
+          'vue-style-loader',
+          'css-loader',
+          'sass-loader'
+        ],
+      },
+      {
+        test: /\.sass$/,
+        use: [
+          'vue-style-loader',
+          'css-loader',
+          'sass-loader?indentedSyntax'
+        ],
+      },
+      {
+        test: /\.vue$/,
+        loader: 'vue-loader',
+        options: {
+          loaders: {
+            // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
+            // the "scss" and "sass" values for the lang attribute to the right configs here.
+            // other preprocessors should work out of the box, no loader config like this necessary.
+            'scss': [
+              'vue-style-loader',
+              'css-loader',
+              'sass-loader'
+            ],
+            'sass': [
+              'vue-style-loader',
+              'css-loader',
+              'sass-loader?indentedSyntax'
+            ]
+          }
+          // other vue-loader options go here
+        }
+      },
+      {
+        test: /\.js$/,
+        loader: 'babel-loader',
+        exclude: /node_modules/
+      },
+      {
+        test: /\.(png|jpg|gif|svg)$/,
+        loader: 'file-loader',
+        options: {
+          name: '[name].[ext]?[hash]'
+        }
+      }
+    ]
+  },
+  resolve: {
+    alias: {
+      'vue$': 'vue/dist/vue.esm.js'
+    },
+    extensions: ['*', '.js', '.vue', '.json']
+  },
+  devServer: {
+    host: '0.0.0.0',
+    disableHostCheck: true,
+    historyApiFallback: true,
+    noInfo: true,
+    overlay: true
+  },
+  performance: {
+    hints: false
+  },
+  devtool: '#eval-source-map'
+}
+
+if (process.env.NODE_ENV === 'production') {
+  module.exports.devtool = '#source-map'
+  // http://vue-loader.vuejs.org/en/workflow/production.html
+  module.exports.plugins = (module.exports.plugins || []).concat([
+    new webpack.DefinePlugin({
+      'process.env': {
+        NODE_ENV: '"production"'
+      }
+    }),
+    new webpack.optimize.UglifyJsPlugin({
+      sourceMap: true,
+      compress: {
+        warnings: false
+      }
+    }),
+    new webpack.LoaderOptionsPlugin({
+      minimize: true
+    })
+  ])
+}

+ 57 - 0
go/Makefile.boiler

@@ -0,0 +1,57 @@
+# {{.author}} {{.email}}
+# 
+
+GOPATH=$(CURDIR)/deps:$(CURDIR)
+DIST=./DIST
+BUILDENV=
+GETENV=
+
+
+# Source in packages names
+# What packages to build
+
+# CLI Packages
+CLI={{.maingo}}
+BIN=$(addprefix $(DIST)/, $(notdir $(CLI)))
+
+# Windows build
+ifeq ($(GOOS),windows)
+	ENV+=CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH)
+	BIN:=$(addsuffix .exe, $(BIN))
+endif
+
+.PHONY: all deps clean dist-clean $(BIN)
+
+all: $(BIN) deps
+	@$(ENV) echo -e "\e[32;01mBuilt for OS: `go env GOOS`, ARCH: `go env GOARCH`\e[0m"
+	
+$(BIN): deps
+	$(BUILDENV) GOPATH="$(GOPATH)" go build -o $@ $(CLI)
+
+# generate
+generate:
+	GOPATH="$(GOPATH)" go generate -v ./src/...
+
+test:
+	$(ENV) gocov test -race ./src/... | gocov report
+
+#$(BIN): $(addprefix src/,$(SOURCE))
+#	echo $<
+
+deps:
+	$(GETENV) GOPATH="$(GOPATH)" go get -v ./src/... # everything from source
+	# test package 
+	$(GETENV) GOPATH="$(GOPATH)" go get -v -t ./src/...
+
+clean:
+	rm -rf $(DIST)
+
+dist-clean: clean
+	rm -rf bin
+	rm -rf pkg
+	rm -rf deps
+
+$(DIST):
+	mkdir -p $(DIST)
+
+