diff --git a/cmd/templates/vue3-full/frontend/.browserslistrc b/cmd/templates/vue3-full/frontend/.browserslistrc new file mode 100644 index 000000000..214388fe4 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/cmd/templates/vue3-full/frontend/.eslintrc.js b/cmd/templates/vue3-full/frontend/.eslintrc.js new file mode 100644 index 000000000..bf594a121 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/.eslintrc.js @@ -0,0 +1,29 @@ +module.exports = { + root: true, + env: { + node: true + }, + 'extends': [ + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/typescript/recommended' + ], + parserOptions: { + ecmaVersion: 2020 + }, + rules: { + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' + }, + overrides: [ + { + files: [ + '**/__tests__/*.{j,t}s?(x)', + '**/tests/unit/**/*.spec.{j,t}s?(x)' + ], + env: { + mocha: true + } + } + ] +} diff --git a/cmd/templates/vue3-full/frontend/.gitignore b/cmd/templates/vue3-full/frontend/.gitignore new file mode 100644 index 000000000..185e66319 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* diff --git a/cmd/templates/vue3-full/frontend/README.md b/cmd/templates/vue3-full/frontend/README.md new file mode 100644 index 000000000..6953f66d0 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/README.md @@ -0,0 +1,35 @@ +# vue basic + +## Project setup + +``` +npm install +``` + +### Compiles and hot-reloads for development + +``` +npm run serve +``` + +### Compiles and minifies for production + +``` +npm run build +``` + +### Run your tests + +``` +npm run test +``` + +### Lints and fixes files + +``` +npm run lint +``` + +### Customize configuration + +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/cmd/templates/vue3-full/frontend/package.json.template b/cmd/templates/vue3-full/frontend/package.json.template new file mode 100644 index 000000000..cadd160a5 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/package.json.template @@ -0,0 +1,37 @@ +{ + "name": "{{.NPMProjectName}}", + "author": "{{.Author.Name}}<{{.Author.Email}}>", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "test:unit": "vue-cli-service test:unit", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "vue": "^3.0.0-0", + "vue-router": "^4.0.0-0", + "regenerator-runtime": "^0.13.7", + "@wailsapp/runtime": "^1.1.1" + }, + "devDependencies": { + "@types/chai": "^4.2.12", + "@types/mocha": "^8.0.3", + "@typescript-eslint/eslint-plugin": "^4.3.0", + "@typescript-eslint/parser": "^4.3.0", + "@vue/cli-plugin-eslint": "~4.5.6", + "@vue/cli-plugin-router": "~4.5.6", + "@vue/cli-plugin-typescript": "~4.5.6", + "@vue/cli-plugin-unit-mocha": "~4.5.6", + "@vue/cli-service": "~4.5.6", + "@vue/compiler-sfc": "^3.0.0", + "@vue/eslint-config-typescript": "^5.1.0", + "@vue/test-utils": "^2.0.0-0", + "chai": "^4.2.0", + "eslint": "^7.10.0", + "eslint-plugin-vue": "^7.0.0", + "node-sass": "^4.14.1", + "sass-loader": "^10.0.2", + "typescript": "~4.0.3" + } +} diff --git a/cmd/templates/vue3-full/frontend/src/App.vue b/cmd/templates/vue3-full/frontend/src/App.vue new file mode 100644 index 000000000..6939bbb9b --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/App.vue @@ -0,0 +1,32 @@ + + + diff --git a/cmd/templates/vue3-full/frontend/src/assets/appicon.png b/cmd/templates/vue3-full/frontend/src/assets/appicon.png new file mode 100644 index 000000000..9f22be34b Binary files /dev/null and b/cmd/templates/vue3-full/frontend/src/assets/appicon.png differ diff --git a/cmd/templates/vue3-full/frontend/src/components/HelloWorld.vue b/cmd/templates/vue3-full/frontend/src/components/HelloWorld.vue new file mode 100644 index 000000000..92d381cd8 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/components/HelloWorld.vue @@ -0,0 +1,34 @@ + + + + + + diff --git a/cmd/templates/vue3-full/frontend/src/main.ts b/cmd/templates/vue3-full/frontend/src/main.ts new file mode 100644 index 000000000..e831d352c --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/main.ts @@ -0,0 +1,8 @@ +import { createApp } from 'vue' +import App from './App.vue' +import router from './router' +import * as Wails from '@wailsapp/runtime'; + +Wails.Init(() => { + createApp(App).use(router).mount('#app') +}); diff --git a/cmd/templates/vue3-full/frontend/src/router/index.ts b/cmd/templates/vue3-full/frontend/src/router/index.ts new file mode 100644 index 000000000..73c740289 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/router/index.ts @@ -0,0 +1,27 @@ +import { createRouter, createMemoryHistory, RouteRecordRaw } from 'vue-router' +import Home from '../views/Home.vue' +import About from '../views/About.vue' + +const routes: Array = [ + { + path: '/', + name: 'Home', + component: Home + }, + { + path: '/about', + name: 'About', + // route level code-splitting + // this generates a separate chunk (about.[hash].js) for this route + // which is lazy-loaded when the route is visited. + // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') + component: About + } +] + +const router = createRouter({ + history: createMemoryHistory(), + routes +}) + +export default router diff --git a/cmd/templates/vue3-full/frontend/src/shims-vue.d.ts b/cmd/templates/vue3-full/frontend/src/shims-vue.d.ts new file mode 100644 index 000000000..32a1b5cd4 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import { defineComponent } from 'vue' + const component: ReturnType + export default component +} diff --git a/cmd/templates/vue3-full/frontend/src/views/About.vue b/cmd/templates/vue3-full/frontend/src/views/About.vue new file mode 100644 index 000000000..3fa28070d --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/views/About.vue @@ -0,0 +1,5 @@ + diff --git a/cmd/templates/vue3-full/frontend/src/views/Home.vue b/cmd/templates/vue3-full/frontend/src/views/Home.vue new file mode 100644 index 000000000..cc6aac4cb --- /dev/null +++ b/cmd/templates/vue3-full/frontend/src/views/Home.vue @@ -0,0 +1,40 @@ + + + diff --git a/cmd/templates/vue3-full/frontend/tests/unit/example.spec.ts b/cmd/templates/vue3-full/frontend/tests/unit/example.spec.ts new file mode 100644 index 000000000..bc9939b65 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/tests/unit/example.spec.ts @@ -0,0 +1,13 @@ +import { expect } from 'chai' +import { shallowMount } from '@vue/test-utils' +import HelloWorld from '@/components/HelloWorld.vue' + +describe('HelloWorld.vue', () => { + it('renders props.msg when passed', () => { + const msg = 'new message' + const wrapper = shallowMount(HelloWorld, { + props: { msg } + }) + expect(wrapper.text()).to.include(msg) + }) +}) diff --git a/cmd/templates/vue3-full/frontend/tsconfig.json b/cmd/templates/vue3-full/frontend/tsconfig.json new file mode 100644 index 000000000..e4ba95a15 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/tsconfig.json @@ -0,0 +1,41 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "esnext", + "strict": true, + "jsx": "preserve", + "importHelpers": true, + "moduleResolution": "node", + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "baseUrl": ".", + "types": [ + "webpack-env", + "mocha", + "chai" + ], + "paths": { + "@/*": [ + "src/*" + ] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] + }, + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.vue", + "tests/**/*.ts", + "tests/**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/cmd/templates/vue3-full/frontend/vue.config.js b/cmd/templates/vue3-full/frontend/vue.config.js new file mode 100644 index 000000000..a2691b1f7 --- /dev/null +++ b/cmd/templates/vue3-full/frontend/vue.config.js @@ -0,0 +1,42 @@ +let cssConfig = {}; + +if (process.env.NODE_ENV == "production") { + cssConfig = { + extract: { + filename: "[name].css", + chunkFilename: "[name].css" + } + }; +} + +module.exports = { + chainWebpack: config => { + let limit = 9999999999999999; + config.module + .rule("images") + .test(/\.(png|gif|jpg)(\?.*)?$/i) + .use("url-loader") + .loader("url-loader") + .tap(options => Object.assign(options, { limit: limit })); + config.module + .rule("fonts") + .test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i) + .use("url-loader") + .loader("url-loader") + .options({ + limit: limit + }); + }, + css: cssConfig, + configureWebpack: { + output: { + filename: "[name].js" + }, + optimization: { + splitChunks: false + } + }, + devServer: { + disableHostCheck: true + } +}; diff --git a/cmd/templates/vue3-full/go.mod.template b/cmd/templates/vue3-full/go.mod.template new file mode 100644 index 000000000..780381065 --- /dev/null +++ b/cmd/templates/vue3-full/go.mod.template @@ -0,0 +1,5 @@ +module {{.BinaryName}} + +require ( + github.com/wailsapp/wails {{.WailsVersion}} +) \ No newline at end of file diff --git a/cmd/templates/vue3-full/main.go.template b/cmd/templates/vue3-full/main.go.template new file mode 100644 index 000000000..e2262bd1d --- /dev/null +++ b/cmd/templates/vue3-full/main.go.template @@ -0,0 +1,27 @@ +package main + +import ( + "github.com/leaanthony/mewn" + "github.com/wailsapp/wails" +) + +func basic() string { + return "Hello World!" +} + +func main() { + + js := mewn.String("./frontend/dist/app.js") + css := mewn.String("./frontend/dist/app.css") + + app := wails.CreateApp(&wails.AppConfig{ + Width: 1024, + Height: 768, + Title: "{{.Name}}", + JS: js, + CSS: css, + Colour: "#131313", + }) + app.Bind(basic) + app.Run() +} diff --git a/cmd/templates/vue3-full/template.json b/cmd/templates/vue3-full/template.json new file mode 100755 index 000000000..34b65acb8 --- /dev/null +++ b/cmd/templates/vue3-full/template.json @@ -0,0 +1,14 @@ +{ + "name": "Vue3 Full", + "version": "1.0.0", + "shortdescription": "Vue 3, Vuex, Vue-router, and Webpack4", + "description": "Vue3.0.0 Vuex, Vue-router, and Webpack 4", + "install": "npm install", + "build": "npm run build", + "author": "Kyle Muchmore ", + "created": "2020-09-24 21:18:55.09417 +0000 UTC m=+90.125590001", + "frontenddir": "frontend", + "serve": "npm run serve", + "bridge": "src", + "wailsdir": "" +}