]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
workflow: generate a snapshot of each template before each release
authorHaoqun Jiang <haoqunjiang@gmail.com>
Tue, 27 Jul 2021 05:06:24 +0000 (13:06 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Tue, 27 Jul 2021 05:07:17 +0000 (13:07 +0800)
156 files changed:
index.js
package.json
playground/default-ts-with-tests/.gitignore [new file with mode: 0644]
playground/default-ts-with-tests/README.md [moved from playground/.gitkeep with 100% similarity]
playground/default-ts-with-tests/cypress.json [new file with mode: 0644]
playground/default-ts-with-tests/cypress/fixtures/example.json [new file with mode: 0644]
playground/default-ts-with-tests/cypress/integration/example.spec.ts [new file with mode: 0644]
playground/default-ts-with-tests/cypress/plugins/index.ts [new file with mode: 0644]
playground/default-ts-with-tests/cypress/support/commands.ts [new file with mode: 0644]
playground/default-ts-with-tests/cypress/support/index.ts [new file with mode: 0644]
playground/default-ts-with-tests/cypress/tsconfig.json [new file with mode: 0644]
playground/default-ts-with-tests/index.html [new file with mode: 0644]
playground/default-ts-with-tests/package.json [new file with mode: 0644]
playground/default-ts-with-tests/public/favicon.ico [new file with mode: 0644]
playground/default-ts-with-tests/src/App.vue [new file with mode: 0644]
playground/default-ts-with-tests/src/assets/logo.png [new file with mode: 0644]
playground/default-ts-with-tests/src/components/HelloWorld.vue [new file with mode: 0644]
playground/default-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts [new file with mode: 0644]
playground/default-ts-with-tests/src/main.ts [new file with mode: 0644]
playground/default-ts-with-tests/src/shims-vue.d.ts [new file with mode: 0644]
playground/default-ts-with-tests/src/vite-env.d.ts [new file with mode: 0644]
playground/default-ts-with-tests/tsconfig.json [new file with mode: 0644]
playground/default-ts-with-tests/vite.config.ts [new file with mode: 0644]
playground/default-ts/.gitignore [new file with mode: 0644]
playground/default-ts/README.md [new file with mode: 0644]
playground/default-ts/index.html [new file with mode: 0644]
playground/default-ts/package.json [new file with mode: 0644]
playground/default-ts/public/favicon.ico [new file with mode: 0644]
playground/default-ts/src/App.vue [new file with mode: 0644]
playground/default-ts/src/assets/logo.png [new file with mode: 0644]
playground/default-ts/src/components/HelloWorld.vue [new file with mode: 0644]
playground/default-ts/src/main.ts [new file with mode: 0644]
playground/default-ts/src/shims-vue.d.ts [new file with mode: 0644]
playground/default-ts/src/vite-env.d.ts [new file with mode: 0644]
playground/default-ts/tsconfig.json [new file with mode: 0644]
playground/default-ts/vite.config.ts [new file with mode: 0644]
playground/default-with-tests/.gitignore [new file with mode: 0644]
playground/default-with-tests/README.md [new file with mode: 0644]
playground/default-with-tests/cypress.json [new file with mode: 0644]
playground/default-with-tests/cypress/fixtures/example.json [new file with mode: 0644]
playground/default-with-tests/cypress/integration/example.spec.js [new file with mode: 0644]
playground/default-with-tests/cypress/jsconfig.json [new file with mode: 0644]
playground/default-with-tests/cypress/plugins/index.js [new file with mode: 0644]
playground/default-with-tests/cypress/support/commands.js [new file with mode: 0644]
playground/default-with-tests/cypress/support/index.js [new file with mode: 0644]
playground/default-with-tests/index.html [new file with mode: 0644]
playground/default-with-tests/jsconfig.json [new file with mode: 0644]
playground/default-with-tests/package.json [new file with mode: 0644]
playground/default-with-tests/public/favicon.ico [new file with mode: 0644]
playground/default-with-tests/src/App.vue [new file with mode: 0644]
playground/default-with-tests/src/assets/logo.png [new file with mode: 0644]
playground/default-with-tests/src/components/HelloWorld.vue [new file with mode: 0644]
playground/default-with-tests/src/components/__tests__/HelloWorld.spec.js [new file with mode: 0644]
playground/default-with-tests/src/main.js [new file with mode: 0644]
playground/default-with-tests/src/shims-vue.d.ts [new file with mode: 0644]
playground/default-with-tests/src/vite-env.d.ts [new file with mode: 0644]
playground/default-with-tests/vite.config.js [new file with mode: 0644]
playground/default/.gitignore [new file with mode: 0644]
playground/default/README.md [new file with mode: 0644]
playground/default/index.html [new file with mode: 0644]
playground/default/jsconfig.json [new file with mode: 0644]
playground/default/package.json [new file with mode: 0644]
playground/default/public/favicon.ico [new file with mode: 0644]
playground/default/src/App.vue [new file with mode: 0644]
playground/default/src/assets/logo.png [new file with mode: 0644]
playground/default/src/components/HelloWorld.vue [new file with mode: 0644]
playground/default/src/main.js [new file with mode: 0644]
playground/default/src/shims-vue.d.ts [new file with mode: 0644]
playground/default/src/vite-env.d.ts [new file with mode: 0644]
playground/default/vite.config.js [new file with mode: 0644]
playground/spa-ts-with-tests/.gitignore [new file with mode: 0644]
playground/spa-ts-with-tests/README.md [new file with mode: 0644]
playground/spa-ts-with-tests/cypress.json [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/fixtures/example.json [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/integration/example.spec.ts [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/plugins/index.ts [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/support/commands.ts [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/support/index.ts [new file with mode: 0644]
playground/spa-ts-with-tests/cypress/tsconfig.json [new file with mode: 0644]
playground/spa-ts-with-tests/index.html [new file with mode: 0644]
playground/spa-ts-with-tests/package.json [new file with mode: 0644]
playground/spa-ts-with-tests/public/favicon.ico [new file with mode: 0644]
playground/spa-ts-with-tests/src/App.vue [new file with mode: 0644]
playground/spa-ts-with-tests/src/assets/logo.png [new file with mode: 0644]
playground/spa-ts-with-tests/src/components/HelloWorld.vue [new file with mode: 0644]
playground/spa-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts [new file with mode: 0644]
playground/spa-ts-with-tests/src/main.ts [new file with mode: 0644]
playground/spa-ts-with-tests/src/router/index.ts [new file with mode: 0644]
playground/spa-ts-with-tests/src/shims-vue.d.ts [new file with mode: 0644]
playground/spa-ts-with-tests/src/store/index.ts [new file with mode: 0644]
playground/spa-ts-with-tests/src/views/About.vue [new file with mode: 0644]
playground/spa-ts-with-tests/src/views/Home.vue [new file with mode: 0644]
playground/spa-ts-with-tests/src/vite-env.d.ts [new file with mode: 0644]
playground/spa-ts-with-tests/tsconfig.json [new file with mode: 0644]
playground/spa-ts-with-tests/vite.config.ts [new file with mode: 0644]
playground/spa-ts/.gitignore [new file with mode: 0644]
playground/spa-ts/README.md [new file with mode: 0644]
playground/spa-ts/index.html [new file with mode: 0644]
playground/spa-ts/package.json [new file with mode: 0644]
playground/spa-ts/public/favicon.ico [new file with mode: 0644]
playground/spa-ts/src/App.vue [new file with mode: 0644]
playground/spa-ts/src/assets/logo.png [new file with mode: 0644]
playground/spa-ts/src/components/HelloWorld.vue [new file with mode: 0644]
playground/spa-ts/src/main.ts [new file with mode: 0644]
playground/spa-ts/src/router/index.ts [new file with mode: 0644]
playground/spa-ts/src/shims-vue.d.ts [new file with mode: 0644]
playground/spa-ts/src/store/index.ts [new file with mode: 0644]
playground/spa-ts/src/views/About.vue [new file with mode: 0644]
playground/spa-ts/src/views/Home.vue [new file with mode: 0644]
playground/spa-ts/src/vite-env.d.ts [new file with mode: 0644]
playground/spa-ts/tsconfig.json [new file with mode: 0644]
playground/spa-ts/vite.config.ts [new file with mode: 0644]
playground/spa-with-tests/.gitignore [new file with mode: 0644]
playground/spa-with-tests/README.md [new file with mode: 0644]
playground/spa-with-tests/cypress.json [new file with mode: 0644]
playground/spa-with-tests/cypress/fixtures/example.json [new file with mode: 0644]
playground/spa-with-tests/cypress/integration/example.spec.js [new file with mode: 0644]
playground/spa-with-tests/cypress/jsconfig.json [new file with mode: 0644]
playground/spa-with-tests/cypress/plugins/index.js [new file with mode: 0644]
playground/spa-with-tests/cypress/support/commands.js [new file with mode: 0644]
playground/spa-with-tests/cypress/support/index.js [new file with mode: 0644]
playground/spa-with-tests/index.html [new file with mode: 0644]
playground/spa-with-tests/jsconfig.json [new file with mode: 0644]
playground/spa-with-tests/package.json [new file with mode: 0644]
playground/spa-with-tests/public/favicon.ico [new file with mode: 0644]
playground/spa-with-tests/src/App.vue [new file with mode: 0644]
playground/spa-with-tests/src/assets/logo.png [new file with mode: 0644]
playground/spa-with-tests/src/components/HelloWorld.vue [new file with mode: 0644]
playground/spa-with-tests/src/components/__tests__/HelloWorld.spec.js [new file with mode: 0644]
playground/spa-with-tests/src/main.js [new file with mode: 0644]
playground/spa-with-tests/src/router/index.js [new file with mode: 0644]
playground/spa-with-tests/src/shims-vue.d.ts [new file with mode: 0644]
playground/spa-with-tests/src/store/index.js [new file with mode: 0644]
playground/spa-with-tests/src/views/About.vue [new file with mode: 0644]
playground/spa-with-tests/src/views/Home.vue [new file with mode: 0644]
playground/spa-with-tests/src/vite-env.d.ts [new file with mode: 0644]
playground/spa-with-tests/vite.config.js [new file with mode: 0644]
playground/spa/.gitignore [new file with mode: 0644]
playground/spa/README.md [new file with mode: 0644]
playground/spa/index.html [new file with mode: 0644]
playground/spa/jsconfig.json [new file with mode: 0644]
playground/spa/package.json [new file with mode: 0644]
playground/spa/public/favicon.ico [new file with mode: 0644]
playground/spa/src/App.vue [new file with mode: 0644]
playground/spa/src/assets/logo.png [new file with mode: 0644]
playground/spa/src/components/HelloWorld.vue [new file with mode: 0644]
playground/spa/src/main.js [new file with mode: 0644]
playground/spa/src/router/index.js [new file with mode: 0644]
playground/spa/src/shims-vue.d.ts [new file with mode: 0644]
playground/spa/src/store/index.js [new file with mode: 0644]
playground/spa/src/views/About.vue [new file with mode: 0644]
playground/spa/src/views/Home.vue [new file with mode: 0644]
playground/spa/src/vite-env.d.ts [new file with mode: 0644]
playground/spa/vite.config.js [new file with mode: 0644]
snapshot.js [new file with mode: 0644]
utils/templateList.js [new file with mode: 0644]

index 7ec584bc450d99e7981dfe188aa6434fcfbf0f39..c762c60bfb4b15aa4ede7b77c04197c26984a1ef 100755 (executable)
--- a/index.js
+++ b/index.js
@@ -8,6 +8,7 @@ import minimist from 'minimist'
 import prompts from 'prompts'
 import { red, green, bold } from 'kolorist'
 
+import templateList from './utils/templateList.js'
 import renderTemplate from './utils/renderTemplate.js'
 import {
   postOrderDirectoryTraverse,
@@ -48,11 +49,8 @@ async function init() {
   let targetDir = argv._[0]
   const defaultProjectName = !targetDir ? 'vue-project' : targetDir
 
-  const TEMPLATE_LIST = ['default', 'spa']
-    .flatMap(x => [x, x + '-ts'])
-    .flatMap(x => [x, x + '-with-tests'])
   let template = argv.template || argv.t
-  const isValidTemplate = TEMPLATE_LIST.includes(template)
+  const isValidTemplate = templateList.includes(template)
 
   let result = {}
 
index c4c6000000e059d482570d031ae76dd84ee75302..17567eb94d286a8ecd484b3461c914f64ec62abd 100644 (file)
@@ -16,7 +16,8 @@
     "node": "^12.13.0 || ^14.0.0 || >= 16.0.0"
   },
   "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "prepublishOnly": "node snapshot.js"
   },
   "repository": {
     "type": "git",
diff --git a/playground/default-ts-with-tests/.gitignore b/playground/default-ts-with-tests/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/default-ts-with-tests/cypress.json b/playground/default-ts-with-tests/cypress.json
new file mode 100644 (file)
index 0000000..3d37225
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "baseUrl": "http://localhost:5050",
+  "component": {
+    "componentFolder": "src",
+    "testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
+  }
+}
diff --git a/playground/default-ts-with-tests/cypress/fixtures/example.json b/playground/default-ts-with-tests/cypress/fixtures/example.json
new file mode 100644 (file)
index 0000000..02e4254
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "hello@cypress.io",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/playground/default-ts-with-tests/cypress/integration/example.spec.ts b/playground/default-ts-with-tests/cypress/integration/example.spec.ts
new file mode 100644 (file)
index 0000000..bbe8f52
--- /dev/null
@@ -0,0 +1,8 @@
+// https://docs.cypress.io/api/introduction/api.html
+
+describe('My First Test', () => {
+  it('visits the app root url', () => {
+    cy.visit('/')
+    cy.contains('h1', 'Hello Vue 3 + TypeScript + Vite')
+  })
+})
diff --git a/playground/default-ts-with-tests/cypress/plugins/index.ts b/playground/default-ts-with-tests/cypress/plugins/index.ts
new file mode 100644 (file)
index 0000000..ad2e351
--- /dev/null
@@ -0,0 +1,28 @@
+/// <reference types="cypress" />
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+const { startDevServer } = require('@cypress/vite-dev-server')
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+module.exports = (on, config) => {
+  // `on` is used to hook into various events Cypress emits
+  // `config` is the resolved Cypress config
+  on('dev-server:start', (options) => {
+    return startDevServer({ options })
+  })
+  return config
+}
diff --git a/playground/default-ts-with-tests/cypress/support/commands.ts b/playground/default-ts-with-tests/cypress/support/commands.ts
new file mode 100644 (file)
index 0000000..119ab03
--- /dev/null
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
diff --git a/playground/default-ts-with-tests/cypress/support/index.ts b/playground/default-ts-with-tests/cypress/support/index.ts
new file mode 100644 (file)
index 0000000..d68db96
--- /dev/null
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
diff --git a/playground/default-ts-with-tests/cypress/tsconfig.json b/playground/default-ts-with-tests/cypress/tsconfig.json
new file mode 100644 (file)
index 0000000..b5b2f97
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "lib": ["es5", "dom"],
+    "types": ["cypress"]
+  },
+  "include": ["./**/*"]
+}
diff --git a/playground/default-ts-with-tests/index.html b/playground/default-ts-with-tests/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/default-ts-with-tests/package.json b/playground/default-ts-with-tests/package.json
new file mode 100644 (file)
index 0000000..b1e12f1
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "name": "default-ts-with-tests",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vue-tsc --noEmit && vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "test:unit": "cypress open-ct",
+    "test:unit:ci": "cypress run-ct --quiet --reporter spec",
+    "test:e2e": "start-server-and-test serve 5050 'cypress open'",
+    "test:e2e:ci": "start-server-and-test serve 5050 'cypress run'",
+    "typecheck": "vue-tsc --noEmit"
+  },
+  "dependencies": {
+    "vue": "^3.1.5"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "@cypress/vite-dev-server": "^2.0.2",
+    "@cypress/vue": "^3.0.1",
+    "cypress": "^8.0.0",
+    "start-server-and-test": "^1.12.6",
+    "typescript": "~4.3.5",
+    "vue-tsc": "^0.2.2"
+  }
+}
\ No newline at end of file
diff --git a/playground/default-ts-with-tests/public/favicon.ico b/playground/default-ts-with-tests/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/default-ts-with-tests/public/favicon.ico differ
diff --git a/playground/default-ts-with-tests/src/App.vue b/playground/default-ts-with-tests/src/App.vue
new file mode 100644 (file)
index 0000000..f1611b6
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="./assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
+</template>
+
+<script setup lang="ts">
+import HelloWorld from './components/HelloWorld.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>
diff --git a/playground/default-ts-with-tests/src/assets/logo.png b/playground/default-ts-with-tests/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/default-ts-with-tests/src/assets/logo.png differ
diff --git a/playground/default-ts-with-tests/src/components/HelloWorld.vue b/playground/default-ts-with-tests/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..2dac523
--- /dev/null
@@ -0,0 +1,54 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+
+defineProps<{
+  msg: String,
+}>()
+
+const count = ref(0)
+</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/playground/default-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts b/playground/default-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts
new file mode 100644 (file)
index 0000000..087c956
--- /dev/null
@@ -0,0 +1,22 @@
+import { mount } from '@cypress/vue'
+import HelloWorld from '../HelloWorld.vue'
+
+describe('HelloWorld', () => {
+  it('playground', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+  })
+
+  it('renders properly', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    cy.get('h1').should('contain', 'Hello Cypress')
+  })
+
+  it('adds 1 when clicking the plus button', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    
+    cy.get('button')
+      .should('contain', '0')
+      .click()
+      .should('contain', '1')
+  })
+})
diff --git a/playground/default-ts-with-tests/src/main.ts b/playground/default-ts-with-tests/src/main.ts
new file mode 100644 (file)
index 0000000..01433bc
--- /dev/null
@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')
diff --git a/playground/default-ts-with-tests/src/shims-vue.d.ts b/playground/default-ts-with-tests/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/default-ts-with-tests/src/vite-env.d.ts b/playground/default-ts-with-tests/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/playground/default-ts-with-tests/tsconfig.json b/playground/default-ts-with-tests/tsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/default-ts-with-tests/vite.config.ts b/playground/default-ts-with-tests/vite.config.ts
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/default-ts/.gitignore b/playground/default-ts/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/default-ts/README.md b/playground/default-ts/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/default-ts/index.html b/playground/default-ts/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/default-ts/package.json b/playground/default-ts/package.json
new file mode 100644 (file)
index 0000000..c12f476
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "name": "default-ts",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vue-tsc --noEmit && vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "typecheck": "vue-tsc --noEmit"
+  },
+  "dependencies": {
+    "vue": "^3.1.5"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "typescript": "~4.3.5",
+    "vue-tsc": "^0.2.2"
+  }
+}
\ No newline at end of file
diff --git a/playground/default-ts/public/favicon.ico b/playground/default-ts/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/default-ts/public/favicon.ico differ
diff --git a/playground/default-ts/src/App.vue b/playground/default-ts/src/App.vue
new file mode 100644 (file)
index 0000000..f1611b6
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="./assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
+</template>
+
+<script setup lang="ts">
+import HelloWorld from './components/HelloWorld.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>
diff --git a/playground/default-ts/src/assets/logo.png b/playground/default-ts/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/default-ts/src/assets/logo.png differ
diff --git a/playground/default-ts/src/components/HelloWorld.vue b/playground/default-ts/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..2dac523
--- /dev/null
@@ -0,0 +1,54 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+
+defineProps<{
+  msg: String,
+}>()
+
+const count = ref(0)
+</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/playground/default-ts/src/main.ts b/playground/default-ts/src/main.ts
new file mode 100644 (file)
index 0000000..01433bc
--- /dev/null
@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')
diff --git a/playground/default-ts/src/shims-vue.d.ts b/playground/default-ts/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/default-ts/src/vite-env.d.ts b/playground/default-ts/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/playground/default-ts/tsconfig.json b/playground/default-ts/tsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/default-ts/vite.config.ts b/playground/default-ts/vite.config.ts
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/default-with-tests/.gitignore b/playground/default-with-tests/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/default-with-tests/README.md b/playground/default-with-tests/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/default-with-tests/cypress.json b/playground/default-with-tests/cypress.json
new file mode 100644 (file)
index 0000000..3d37225
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "baseUrl": "http://localhost:5050",
+  "component": {
+    "componentFolder": "src",
+    "testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
+  }
+}
diff --git a/playground/default-with-tests/cypress/fixtures/example.json b/playground/default-with-tests/cypress/fixtures/example.json
new file mode 100644 (file)
index 0000000..02e4254
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "hello@cypress.io",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/playground/default-with-tests/cypress/integration/example.spec.js b/playground/default-with-tests/cypress/integration/example.spec.js
new file mode 100644 (file)
index 0000000..493bfcf
--- /dev/null
@@ -0,0 +1,8 @@
+// https://docs.cypress.io/api/introduction/api.html
+
+describe('My First Test', () => {
+  it('visits the app root url', () => {
+    cy.visit('/')
+    cy.contains('h1', 'Hello Vue 3 + Vite')
+  })
+})
diff --git a/playground/default-with-tests/cypress/jsconfig.json b/playground/default-with-tests/cypress/jsconfig.json
new file mode 100644 (file)
index 0000000..b5b2f97
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "lib": ["es5", "dom"],
+    "types": ["cypress"]
+  },
+  "include": ["./**/*"]
+}
diff --git a/playground/default-with-tests/cypress/plugins/index.js b/playground/default-with-tests/cypress/plugins/index.js
new file mode 100644 (file)
index 0000000..ad2e351
--- /dev/null
@@ -0,0 +1,28 @@
+/// <reference types="cypress" />
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+const { startDevServer } = require('@cypress/vite-dev-server')
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+module.exports = (on, config) => {
+  // `on` is used to hook into various events Cypress emits
+  // `config` is the resolved Cypress config
+  on('dev-server:start', (options) => {
+    return startDevServer({ options })
+  })
+  return config
+}
diff --git a/playground/default-with-tests/cypress/support/commands.js b/playground/default-with-tests/cypress/support/commands.js
new file mode 100644 (file)
index 0000000..119ab03
--- /dev/null
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
diff --git a/playground/default-with-tests/cypress/support/index.js b/playground/default-with-tests/cypress/support/index.js
new file mode 100644 (file)
index 0000000..d68db96
--- /dev/null
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
diff --git a/playground/default-with-tests/index.html b/playground/default-with-tests/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/default-with-tests/jsconfig.json b/playground/default-with-tests/jsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/default-with-tests/package.json b/playground/default-with-tests/package.json
new file mode 100644 (file)
index 0000000..44a3acf
--- /dev/null
@@ -0,0 +1,27 @@
+{
+  "name": "default-with-tests",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "test:unit": "cypress open-ct",
+    "test:unit:ci": "cypress run-ct --quiet --reporter spec",
+    "test:e2e": "start-server-and-test serve 5050 'cypress open'",
+    "test:e2e:ci": "start-server-and-test serve 5050 'cypress run'"
+  },
+  "dependencies": {
+    "vue": "^3.1.5"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "@cypress/vite-dev-server": "^2.0.2",
+    "@cypress/vue": "^3.0.1",
+    "cypress": "^8.0.0",
+    "start-server-and-test": "^1.12.6"
+  }
+}
\ No newline at end of file
diff --git a/playground/default-with-tests/public/favicon.ico b/playground/default-with-tests/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/default-with-tests/public/favicon.ico differ
diff --git a/playground/default-with-tests/src/App.vue b/playground/default-with-tests/src/App.vue
new file mode 100644 (file)
index 0000000..a058d17
--- /dev/null
@@ -0,0 +1,22 @@
+<template>
+  <img alt="Vue logo" src="./assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + Vite" />
+</template>
+
+<script setup>
+import HelloWorld from './components/HelloWorld.vue'
+
+// This starter template is using Vue 3 experimental <script setup> SFCs
+// Check out https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md
+</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>
diff --git a/playground/default-with-tests/src/assets/logo.png b/playground/default-with-tests/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/default-with-tests/src/assets/logo.png differ
diff --git a/playground/default-with-tests/src/components/HelloWorld.vue b/playground/default-with-tests/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..36a089f
--- /dev/null
@@ -0,0 +1,38 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    <a href="https://vitejs.dev/guide/features.html" target="_blank">
+      Vite Documentation
+    </a>
+    |
+    <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
+  </p>
+
+  <button type="button" @click="state.count++">
+    count is: {{ state.count }}
+  </button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+
+defineProps({
+  msg: {
+    type: String,
+    required: true
+  }
+})
+
+const count = ref(0)
+</script>
+
+<style scoped>
+a {
+  color: #42b983;
+}
+</style>
diff --git a/playground/default-with-tests/src/components/__tests__/HelloWorld.spec.js b/playground/default-with-tests/src/components/__tests__/HelloWorld.spec.js
new file mode 100644 (file)
index 0000000..087c956
--- /dev/null
@@ -0,0 +1,22 @@
+import { mount } from '@cypress/vue'
+import HelloWorld from '../HelloWorld.vue'
+
+describe('HelloWorld', () => {
+  it('playground', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+  })
+
+  it('renders properly', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    cy.get('h1').should('contain', 'Hello Cypress')
+  })
+
+  it('adds 1 when clicking the plus button', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    
+    cy.get('button')
+      .should('contain', '0')
+      .click()
+      .should('contain', '1')
+  })
+})
diff --git a/playground/default-with-tests/src/main.js b/playground/default-with-tests/src/main.js
new file mode 100644 (file)
index 0000000..01433bc
--- /dev/null
@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')
diff --git a/playground/default-with-tests/src/shims-vue.d.ts b/playground/default-with-tests/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/default-with-tests/src/vite-env.d.ts b/playground/default-with-tests/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/playground/default-with-tests/vite.config.js b/playground/default-with-tests/vite.config.js
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/default/.gitignore b/playground/default/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/default/README.md b/playground/default/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/default/index.html b/playground/default/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/default/jsconfig.json b/playground/default/jsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/default/package.json b/playground/default/package.json
new file mode 100644 (file)
index 0000000..0ff042c
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  "name": "default",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050"
+  },
+  "dependencies": {
+    "vue": "^3.1.5"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3"
+  }
+}
\ No newline at end of file
diff --git a/playground/default/public/favicon.ico b/playground/default/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/default/public/favicon.ico differ
diff --git a/playground/default/src/App.vue b/playground/default/src/App.vue
new file mode 100644 (file)
index 0000000..a058d17
--- /dev/null
@@ -0,0 +1,22 @@
+<template>
+  <img alt="Vue logo" src="./assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + Vite" />
+</template>
+
+<script setup>
+import HelloWorld from './components/HelloWorld.vue'
+
+// This starter template is using Vue 3 experimental <script setup> SFCs
+// Check out https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md
+</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>
diff --git a/playground/default/src/assets/logo.png b/playground/default/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/default/src/assets/logo.png differ
diff --git a/playground/default/src/components/HelloWorld.vue b/playground/default/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..36a089f
--- /dev/null
@@ -0,0 +1,38 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    <a href="https://vitejs.dev/guide/features.html" target="_blank">
+      Vite Documentation
+    </a>
+    |
+    <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
+  </p>
+
+  <button type="button" @click="state.count++">
+    count is: {{ state.count }}
+  </button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+
+defineProps({
+  msg: {
+    type: String,
+    required: true
+  }
+})
+
+const count = ref(0)
+</script>
+
+<style scoped>
+a {
+  color: #42b983;
+}
+</style>
diff --git a/playground/default/src/main.js b/playground/default/src/main.js
new file mode 100644 (file)
index 0000000..01433bc
--- /dev/null
@@ -0,0 +1,4 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+createApp(App).mount('#app')
diff --git a/playground/default/src/shims-vue.d.ts b/playground/default/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/default/src/vite-env.d.ts b/playground/default/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/playground/default/vite.config.js b/playground/default/vite.config.js
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/spa-ts-with-tests/.gitignore b/playground/spa-ts-with-tests/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/spa-ts-with-tests/README.md b/playground/spa-ts-with-tests/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/spa-ts-with-tests/cypress.json b/playground/spa-ts-with-tests/cypress.json
new file mode 100644 (file)
index 0000000..3d37225
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "baseUrl": "http://localhost:5050",
+  "component": {
+    "componentFolder": "src",
+    "testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
+  }
+}
diff --git a/playground/spa-ts-with-tests/cypress/fixtures/example.json b/playground/spa-ts-with-tests/cypress/fixtures/example.json
new file mode 100644 (file)
index 0000000..02e4254
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "hello@cypress.io",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/playground/spa-ts-with-tests/cypress/integration/example.spec.ts b/playground/spa-ts-with-tests/cypress/integration/example.spec.ts
new file mode 100644 (file)
index 0000000..3898b0c
--- /dev/null
@@ -0,0 +1,13 @@
+// https://docs.cypress.io/api/introduction/api.html
+
+describe('My First Test', () => {
+  it('visits the app root url', () => {
+    cy.visit('/')
+    cy.contains('h1', 'Hello Vue 3 + TypeScript + Vite')
+  })
+
+  it('navigates to the about page', () => {
+    cy.visit('/about')
+    cy.contains('h1', 'This is an about page')
+  })
+})
diff --git a/playground/spa-ts-with-tests/cypress/plugins/index.ts b/playground/spa-ts-with-tests/cypress/plugins/index.ts
new file mode 100644 (file)
index 0000000..ad2e351
--- /dev/null
@@ -0,0 +1,28 @@
+/// <reference types="cypress" />
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+const { startDevServer } = require('@cypress/vite-dev-server')
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+module.exports = (on, config) => {
+  // `on` is used to hook into various events Cypress emits
+  // `config` is the resolved Cypress config
+  on('dev-server:start', (options) => {
+    return startDevServer({ options })
+  })
+  return config
+}
diff --git a/playground/spa-ts-with-tests/cypress/support/commands.ts b/playground/spa-ts-with-tests/cypress/support/commands.ts
new file mode 100644 (file)
index 0000000..119ab03
--- /dev/null
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
diff --git a/playground/spa-ts-with-tests/cypress/support/index.ts b/playground/spa-ts-with-tests/cypress/support/index.ts
new file mode 100644 (file)
index 0000000..d68db96
--- /dev/null
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
diff --git a/playground/spa-ts-with-tests/cypress/tsconfig.json b/playground/spa-ts-with-tests/cypress/tsconfig.json
new file mode 100644 (file)
index 0000000..b5b2f97
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "lib": ["es5", "dom"],
+    "types": ["cypress"]
+  },
+  "include": ["./**/*"]
+}
diff --git a/playground/spa-ts-with-tests/index.html b/playground/spa-ts-with-tests/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/spa-ts-with-tests/package.json b/playground/spa-ts-with-tests/package.json
new file mode 100644 (file)
index 0000000..45ac722
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "name": "spa-ts-with-tests",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vue-tsc --noEmit && vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "test:unit": "cypress open-ct",
+    "test:unit:ci": "cypress run-ct --quiet --reporter spec",
+    "test:e2e": "start-server-and-test serve 5050 'cypress open'",
+    "test:e2e:ci": "start-server-and-test serve 5050 'cypress run'",
+    "typecheck": "vue-tsc --noEmit"
+  },
+  "dependencies": {
+    "vue": "^3.1.5",
+    "vue-router": "^4.0.10",
+    "vuex": "^4.0.2"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "@cypress/vite-dev-server": "^2.0.2",
+    "@cypress/vue": "^3.0.1",
+    "cypress": "^8.0.0",
+    "start-server-and-test": "^1.12.6",
+    "typescript": "~4.3.5",
+    "vue-tsc": "^0.2.2"
+  }
+}
\ No newline at end of file
diff --git a/playground/spa-ts-with-tests/public/favicon.ico b/playground/spa-ts-with-tests/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/spa-ts-with-tests/public/favicon.ico differ
diff --git a/playground/spa-ts-with-tests/src/App.vue b/playground/spa-ts-with-tests/src/App.vue
new file mode 100644 (file)
index 0000000..b964355
--- /dev/null
@@ -0,0 +1,30 @@
+<template>
+  <div id="nav">
+    <router-link to="/">Home</router-link> |
+    <router-link to="/about">About</router-link>
+  </div>
+  <router-view/>
+</template>
+
+<style>
+#app {
+  font-family: Avenir, Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  text-align: center;
+  color: #2c3e50;
+}
+
+#nav {
+  padding: 30px;
+}
+
+#nav a {
+  font-weight: bold;
+  color: #2c3e50;
+}
+
+#nav a.router-link-exact-active {
+  color: #42b983;
+}
+</style>
diff --git a/playground/spa-ts-with-tests/src/assets/logo.png b/playground/spa-ts-with-tests/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/spa-ts-with-tests/src/assets/logo.png differ
diff --git a/playground/spa-ts-with-tests/src/components/HelloWorld.vue b/playground/spa-ts-with-tests/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..2dac523
--- /dev/null
@@ -0,0 +1,54 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+
+defineProps<{
+  msg: String,
+}>()
+
+const count = ref(0)
+</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/playground/spa-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts b/playground/spa-ts-with-tests/src/components/__tests__/HelloWorld.spec.ts
new file mode 100644 (file)
index 0000000..087c956
--- /dev/null
@@ -0,0 +1,22 @@
+import { mount } from '@cypress/vue'
+import HelloWorld from '../HelloWorld.vue'
+
+describe('HelloWorld', () => {
+  it('playground', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+  })
+
+  it('renders properly', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    cy.get('h1').should('contain', 'Hello Cypress')
+  })
+
+  it('adds 1 when clicking the plus button', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    
+    cy.get('button')
+      .should('contain', '0')
+      .click()
+      .should('contain', '1')
+  })
+})
diff --git a/playground/spa-ts-with-tests/src/main.ts b/playground/spa-ts-with-tests/src/main.ts
new file mode 100644 (file)
index 0000000..ab55e6d
--- /dev/null
@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+import router from './router'
+import store from './store'
+
+const app = createApp(App)
+
+app.use(router)
+app.use(store)
+
+app.mount('#app')
diff --git a/playground/spa-ts-with-tests/src/router/index.ts b/playground/spa-ts-with-tests/src/router/index.ts
new file mode 100644 (file)
index 0000000..0603628
--- /dev/null
@@ -0,0 +1,27 @@
+import { createRouter, createWebHistory } from 'vue-router'
+import type { RouteRecordRaw } from 'vue-router'
+
+import Home from '../views/Home.vue'
+
+const routes: Array<RouteRecordRaw> = [
+  {
+    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('../views/About.vue')
+  }
+]
+
+const router = createRouter({
+  history: createWebHistory(import.meta.env.BASE_URL),
+  routes
+})
+
+export default router
diff --git a/playground/spa-ts-with-tests/src/shims-vue.d.ts b/playground/spa-ts-with-tests/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/spa-ts-with-tests/src/store/index.ts b/playground/spa-ts-with-tests/src/store/index.ts
new file mode 100644 (file)
index 0000000..5f05f19
--- /dev/null
@@ -0,0 +1,12 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+  },
+  mutations: {
+  },
+  actions: {
+  },
+  modules: {
+  }
+})
diff --git a/playground/spa-ts-with-tests/src/views/About.vue b/playground/spa-ts-with-tests/src/views/About.vue
new file mode 100644 (file)
index 0000000..3fa2807
--- /dev/null
@@ -0,0 +1,5 @@
+<template>
+  <div class="about">
+    <h1>This is an about page</h1>
+  </div>
+</template>
diff --git a/playground/spa-ts-with-tests/src/views/Home.vue b/playground/spa-ts-with-tests/src/views/Home.vue
new file mode 100644 (file)
index 0000000..4ade1db
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="@/assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
+</template>
+
+<script setup lang="ts">
+import HelloWorld from '@/components/HelloWorld.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>
diff --git a/playground/spa-ts-with-tests/src/vite-env.d.ts b/playground/spa-ts-with-tests/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/playground/spa-ts-with-tests/tsconfig.json b/playground/spa-ts-with-tests/tsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/spa-ts-with-tests/vite.config.ts b/playground/spa-ts-with-tests/vite.config.ts
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/spa-ts/.gitignore b/playground/spa-ts/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/spa-ts/README.md b/playground/spa-ts/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/spa-ts/index.html b/playground/spa-ts/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/spa-ts/package.json b/playground/spa-ts/package.json
new file mode 100644 (file)
index 0000000..c9ae486
--- /dev/null
@@ -0,0 +1,24 @@
+{
+  "name": "spa-ts",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vue-tsc --noEmit && vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "typecheck": "vue-tsc --noEmit"
+  },
+  "dependencies": {
+    "vue": "^3.1.5",
+    "vue-router": "^4.0.10",
+    "vuex": "^4.0.2"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "typescript": "~4.3.5",
+    "vue-tsc": "^0.2.2"
+  }
+}
\ No newline at end of file
diff --git a/playground/spa-ts/public/favicon.ico b/playground/spa-ts/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/spa-ts/public/favicon.ico differ
diff --git a/playground/spa-ts/src/App.vue b/playground/spa-ts/src/App.vue
new file mode 100644 (file)
index 0000000..b964355
--- /dev/null
@@ -0,0 +1,30 @@
+<template>
+  <div id="nav">
+    <router-link to="/">Home</router-link> |
+    <router-link to="/about">About</router-link>
+  </div>
+  <router-view/>
+</template>
+
+<style>
+#app {
+  font-family: Avenir, Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  text-align: center;
+  color: #2c3e50;
+}
+
+#nav {
+  padding: 30px;
+}
+
+#nav a {
+  font-weight: bold;
+  color: #2c3e50;
+}
+
+#nav a.router-link-exact-active {
+  color: #42b983;
+}
+</style>
diff --git a/playground/spa-ts/src/assets/logo.png b/playground/spa-ts/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/spa-ts/src/assets/logo.png differ
diff --git a/playground/spa-ts/src/components/HelloWorld.vue b/playground/spa-ts/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..2dac523
--- /dev/null
@@ -0,0 +1,54 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+
+defineProps<{
+  msg: String,
+}>()
+
+const count = ref(0)
+</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/playground/spa-ts/src/main.ts b/playground/spa-ts/src/main.ts
new file mode 100644 (file)
index 0000000..ab55e6d
--- /dev/null
@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+import router from './router'
+import store from './store'
+
+const app = createApp(App)
+
+app.use(router)
+app.use(store)
+
+app.mount('#app')
diff --git a/playground/spa-ts/src/router/index.ts b/playground/spa-ts/src/router/index.ts
new file mode 100644 (file)
index 0000000..0603628
--- /dev/null
@@ -0,0 +1,27 @@
+import { createRouter, createWebHistory } from 'vue-router'
+import type { RouteRecordRaw } from 'vue-router'
+
+import Home from '../views/Home.vue'
+
+const routes: Array<RouteRecordRaw> = [
+  {
+    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('../views/About.vue')
+  }
+]
+
+const router = createRouter({
+  history: createWebHistory(import.meta.env.BASE_URL),
+  routes
+})
+
+export default router
diff --git a/playground/spa-ts/src/shims-vue.d.ts b/playground/spa-ts/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/spa-ts/src/store/index.ts b/playground/spa-ts/src/store/index.ts
new file mode 100644 (file)
index 0000000..5f05f19
--- /dev/null
@@ -0,0 +1,12 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+  },
+  mutations: {
+  },
+  actions: {
+  },
+  modules: {
+  }
+})
diff --git a/playground/spa-ts/src/views/About.vue b/playground/spa-ts/src/views/About.vue
new file mode 100644 (file)
index 0000000..3fa2807
--- /dev/null
@@ -0,0 +1,5 @@
+<template>
+  <div class="about">
+    <h1>This is an about page</h1>
+  </div>
+</template>
diff --git a/playground/spa-ts/src/views/Home.vue b/playground/spa-ts/src/views/Home.vue
new file mode 100644 (file)
index 0000000..4ade1db
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="@/assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
+</template>
+
+<script setup lang="ts">
+import HelloWorld from '@/components/HelloWorld.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>
diff --git a/playground/spa-ts/src/vite-env.d.ts b/playground/spa-ts/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/playground/spa-ts/tsconfig.json b/playground/spa-ts/tsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/spa-ts/vite.config.ts b/playground/spa-ts/vite.config.ts
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/spa-with-tests/.gitignore b/playground/spa-with-tests/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/spa-with-tests/README.md b/playground/spa-with-tests/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/spa-with-tests/cypress.json b/playground/spa-with-tests/cypress.json
new file mode 100644 (file)
index 0000000..3d37225
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "baseUrl": "http://localhost:5050",
+  "component": {
+    "componentFolder": "src",
+    "testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
+  }
+}
diff --git a/playground/spa-with-tests/cypress/fixtures/example.json b/playground/spa-with-tests/cypress/fixtures/example.json
new file mode 100644 (file)
index 0000000..02e4254
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "hello@cypress.io",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}
diff --git a/playground/spa-with-tests/cypress/integration/example.spec.js b/playground/spa-with-tests/cypress/integration/example.spec.js
new file mode 100644 (file)
index 0000000..ec952ec
--- /dev/null
@@ -0,0 +1,13 @@
+// https://docs.cypress.io/api/introduction/api.html
+
+describe('My First Test', () => {
+  it('visits the app root url', () => {
+    cy.visit('/')
+    cy.contains('h1', 'Hello Vue 3 + Vite')
+  })
+
+  it('navigates to the about page', () => {
+    cy.visit('/about')
+    cy.contains('h1', 'This is an about page')
+  })
+})
diff --git a/playground/spa-with-tests/cypress/jsconfig.json b/playground/spa-with-tests/cypress/jsconfig.json
new file mode 100644 (file)
index 0000000..b5b2f97
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "lib": ["es5", "dom"],
+    "types": ["cypress"]
+  },
+  "include": ["./**/*"]
+}
diff --git a/playground/spa-with-tests/cypress/plugins/index.js b/playground/spa-with-tests/cypress/plugins/index.js
new file mode 100644 (file)
index 0000000..ad2e351
--- /dev/null
@@ -0,0 +1,28 @@
+/// <reference types="cypress" />
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+const { startDevServer } = require('@cypress/vite-dev-server')
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+// eslint-disable-next-line no-unused-vars
+module.exports = (on, config) => {
+  // `on` is used to hook into various events Cypress emits
+  // `config` is the resolved Cypress config
+  on('dev-server:start', (options) => {
+    return startDevServer({ options })
+  })
+  return config
+}
diff --git a/playground/spa-with-tests/cypress/support/commands.js b/playground/spa-with-tests/cypress/support/commands.js
new file mode 100644 (file)
index 0000000..119ab03
--- /dev/null
@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
diff --git a/playground/spa-with-tests/cypress/support/index.js b/playground/spa-with-tests/cypress/support/index.js
new file mode 100644 (file)
index 0000000..d68db96
--- /dev/null
@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
diff --git a/playground/spa-with-tests/index.html b/playground/spa-with-tests/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/spa-with-tests/jsconfig.json b/playground/spa-with-tests/jsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/spa-with-tests/package.json b/playground/spa-with-tests/package.json
new file mode 100644 (file)
index 0000000..443e5f8
--- /dev/null
@@ -0,0 +1,29 @@
+{
+  "name": "spa-with-tests",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050",
+    "test:unit": "cypress open-ct",
+    "test:unit:ci": "cypress run-ct --quiet --reporter spec",
+    "test:e2e": "start-server-and-test serve 5050 'cypress open'",
+    "test:e2e:ci": "start-server-and-test serve 5050 'cypress run'"
+  },
+  "dependencies": {
+    "vue": "^3.1.5",
+    "vue-router": "^4.0.10",
+    "vuex": "^4.0.2"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3",
+    "@cypress/vite-dev-server": "^2.0.2",
+    "@cypress/vue": "^3.0.1",
+    "cypress": "^8.0.0",
+    "start-server-and-test": "^1.12.6"
+  }
+}
\ No newline at end of file
diff --git a/playground/spa-with-tests/public/favicon.ico b/playground/spa-with-tests/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/spa-with-tests/public/favicon.ico differ
diff --git a/playground/spa-with-tests/src/App.vue b/playground/spa-with-tests/src/App.vue
new file mode 100644 (file)
index 0000000..b964355
--- /dev/null
@@ -0,0 +1,30 @@
+<template>
+  <div id="nav">
+    <router-link to="/">Home</router-link> |
+    <router-link to="/about">About</router-link>
+  </div>
+  <router-view/>
+</template>
+
+<style>
+#app {
+  font-family: Avenir, Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  text-align: center;
+  color: #2c3e50;
+}
+
+#nav {
+  padding: 30px;
+}
+
+#nav a {
+  font-weight: bold;
+  color: #2c3e50;
+}
+
+#nav a.router-link-exact-active {
+  color: #42b983;
+}
+</style>
diff --git a/playground/spa-with-tests/src/assets/logo.png b/playground/spa-with-tests/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/spa-with-tests/src/assets/logo.png differ
diff --git a/playground/spa-with-tests/src/components/HelloWorld.vue b/playground/spa-with-tests/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..51f81a8
--- /dev/null
@@ -0,0 +1,57 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+
+defineProps({
+  msg: {
+    type: String,
+    required: true
+  }
+})
+
+const count = ref(0)
+</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/playground/spa-with-tests/src/components/__tests__/HelloWorld.spec.js b/playground/spa-with-tests/src/components/__tests__/HelloWorld.spec.js
new file mode 100644 (file)
index 0000000..087c956
--- /dev/null
@@ -0,0 +1,22 @@
+import { mount } from '@cypress/vue'
+import HelloWorld from '../HelloWorld.vue'
+
+describe('HelloWorld', () => {
+  it('playground', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+  })
+
+  it('renders properly', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    cy.get('h1').should('contain', 'Hello Cypress')
+  })
+
+  it('adds 1 when clicking the plus button', () => {
+    mount(HelloWorld, { props: { msg: 'Hello Cypress' } })
+    
+    cy.get('button')
+      .should('contain', '0')
+      .click()
+      .should('contain', '1')
+  })
+})
diff --git a/playground/spa-with-tests/src/main.js b/playground/spa-with-tests/src/main.js
new file mode 100644 (file)
index 0000000..ab55e6d
--- /dev/null
@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+import router from './router'
+import store from './store'
+
+const app = createApp(App)
+
+app.use(router)
+app.use(store)
+
+app.mount('#app')
diff --git a/playground/spa-with-tests/src/router/index.js b/playground/spa-with-tests/src/router/index.js
new file mode 100644 (file)
index 0000000..26bf8e7
--- /dev/null
@@ -0,0 +1,25 @@
+import { createRouter, createWebHistory } from 'vue-router'
+import Home from '../views/Home.vue'
+
+const routes = [
+  {
+    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('../views/About.vue')
+  }
+]
+
+const router = createRouter({
+  history: createWebHistory(import.meta.env.BASE_URL),
+  routes
+})
+
+export default router
diff --git a/playground/spa-with-tests/src/shims-vue.d.ts b/playground/spa-with-tests/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/spa-with-tests/src/store/index.js b/playground/spa-with-tests/src/store/index.js
new file mode 100644 (file)
index 0000000..5f05f19
--- /dev/null
@@ -0,0 +1,12 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+  },
+  mutations: {
+  },
+  actions: {
+  },
+  modules: {
+  }
+})
diff --git a/playground/spa-with-tests/src/views/About.vue b/playground/spa-with-tests/src/views/About.vue
new file mode 100644 (file)
index 0000000..3fa2807
--- /dev/null
@@ -0,0 +1,5 @@
+<template>
+  <div class="about">
+    <h1>This is an about page</h1>
+  </div>
+</template>
diff --git a/playground/spa-with-tests/src/views/Home.vue b/playground/spa-with-tests/src/views/Home.vue
new file mode 100644 (file)
index 0000000..d74dda2
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="@/assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + Vite" />
+</template>
+
+<script setup>
+import HelloWorld from '@/components/HelloWorld.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>
diff --git a/playground/spa-with-tests/src/vite-env.d.ts b/playground/spa-with-tests/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/playground/spa-with-tests/vite.config.js b/playground/spa-with-tests/vite.config.js
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/playground/spa/.gitignore b/playground/spa/.gitignore
new file mode 100644 (file)
index 0000000..133da84
--- /dev/null
@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+dist-ssr
+*.local
+
+/cypress/videos/
+/cypress/screenshots/
+
+# Editor directories and files
+.vscode
+!.vscode/extensions.json
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/playground/spa/README.md b/playground/spa/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/playground/spa/index.html b/playground/spa/index.html
new file mode 100644 (file)
index 0000000..11603f8
--- /dev/null
@@ -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/playground/spa/jsconfig.json b/playground/spa/jsconfig.json
new file mode 100644 (file)
index 0000000..d3adf1b
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "target": "esnext",
+    "useDefineForClassFields": true,
+    "module": "esnext",
+    "moduleResolution": "node",
+    "strict": true,
+    "jsx": "preserve",
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "esModuleInterop": true,
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
+    "skipLibCheck": true
+  },
+  "include": [
+    "vite.config.*",
+
+    "src/**/*",
+    "src/**/*.vue"
+  ],
+  "exclude": [
+    "src/**/__tests__/**"
+  ]
+}
diff --git a/playground/spa/package.json b/playground/spa/package.json
new file mode 100644 (file)
index 0000000..a98131e
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "name": "spa",
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build",
+    "preserve": "vite build",
+    "serve": "vite preview --port 5050"
+  },
+  "dependencies": {
+    "vue": "^3.1.5",
+    "vue-router": "^4.0.10",
+    "vuex": "^4.0.2"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^1.2.5",
+    "@vitejs/plugin-vue-jsx": "^1.1.6",
+    "@vue/compiler-sfc": "^3.1.5",
+    "vite": "^2.4.3"
+  }
+}
\ No newline at end of file
diff --git a/playground/spa/public/favicon.ico b/playground/spa/public/favicon.ico
new file mode 100644 (file)
index 0000000..df36fcf
Binary files /dev/null and b/playground/spa/public/favicon.ico differ
diff --git a/playground/spa/src/App.vue b/playground/spa/src/App.vue
new file mode 100644 (file)
index 0000000..b964355
--- /dev/null
@@ -0,0 +1,30 @@
+<template>
+  <div id="nav">
+    <router-link to="/">Home</router-link> |
+    <router-link to="/about">About</router-link>
+  </div>
+  <router-view/>
+</template>
+
+<style>
+#app {
+  font-family: Avenir, Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  text-align: center;
+  color: #2c3e50;
+}
+
+#nav {
+  padding: 30px;
+}
+
+#nav a {
+  font-weight: bold;
+  color: #2c3e50;
+}
+
+#nav a.router-link-exact-active {
+  color: #42b983;
+}
+</style>
diff --git a/playground/spa/src/assets/logo.png b/playground/spa/src/assets/logo.png
new file mode 100644 (file)
index 0000000..f3d2503
Binary files /dev/null and b/playground/spa/src/assets/logo.png differ
diff --git a/playground/spa/src/components/HelloWorld.vue b/playground/spa/src/components/HelloWorld.vue
new file mode 100644 (file)
index 0000000..51f81a8
--- /dev/null
@@ -0,0 +1,57 @@
+<template>
+  <h1>{{ msg }}</h1>
+
+  <p>
+    Recommended IDE setup:
+    <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+    +
+    <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
+  </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 type="button" @click="count++">count is: {{ count }}</button>
+  <p>
+    Edit
+    <code>components/HelloWorld.vue</code> to test hot module replacement.
+  </p>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+
+defineProps({
+  msg: {
+    type: String,
+    required: true
+  }
+})
+
+const count = ref(0)
+</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/playground/spa/src/main.js b/playground/spa/src/main.js
new file mode 100644 (file)
index 0000000..ab55e6d
--- /dev/null
@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+
+import router from './router'
+import store from './store'
+
+const app = createApp(App)
+
+app.use(router)
+app.use(store)
+
+app.mount('#app')
diff --git a/playground/spa/src/router/index.js b/playground/spa/src/router/index.js
new file mode 100644 (file)
index 0000000..26bf8e7
--- /dev/null
@@ -0,0 +1,25 @@
+import { createRouter, createWebHistory } from 'vue-router'
+import Home from '../views/Home.vue'
+
+const routes = [
+  {
+    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('../views/About.vue')
+  }
+]
+
+const router = createRouter({
+  history: createWebHistory(import.meta.env.BASE_URL),
+  routes
+})
+
+export default router
diff --git a/playground/spa/src/shims-vue.d.ts b/playground/spa/src/shims-vue.d.ts
new file mode 100644 (file)
index 0000000..ec4f1b2
--- /dev/null
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+  import { DefineComponent } from 'vue'
+  // eslint-disable-next-line
+  const component: DefineComponent<{}, {}, any>
+  export default component
+}
diff --git a/playground/spa/src/store/index.js b/playground/spa/src/store/index.js
new file mode 100644 (file)
index 0000000..5f05f19
--- /dev/null
@@ -0,0 +1,12 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+  },
+  mutations: {
+  },
+  actions: {
+  },
+  modules: {
+  }
+})
diff --git a/playground/spa/src/views/About.vue b/playground/spa/src/views/About.vue
new file mode 100644 (file)
index 0000000..3fa2807
--- /dev/null
@@ -0,0 +1,5 @@
+<template>
+  <div class="about">
+    <h1>This is an about page</h1>
+  </div>
+</template>
diff --git a/playground/spa/src/views/Home.vue b/playground/spa/src/views/Home.vue
new file mode 100644 (file)
index 0000000..d74dda2
--- /dev/null
@@ -0,0 +1,19 @@
+<template>
+  <img alt="Vue logo" src="@/assets/logo.png" />
+  <HelloWorld msg="Hello Vue 3 + Vite" />
+</template>
+
+<script setup>
+import HelloWorld from '@/components/HelloWorld.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>
diff --git a/playground/spa/src/vite-env.d.ts b/playground/spa/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/playground/spa/vite.config.js b/playground/spa/vite.config.js
new file mode 100644 (file)
index 0000000..8ae6fd0
--- /dev/null
@@ -0,0 +1,13 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+  plugins: [vue(), vueJsx()],
+  resolve: {
+    alias: {
+      '@/': new URL('./src/', import.meta.url).pathname,
+    },
+  }
+})
diff --git a/snapshot.js b/snapshot.js
new file mode 100644 (file)
index 0000000..53b0c5f
--- /dev/null
@@ -0,0 +1,13 @@
+import templateList from './utils/templateList.js'
+import { spawnSync } from 'child_process'
+
+for (const template of templateList) {
+  spawnSync('node', [
+    new URL('./index.js', import.meta.url).pathname,
+    template,
+    '--template',
+    template
+  ], {
+    cwd: new URL('./playground/', import.meta.url).pathname
+  })
+}
diff --git a/utils/templateList.js b/utils/templateList.js
new file mode 100644 (file)
index 0000000..cdcb422
--- /dev/null
@@ -0,0 +1,5 @@
+const templateList = ['default', 'spa']
+  .flatMap(x => [x, x + '-ts'])
+  .flatMap(x => [x, x + '-with-tests'])
+
+export default templateList