Skip to content

Commit

Permalink
feat(wc-vue3) - added empty vue 3 app (#311)
Browse files Browse the repository at this point in the history
* feat(wc-vue3) - added empty vue 3 app

chore(wc-vue3) - simplified setup
chore(wc-vue3) - updated yarn.lock
chore(wc-vue3) - added eslint config

* chore(wc-vue3) - changeset

* chore(wc-vue3) - remove unnecessary vue plugin
  • Loading branch information
fernandofranca authored Mar 14, 2023
1 parent 798b5fe commit 7a9aff2
Show file tree
Hide file tree
Showing 14 changed files with 489 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-mayflies-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wc-vue3": minor
---

[Added] - example vue app for testing web components
12 changes: 12 additions & 0 deletions apps/examples/wc-vue3/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { vue, vue3 } = require('@justeattakeaway/pie-eslint-config/frameworks');

module.exports = {
extends: [
require.resolve('@justeattakeaway/pie-eslint-config/strict'),
'plugin:vue/vue3-recommended'
],
rules: {
...vue.rules, ...vue3.rules, 'vue/sort-keys': 'off',
},
};
28 changes: 28 additions & 0 deletions apps/examples/wc-vue3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
40 changes: 40 additions & 0 deletions apps/examples/wc-vue3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# wc-vue3

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:

1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
yarn
```

### Compile and Hot-Reload for Development

```sh
yarn dev
```

### Type-Check, Compile and Minify for Production

```sh
yarn build
```
1 change: 1 addition & 0 deletions apps/examples/wc-vue3/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions apps/examples/wc-vue3/index.html
Original file line number Diff line number Diff line change
@@ -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>wc-vue3</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions apps/examples/wc-vue3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "wc-vue3",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@vitejs/plugin-vue": "4.0.0",
"vite": "4.1.4",
"vue": "3.2.47"
},
"devDependencies": {
"@types/node": "18.14.2",
"@vue/tsconfig": "0.1.3",
"npm-run-all": "4.1.5",
"typescript": "~4.8.4",
"vue-tsc": "1.2.0"
}
}
Binary file added apps/examples/wc-vue3/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/examples/wc-vue3/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Hello World!</div>
</template>
4 changes: 4 additions & 0 deletions apps/examples/wc-vue3/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#app');
16 changes: 16 additions & 0 deletions apps/examples/wc-vue3/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},

"references": [
{
"path": "./tsconfig.node.json"
}
]
}
8 changes: 8 additions & 0 deletions apps/examples/wc-vue3/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
}
7 changes: 7 additions & 0 deletions apps/examples/wc-vue3/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
});
Loading

0 comments on commit 7a9aff2

Please sign in to comment.