Skip to content

Commit

Permalink
chore: update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 13, 2023
1 parent 3275e94 commit c592058
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 25 deletions.
9 changes: 7 additions & 2 deletions packages/core/useAnimate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import type { ComputedRef, Ref, ShallowRef, WritableComputedRef } from 'vue-demi
import { computed, nextTick, shallowReactive, shallowRef, watch } from 'vue-demi'
import type { MaybeRef, Mutable } from '@vueuse/shared'
import { isObject, objectOmit, toValue, tryOnMounted, tryOnScopeDispose } from '@vueuse/shared'
import type { ConfigurableWindow, MaybeComputedElementRef } from '../index'
import { defaultWindow, unrefElement, useEventListener, useRafFn, useSupported } from '../index'
import type { MaybeComputedElementRef } from '../unrefElement'
import { unrefElement } from '../unrefElement'
import type { ConfigurableWindow } from '../_configurable'
import { defaultWindow } from '../_configurable'
import { useSupported } from '../useSupported'
import { useEventListener } from '../useEventListener'
import { useRafFn } from '../useRafFn'

export interface UseAnimateOptions extends KeyframeAnimationOptions, ConfigurableWindow {
/**
Expand Down
14 changes: 14 additions & 0 deletions playgrounds/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cd ./vite-vue2.7
rm -rf node_modules
pnpm install
pnpm run build

cd ../vite
rm -rf node_modules
pnpm install
pnpm run build

# cd ../nuxt
# rm -rf node_modules
# pnpm install
# pnpm run build
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineNuxtConfig } from 'nuxt'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineNuxtConfig({
modules: [
resolve(__dirname, '../../packages/nuxt/index.ts'),
'@vueuse/nuxt',
],
alias: {
'@vueuse/core': resolve(__dirname, '../../packages/core/index.ts'),
Expand Down
17 changes: 17 additions & 0 deletions playgrounds/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"packageManager": "[email protected]",
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"start": "node .output/server/index.mjs"
},
"devDependencies": {
"@vueuse/core": "file:../../packages/core/dist",
"@vueuse/integrations": "file:../../packages/integrations/dist",
"@vueuse/metadata": "file:../../packages/metadata/dist",
"@vueuse/nuxt": "file:../../packages/nuxt/dist",
"@vueuse/shared": "file:../../packages/shared/dist",
"nuxt": "^3.4.1"
}
}
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions playgrounds/nuxt3/package.json

This file was deleted.

11 changes: 11 additions & 0 deletions playgrounds/vite-vue2.7/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
import { useMouse } from '@vueuse/core'
const { x, y } = useMouse()
</script>

<template>
<div>
Hello {{ x }}, {{ y }}
</div>
</template>
13 changes: 13 additions & 0 deletions playgrounds/vite-vue2.7/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="./main.ts"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions playgrounds/vite-vue2.7/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Vue from 'vue'
import App from './App.vue'

new Vue({
render: h => h(App),
}).$mount('#app')
19 changes: 19 additions & 0 deletions playgrounds/vite-vue2.7/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "vite-vue2.7",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"@antfu/eslint-config": "^0.38.4",
"@vitejs/plugin-vue2": "^2.2.0",
"@vueuse/core": "file:../../packages/core/dist",
"@vueuse/metadata": "file:../../packages/metadata/dist",
"@vueuse/shared": "file:../../packages/shared/dist",
"eslint": "^8.38.0",
"vite": "^4.2.1",
"vue": "^2.7"
}
}
Empty file.
21 changes: 21 additions & 0 deletions playgrounds/vite-vue2.7/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Vue from '@vitejs/plugin-vue2'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
Vue(),
],
build: {
minify: false,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('/node_modules/@vueuse/'))
return 'vueuse'
else
return 'vendor'
},
},
},
},
})
3 changes: 3 additions & 0 deletions playgrounds/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.1.0",
"@vueuse/core": "file:../../packages/core/dist",
"@vueuse/metadata": "file:../../packages/metadata/dist",
"@vueuse/shared": "file:../../packages/shared/dist",
"vite": "^4.2.1"
}
}
27 changes: 21 additions & 6 deletions playgrounds/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ import { resolve } from 'node:path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'

export default defineConfig({
export default defineConfig(({ command }) => ({
plugins: [
Vue(),
],
resolve: {
alias: {
'@vueuse/core': resolve(__dirname, '../../packages/core/index.ts'),
'@vueuse/shared': resolve(__dirname, '../../packages/shared/index.ts'),
resolve: command === 'build'
? {}
: {
alias: {
'@vueuse/core': resolve(__dirname, '../../packages/core/index.ts'),
'@vueuse/shared': resolve(__dirname, '../../packages/shared/index.ts'),
},
},
build: {
minify: false,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('@vueuse/'))
return 'vueuse'
else
return 'vendor'
},
},
},
},
})
}))
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packages:
- packages/*
- '!playgrounds'

0 comments on commit c592058

Please sign in to comment.