Skip to content

Commit

Permalink
Merge pull request #75 from edgio-docs/v7-vue3
Browse files Browse the repository at this point in the history
Add v7 vue3 example
  • Loading branch information
tristanlee85 authored Aug 23, 2023
2 parents 615bcfe + 49d89ca commit 0ae3f47
Show file tree
Hide file tree
Showing 33 changed files with 32,148 additions and 16,807 deletions.
16,807 changes: 0 additions & 16,807 deletions _template/package-lock.json

This file was deleted.

15 changes: 15 additions & 0 deletions examples/v7-vuejs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
5 changes: 5 additions & 0 deletions examples/v7-vuejs/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**NOTICE TO CONTRIBUTORS**

This repository is not actively monitored and any pull requests made to this repository will be closed/ignored.

Please submit the pull request to [edgio-docs/edgio-examples](https://github.com/edgio-docs/edgio-examples) instead.
16 changes: 16 additions & 0 deletions examples/v7-vuejs/.github/workflows/edgio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Deploy to Edgio

on:
workflow_dispatch:
push:

jobs:
deploy-to-edgio:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: if [ -f yarn.lock ]; then yarn install; else npm ci; fi
- run: if [ -f yarn.lock ]; then yarn edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; else npm run edgio:deploy -- --token=$EDGIO_DEPLOY_TOKEN; fi
env:
EDGIO_DEPLOY_TOKEN: ${{secrets.EDGIO_DEPLOY_TOKEN}}
31 changes: 31 additions & 0 deletions examples/v7-vuejs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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?

# Edgio generated build directory
.edgio
8 changes: 8 additions & 0 deletions examples/v7-vuejs/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
8 changes: 8 additions & 0 deletions examples/v7-vuejs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
76 changes: 76 additions & 0 deletions examples/v7-vuejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Edgio v7 Vue.js SSR Template

This example is a basic Vue.js 4 template powered by Edgio.

**Preview**: https://edgio-community-examples-v7-vuejs-live.edgio.link/

To get started with local development, run the following to install the Edgio CLI and start the development server:

```bash
# Install the latest version of the Edgio CLI
npm i -g @edgio/cli@latest

npm install
npm run edgio:dev
```

To test the production build locally, run the following commands:

```bash
npm run edgio:build

edgio run -p
```

When you're ready to deploy, run the following commands:

```bash
npm run edgio:deploy
```

---

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
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

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

```sh
npm run build
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```
59 changes: 59 additions & 0 deletions examples/v7-vuejs/edgio.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// This file was automatically added by edgio init.
// You should commit this file to source control.
// Learn more about this file at https://docs.edg.io/guides/edgio_config
module.exports = {
connector: '@edgio/vue-cva',

// The name of the site in Edgio to which this app should be deployed.
// name: 'my-site-name',

// The name of the team in Edgio to which this app should be deployed.
// team: 'my-team-name',

// Overrides the default path to the routes file. The path should be relative to the root of your app.
// routes: 'routes.js',

// If you need to proxy some URLs to an origin instead of your Next.js app, you can configure the origins here:
// origins: [
// {
// // The name of the backend origin
// name: "origin",
//
// // When provided, the following value will be sent as the host header when connecting to the origin.
// // If omitted, the host header from the browser will be forwarded to the origin.
// override_host_header: "example.com",
//
// // The list of backend hosts
// hosts: [
// {
// // The domain name or IP address of the origin server
// location: "example.com"
// }
// ]
// }
// ],

// Options for hosting serverless functions on Edgio
// serverless: {
// // Set to true to include all packages listed in the dependencies property of package.json when deploying to Edgio.
// // This option generally isn't needed as Edgio automatically includes all modules imported by your code in the bundle that
// // is uploaded during deployment
// includeNodeModules: true,
//
// // Include additional paths that are dynamically loaded by your app at runtime here when building the serverless bundle.
// include: ['views/**/*'],
// },

// The maximum number of URLs that will be concurrently prerendered during deployment when static prerendering is enabled.
// Defaults to 200, which is the maximum allowed value.
// prerenderConcurrency: 200,

// A list of glob patterns identifying which prerenderConcurrency source files should be uploaded when running edgio deploy --includeSources.
// This option is primarily used to share source code with Edgio support personnel for the purpose of debugging. If omitted,
// edgio deploy --includeSources will result in all files which are not gitignored being uploaded to Edgio.
//
// sources : [
// '**/*', // include all files
// '!(**/secrets/**/*)', // except everything in the secrets directory
// ],
}
1 change: 1 addition & 0 deletions examples/v7-vuejs/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 examples/v7-vuejs/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>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit 0ae3f47

Please sign in to comment.