You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2021/04/02 05:38:26 UTC

[echarts-bar-racing] branch master updated: init using vite

This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bar-racing.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f71e99  init using vite
3f71e99 is described below

commit 3f71e9924227e573ac75edc197c619ac343f2857
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Apr 2 13:38:11 2021 +0800

    init using vite
---
 .editorconfig                 |   3 ++
 .gitignore                    |   2 ++
 README.md                     |  27 ++++++++++++++++--
 config/env.asf.js             |   6 ++++
 index.html                    |  13 +++++++++
 package.json                  |  18 ++++++++++++
 public/favicon.ico            | Bin 0 -> 4286 bytes
 src/.DS_Store                 | Bin 0 -> 6148 bytes
 src/App.vue                   |  41 ++++++++++++++++++++++++++
 src/assets/logo.png           | Bin 0 -> 6849 bytes
 src/components/ETable.vue     |  17 +++++++++++
 src/components/HelloWorld.vue |  65 ++++++++++++++++++++++++++++++++++++++++++
 src/main.ts                   |   4 +++
 src/shims-vue.d.ts            |   5 ++++
 tsconfig.json                 |  15 ++++++++++
 vite.config.ts                |  14 +++++++++
 16 files changed, 228 insertions(+), 2 deletions(-)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..76a93c0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,3 @@
+[*]
+indent_style = space
+indent_size = 2
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..166859a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+_generated
diff --git a/README.md b/README.md
index dbdbdf1..5129295 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,26 @@
-# Apache ECharts Bar-Racing Generator
+# Vue 3 + Typescript + Vite
 
-This is a tool to generate bar-racing charts with Apache ECharts.
+This template should help get you started developing with Vue 3 and Typescript in Vite.
+
+## Recommended IDE Setup
+
+[VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings!
+
+### If Using `<script setup>`
+
+[`<script setup>`](https://github.com/vuejs/rfcs/pull/227) is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) instead of Vetur (and disable Vetur).
+
+## Type Support For `.vue` Imports in TS
+
+Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can use the following:
+
+### If Using Volar
+
+Run `Volar: Switch TS Plugin on/off` from VSCode command palette.
+
+### If Using Vetur
+
+1. Install and add `@vuedx/typescript-plugin-vue` to the [plugins section](https://www.typescriptlang.org/tsconfig#plugins) in `tsconfig.json`
+2. Delete `src/shims-vue.d.ts` as it is no longer needed to provide module info to Typescript
+3. Open `src/main.ts` in VSCode
+4. Open the VSCode command palette 5. Search and run "Select TypeScript version" -> "Use workspace version"
diff --git a/config/env.asf.js b/config/env.asf.js
new file mode 100644
index 0000000..f434a9d
--- /dev/null
+++ b/config/env.asf.js
@@ -0,0 +1,6 @@
+const path = require('path');
+
+module.exports = {
+    releaseDestDir: path.resolve(__dirname, '../../echarts-website'),
+    ecWWWGeneratedDir: path.resolve(__dirname, '../../echarts-www/_generated')
+};
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..11603f8
--- /dev/null
+++ b/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" href="/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>Vite App</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.ts"></script>
+  </body>
+</html>
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..78ea979
--- /dev/null
+++ b/package.json
@@ -0,0 +1,18 @@
+{
+  "name": "echarts-bar-racing",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build",
+    "serve": "vite preview"
+  },
+  "dependencies": {
+    "vue": "^3.0.5"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.1.4",
+    "@vue/compiler-sfc": "^3.0.5",
+    "typescript": "^4.1.3",
+    "vite": "^2.0.1"
+  }
+}
\ No newline at end of file
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..df36fcf
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 0000000..d8cc671
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/src/App.vue b/src/App.vue
new file mode 100644
index 0000000..af7ed0a
--- /dev/null
+++ b/src/App.vue
@@ -0,0 +1,41 @@
+<template>
+  <!-- <img alt="Vue logo" src="./assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" /> -->
+  <h1>Apache ECharts 动态排序柱状图生成工具</h1>
+  <p>This is content</p>
+</template>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+// import HelloWorld from './components/HelloWorld.vue'
+
+export default defineComponent({
+  name: 'App',
+  components: {
+    // HelloWorld
+  }
+})
+</script>
+
+<style>
+#table-row {
+  margin: 0;
+}
+#table-panel {
+  border: 1px solid #eee;
+  height: 600px;
+  overflow: hidden;
+}
+#bar-race-preview {
+  width: 100%;
+  height: 400px;
+  margin: 30px 0;
+}
+#bar-race-preview div, #bar-race-preview canvas {
+  width: 100% !important;
+  height: 100% !important;
+}
+.btn {
+  margin-right: 10px;
+}
+</style>
\ No newline at end of file
diff --git a/src/assets/logo.png b/src/assets/logo.png
new file mode 100644
index 0000000..f3d2503
Binary files /dev/null and b/src/assets/logo.png differ
diff --git a/src/components/ETable.vue b/src/components/ETable.vue
new file mode 100644
index 0000000..150e939
--- /dev/null
+++ b/src/components/ETable.vue
@@ -0,0 +1,17 @@
+<template>
+
+</template>
+
+<script lang="ts">
+import {defineComponent} from 'vue'
+export default defineComponent({
+  name: 'ETable',
+  props: {
+  },
+  setup: () => {
+  }
+})
+</script>
+
+<style scoped>
+</style>
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
new file mode 100644
index 0000000..86dde23
--- /dev/null
+++ b/src/components/HelloWorld.vue
@@ -0,0 +1,65 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a
+      href="https://marketplace.visualstudio.com/items?itemName=octref.vetur"
+      target="_blank"
+    >Vetur</a>
+    or
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+    (if using
+    <code>&ltscript setup&gt;</code>)
+  </p>
+
+  <p>See <code>README.md</code> for more information.</p>
+
+  <p>
+    <a href="https://vitejs.dev/guide/features.html" target="_blank">Vite Docs</a> |
+    <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
+  </p>
+
+  <button @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script lang="ts">
+import { ref, defineComponent } from 'vue'
+export default defineComponent({
+  name: 'HelloWorld',
+  props: {
+    msg: {
+      type: String,
+      required: true
+    }
+  },
+  setup: () => {
+    const count = ref(0)
+    return { count }
+  }
+})
+</script>
+
+<style scoped>
+a {
+  color: #42b983;
+}
+
+label {
+  margin: 0 0.5em;
+  font-weight: bold;
+}
+
+code {
+  background-color: #eee;
+  padding: 2px 4px;
+  border-radius: 4px;
+  color: #304455;
+}
+</style>
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..01433bc
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')
diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts
new file mode 100644
index 0000000..ac1ded7
--- /dev/null
+++ b/src/shims-vue.d.ts
@@ -0,0 +1,5 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..e754e65
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,15 @@
+{
+  "compilerOptions": {
+    "target": "esnext",
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "lib": ["esnext", "dom"],
+    "types": ["vite/client"]
+  },
+  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
+}
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644
index 0000000..6b04ab2
--- /dev/null
+++ b/vite.config.ts
@@ -0,0 +1,14 @@
+import {defineConfig} from 'vite';
+import vue from '@vitejs/plugin-vue';
+import config from './config/env.asf';
+
+const dist = '_generated';
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  base: './',
+  plugins: [vue()],
+  build: {
+    outDir: dist + '/zh'
+  }
+})

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org