]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
chore: add playground to test
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 11 Jul 2021 19:02:29 +0000 (21:02 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 19 Jul 2021 09:51:55 +0000 (11:51 +0200)
15 files changed:
docs/vite.config.js
index.html [new file with mode: 0644]
package.json
playground/.gitignore [new file with mode: 0644]
playground/src/App.vue [new file with mode: 0644]
playground/src/components/TestCounterStore.vue [moved from docs/.vitepress/components/TestCounterStore.vue with 100% similarity]
playground/src/components/TestStore.vue [moved from docs/.vitepress/components/TestStore.vue with 92% similarity]
playground/src/main.ts [new file with mode: 0644]
playground/src/shims-vue.d.ts [new file with mode: 0644]
playground/src/stores/cart.ts [moved from docs/.vitepress/stores/cart.ts with 100% similarity]
playground/src/stores/counter.ts [moved from docs/.vitepress/stores/counter.ts with 100% similarity]
playground/src/stores/user.ts [moved from docs/.vitepress/stores/user.ts with 100% similarity]
playground/src/vite-env.d.ts [new file with mode: 0644]
vite.config.ts [new file with mode: 0644]
yarn.lock

index f23e4ec9755bd24b7325ec7cf0e8eb2d68779097..c51ed741b36bc328f67f5c757b6c22f476658cb8 100644 (file)
@@ -1,7 +1,5 @@
 import { defineConfig } from 'vite'
 
-console.log('loaded config')
-
 export default defineConfig({
   define: {
     __DEV__: 'true',
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..b4cd94a
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>🍍 Pinia playground</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/playground/src/main.ts"></script>
+  </body>
+</html>
index 7e314d62e92d144e24600c6af840b3ac4e85d7fc..1f78d3ab7e5247137b54967321f8acaf67dc053a 100644 (file)
@@ -72,6 +72,8 @@
     "@types/node": "^16.0.1",
     "@vue/server-renderer": "^3.1.5",
     "@vue/test-utils": "^2.0.0-rc.10",
+    "@vitejs/plugin-vue": "^1.2.4",
+    "@vue/compiler-sfc": "npm:@knightly/vue__compiler-sfc@3-2",
     "@vueuse/core": "^5.1.3",
     "brotli": "^1.3.2",
     "codecov": "^3.8.2",
@@ -86,6 +88,7 @@
     "rollup-plugin-terser": "^7.0.2",
     "rollup-plugin-typescript2": "^0.30.0",
     "typescript": "~4.3.5",
+    "vite": "^2.4.1",
     "vitepress": "^0.15.6",
     "vue": "^3.1.5",
     "yorkie": "^2.0.0"
diff --git a/playground/.gitignore b/playground/.gitignore
new file mode 100644 (file)
index 0000000..d451ff1
--- /dev/null
@@ -0,0 +1,5 @@
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
diff --git a/playground/src/App.vue b/playground/src/App.vue
new file mode 100644 (file)
index 0000000..f151f0a
--- /dev/null
@@ -0,0 +1,18 @@
+<template>
+  <TestStore />
+</template>
+
+<script lang="ts" setup>
+import TestStore from './components/TestStore.vue'
+</script>
+
+<style>
+#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;
+}
+</style>
similarity index 92%
rename from docs/.vitepress/components/TestStore.vue
rename to playground/src/components/TestStore.vue
index 156f07f4deed5d2dacbf502c3e97e1f86cc4b4a2..a5b1c272dab8275a8256e8127f8085b9e1e5a160 100644 (file)
@@ -6,7 +6,7 @@
   <div>
     <p>Counter: {{ counterStore.double }} = 2 x {{ counterStore.n }}</p>
     <button @click="counterStore.increment(10)">Increment</button>
-    <button @click="counterStore.fail">Fail</button>
+    <button @click="counterStore.fail()">Fail</button>
     <button @click="counterStore.decrementToZero(300)">Countdown!</button>
   </div>
 </template>
diff --git a/playground/src/main.ts b/playground/src/main.ts
new file mode 100644 (file)
index 0000000..1d3ea99
--- /dev/null
@@ -0,0 +1,5 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+import { createPinia } from '../../src'
+
+createApp(App).use(createPinia()).mount('#app')
diff --git a/playground/src/shims-vue.d.ts b/playground/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ac1ded7
--- /dev/null
@@ -0,0 +1,5 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/src/vite-env.d.ts b/playground/src/vite-env.d.ts
new file mode 100644 (file)
index 0000000..11f02fe
--- /dev/null
@@ -0,0 +1 @@
+/// <reference types="vite/client" />
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644 (file)
index 0000000..5a5c18d
--- /dev/null
@@ -0,0 +1,15 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue()],
+  define: {
+    __DEV__: 'true',
+    __BROWSER__: 'true',
+    __TEST__: 'false',
+  },
+  optimizeDeps: {
+    exclude: ['@vueuse/shared', '@vueuse/core'],
+  },
+})
index 7f63de74ee6afd58f2ea269d6a88be2c6506adc4..bcc458234d31a2ec571944e3a8e5dd0b14d18aab 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
   dependencies:
     "@types/yargs-parser" "*"
 
-"@vitejs/plugin-vue@^1.2.3":
+"@vitejs/plugin-vue@^1.2.3", "@vitejs/plugin-vue@^1.2.4":
   version "1.2.4"
   resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.2.4.tgz#a7aa6e6a31c556a8b781de730316deeecf7f56f2"
   integrity sha512-D/3H9plevPQGgQGwmV6eecvOnooLTecPR63HPffVVWPEhbfvmtYLWgznzs456NBb2DItiRTCIa1yWxvGqC+I8A==
@@ -5732,7 +5732,7 @@ vary@~1.1.2:
   resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
   integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
 
-vite@^2.3.7:
+vite@^2.3.7, vite@^2.4.1:
   version "2.4.1"
   resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.1.tgz#2e48b8dbfc69e4edbf7f4d1c0798d621585cb8da"
   integrity sha512-4BpKRis9uxIqPfIEcJ18LTBsamqnDFxTx45CXwagHjNltHa6PFEvf8Pe6OpgIHb0OyWT30OXOSSQvdOaX4OBiQ==