Skip to content

Commit

Permalink
Merge pull request #28 from idmytro/unp2
Browse files Browse the repository at this point in the history
Unp2
  • Loading branch information
idmytro authored Jun 6, 2024
2 parents 4523b41 + a62b751 commit 6705272
Show file tree
Hide file tree
Showing 47 changed files with 2,964 additions and 1,270 deletions.
25 changes: 25 additions & 0 deletions _2024-unplugin-router/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm

- run: pnpm install --frozen-lockfile
- run: pnpm run build
11 changes: 10 additions & 1 deletion _2024-unplugin-router/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ 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
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo

test-results/
playwright-report/
18 changes: 17 additions & 1 deletion _2024-unplugin-router/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Vue 3 + Vite + TS + Unplugin Router
# unplugin-vue-router Demo

This is the demo project for [unplugin-vue-router](https://github.com/posva/unplugin-vue-router). You can test it on [StackBlitz](https://stackblitz.com/github/posva/uvr-demo).

## Project Setup

```sh
pnpm install
```

### Compile and Hot-Reload for Development

```sh
pnpm run dev
```

##

```sh
npx degit idmytro/vue3-multi-starter/_2024-unplugin-router myproject
```
4 changes: 4 additions & 0 deletions _2024-unplugin-router/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions _2024-unplugin-router/e2e/vue.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test';

// See here how to get started:
// https://playwright.dev/docs/intro
test('visits the app root url', async ({ page }) => {
await page.goto('/');
await expect(page.locator('div.greetings > h1')).toHaveText('You did it!');
})
2 changes: 2 additions & 0 deletions _2024-unplugin-router/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="vite/client" />
/// <reference types="unplugin-vue-router/client" />
4 changes: 4 additions & 0 deletions _2024-unplugin-router/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import antfu from '@antfu/eslint-config'
import noAutofix from 'eslint-plugin-no-autofix'

export default antfu(
{
files: ['tsconfig.json'],
rules: { 'jsonc/sort-keys': 0 },
},
{
plugins: {
'no-autofix': noAutofix,
Expand Down
8 changes: 4 additions & 4 deletions _2024-unplugin-router/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>2024</title>
<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>
Expand Down
1 change: 1 addition & 0 deletions _2024-unplugin-router/package-lock.json

Large diffs are not rendered by default.

40 changes: 28 additions & 12 deletions _2024-unplugin-router/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
{
"type": "module",
"name": "uvr-demo",
"version": "0.0.0",
"packageManager": "[email protected]",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"test:unit": "vitest",
"test:e2e": "playwright test",
"build-only": "vite build",
"type-check": "vue-tsc --build --force"
},
"dependencies": {
"@unocss/reset": "^0.58.3",
"vue": "^3.4.9"
"pinia": "^2.1.7",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@antfu/eslint-config": "^2.18.1",
"@antfu/eslint-config": "^2.6.2",
"@unocss/transformer-directives": "^0.58.3",
"@unocss/transformer-variant-group": "^0.58.5",
"@vitejs/plugin-vue": "^5.0.3",
"eslint": "^8.57.0",
"eslint-plugin-no-autofix": "^1.2.3",
"typescript": "5.0.4",
"@playwright/test": "^1.44.1",
"@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.12.5",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"jsdom": "^24.1.0",
"npm-run-all2": "^6.1.2",
"typescript": "~5.4.0",
"unocss": "^0.58.3",
"unplugin-auto-import": "^0.17.3",
"unplugin-vue-markdown": "^0.26.2",
"unplugin-vue-router": "^0.9.0",
"vite": "^5.0.11",
"vue-tsc": "^1.8.27"
"vite": "^5.2.8",
"vite-plugin-vue-devtools": "^7.0.25",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.11"
}
}
110 changes: 110 additions & 0 deletions _2024-unplugin-router/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import process from 'node:process'
import { defineConfig, devices } from '@playwright/test'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000
},
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:5173',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

/* Only on CI systems run the tests headless */
headless: !!process.env.CI
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome']
}
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox']
}
},
{
name: 'webkit',
use: {
...devices['Desktop Safari']
}
}

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: {
// ...devices['Pixel 5'],
// },
// },
// {
// name: 'Mobile Safari',
// use: {
// ...devices['iPhone 12'],
// },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: {
// channel: 'msedge',
// },
// },
// {
// name: 'Google Chrome',
// use: {
// channel: 'chrome',
// },
// },
],

/* Folder for test artifacts such as screenshots, videos, traces, etc. */
// outputDir: 'test-results/',

/* Run your local dev server before starting the tests */
webServer: {
/**
* Use the dev server by default for faster feedback loop.
* Use the preview server on CI for more realistic testing.
* Playwright will re-use the local server if there is already a dev-server running.
*/
command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
port: 5173,
reuseExistingServer: !process.env.CI
}
})
Loading

0 comments on commit 6705272

Please sign in to comment.