From 8fe7a2c5af5db1b758f7a30292c6a85e1ba8aa4c Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 22 Aug 2024 14:22:31 +0300 Subject: [PATCH] Add example --- example/README.md | 5 ++++ example/index.html | 13 +++++++++ example/package.json | 24 ++++++++++++++++ example/postcss.config.js | 6 ++++ example/prettier.config.js | 5 ++++ example/public/galaxy-charts.svg | 8 ++++++ example/public/galaxy-charts.txt | 21 ++++++++++++++ example/public/galaxy-charts.xml | 49 ++++++++++++++++++++++++++++++++ example/server.config.js | 3 ++ example/src/App.vue | 26 +++++++++++++++++ example/src/Plugin.vue | 48 +++++++++++++++++++++++++++++++ example/src/main.js | 5 ++++ example/src/style.css | 3 ++ example/tailwind.config.js | 8 ++++++ example/vite.config.js | 44 ++++++++++++++++++++++++++++ 15 files changed, 268 insertions(+) create mode 100644 example/README.md create mode 100644 example/index.html create mode 100644 example/package.json create mode 100644 example/postcss.config.js create mode 100644 example/prettier.config.js create mode 100644 example/public/galaxy-charts.svg create mode 100755 example/public/galaxy-charts.txt create mode 100644 example/public/galaxy-charts.xml create mode 100644 example/server.config.js create mode 100644 example/src/App.vue create mode 100644 example/src/Plugin.vue create mode 100644 example/src/main.js create mode 100644 example/src/style.css create mode 100644 example/tailwind.config.js create mode 100644 example/vite.config.js diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..1511959 --- /dev/null +++ b/example/README.md @@ -0,0 +1,5 @@ +# Vue 3 + Vite + +This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` + + diff --git a/example/package.json b/example/package.json new file mode 100644 index 0000000..02385af --- /dev/null +++ b/example/package.json @@ -0,0 +1,24 @@ +{ + "name": "galaxy-starter-kit", + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "prettier": "prettier --write 'src/**/*.vue' 'src/**/*.js' '*.js' 'package.json'" + }, + "dependencies": { + "galaxy-charts": "^0.0.2", + "vue": "^3.4.31" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.0.5", + "autoprefixer": "^10.4.19", + "postcss": "^8.4.40", + "prettier": "^3.3.3", + "tailwindcss": "^3.4.7", + "typescript": "^5.5.4", + "vite": "^5.3.4" + } +} diff --git a/example/postcss.config.js b/example/postcss.config.js new file mode 100644 index 0000000..49c0612 --- /dev/null +++ b/example/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/example/prettier.config.js b/example/prettier.config.js new file mode 100644 index 0000000..6934b04 --- /dev/null +++ b/example/prettier.config.js @@ -0,0 +1,5 @@ +export default { + tabWidth: 4, + printWidth: 120, + bracketSameLine: true, +}; diff --git a/example/public/galaxy-charts.svg b/example/public/galaxy-charts.svg new file mode 100644 index 0000000..443e323 --- /dev/null +++ b/example/public/galaxy-charts.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/example/public/galaxy-charts.txt b/example/public/galaxy-charts.txt new file mode 100755 index 0000000..07e2412 --- /dev/null +++ b/example/public/galaxy-charts.txt @@ -0,0 +1,21 @@ +# Hydrophobicity Membrane Flexibility Volume Buried Helix Beta +Alanine 0.61 1.56 0.357 52.6 91.5 1.42 0.83 +Arginine 0.6 0.45 0.529 109.1 202 0.98 0.93 +Asparagine 0.06 0.27 0.463 75.7 135.2 0.67 0.89 +Aspartic 0.46 0.14 0.511 68.4 124.5 1.01 0.54 +Cysteine 1.07 1.23 0.346 68.3 117.7 0.7 1.19 +Glutamine 0 0.51 0.493 89.7 161.1 1.11 1.1 +Glutamic 0.47 0.23 0.497 84.7 155.1 1.51 0.37 +Glycine 0.07 0.62 0.544 36.3 66.4 0.57 0.75 +Histidine 0.61 0.29 0.323 91.9 167.3 1 0.87 +Isoleucine 2.22 1.67 0.462 102 168.8 1.08 1.6 +Leucine 1.53 2.93 0.365 102 167.9 1.21 1.3 +Lysine 1.15 0.15 0.466 105.1 171.3 1.16 0.74 +Methionine 1.18 2.96 0.295 97.7 170.8 1.45 1.05 +Phenylalanine 2.02 2.03 0.314 113.9 203.4 1.13 1.38 +Proline 1.95 0.76 0.509 73.6 129.3 0.57 0.55 +Serine 0.05 0.81 0.507 54.9 99.1 0.77 0.75 +Threonine 0.05 0.91 0.444 71.2 122.1 0.83 1.19 +Tryptophan 2.65 1.08 0.305 135.4 237.6 1.08 1.37 +Tyrosine 1.88 0.68 0.42 116.2 203.6 0.69 1.47 +Valine 1.32 1.14 0.386 85.1 141.7 1.06 1.7 diff --git a/example/public/galaxy-charts.xml b/example/public/galaxy-charts.xml new file mode 100644 index 0000000..40f42a1 --- /dev/null +++ b/example/public/galaxy-charts.xml @@ -0,0 +1,49 @@ + + + + Welcome to Galaxy Charts. + + spec_type + + + + + track_color + color + + + + track_text + text + Placeholder + Text + + + track_column_0 + + data_column + true + true + + + track_column_1 + + data_column + true + + + + + + setting_text + text + true + + + + setting_boolean + boolean + true + + + \ No newline at end of file diff --git a/example/server.config.js b/example/server.config.js new file mode 100644 index 0000000..b6d14f8 --- /dev/null +++ b/example/server.config.js @@ -0,0 +1,3 @@ +export default { + GALAXY_API: "http://127.0.0.1:8081/api", +}; diff --git a/example/src/App.vue b/example/src/App.vue new file mode 100644 index 0000000..7c9947e --- /dev/null +++ b/example/src/App.vue @@ -0,0 +1,26 @@ + + + diff --git a/example/src/Plugin.vue b/example/src/Plugin.vue new file mode 100644 index 0000000..9b4f82b --- /dev/null +++ b/example/src/Plugin.vue @@ -0,0 +1,48 @@ + + + diff --git a/example/src/main.js b/example/src/main.js new file mode 100644 index 0000000..3c9bfeb --- /dev/null +++ b/example/src/main.js @@ -0,0 +1,5 @@ +import { createApp } from "vue"; +import "./style.css"; +import App from "./App.vue"; + +createApp(App).mount("#app"); diff --git a/example/src/style.css b/example/src/style.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/example/src/style.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/example/tailwind.config.js b/example/tailwind.config.js new file mode 100644 index 0000000..5f5ac56 --- /dev/null +++ b/example/tailwind.config.js @@ -0,0 +1,8 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: ["./src/**/*.vue"], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/example/vite.config.js b/example/vite.config.js new file mode 100644 index 0000000..43b9389 --- /dev/null +++ b/example/vite.config.js @@ -0,0 +1,44 @@ +import { defineConfig } from "vite"; +import tailwindcss from "tailwindcss"; +import vue from "@vitejs/plugin-vue"; +import path from "path"; +import serverConfig from "./server.config"; + +// determine server route +let GALAXY_API = ""; +if (process.env.GALAXY_API) { + GALAXY_API = process.env.GALAXY_API; +} else if (serverConfig.GALAXY_API) { + GALAXY_API = serverConfig.GALAXY_API; +} else { + console.warn("GALAXY_API not available. Please provide as environment variable or specify in 'server.config'."); +} + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue(), tailwindcss()], + resolve: { + alias: { + "@": path.resolve(__dirname, "src"), + }, + }, + build: { + rollupOptions: { + output: { + manualChunks: () => "app.js", + entryFileNames: "assets/[name].js", + chunkFileNames: "assets/[name].js", + assetFileNames: "assets/[name][extname]", + }, + }, + }, + server: { + proxy: { + "/api": { + target: GALAXY_API, + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ""), + }, + }, + }, +});