Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: update Vue2 example #3802

Merged
merged 1 commit into from Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 8 additions & 18 deletions examples/vue/README.md
@@ -1,21 +1,11 @@
# uppy-vue
# Vue 2 example

## Project setup
You’re browsing the documentation for Vue v2.x and earlier. Check out
[Vue 3 example](../vue3/) for new projects.

npm install
To run the example, from the root directory of this repo, run the following commands:

### Compiles and hot-reloads for development

npm run serve

### Compiles and minifies for production

npm run build

### Lints and fixes files

npm run lint

### Customize configuration

See [Configuration Reference](https://cli.vuejs.org/config/).
```sh
corepack yarn install
corepack yarn workspace @uppy-example/vue2 dev
```
5 changes: 0 additions & 5 deletions examples/vue/babel.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions examples/vue/index.html
@@ -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.js"></script>
</body>
</html>
28 changes: 13 additions & 15 deletions examples/vue/package.json
@@ -1,26 +1,24 @@
{
"name": "@uppy-example/vue-example",
"name": "@uppy-example/vue2",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 5050"
},
"dependencies": {
"@uppy/core": "workspace:*",
"@uppy/dashboard": "workspace:*",
"@uppy/drag-drop": "workspace:*",
"@uppy/progress-bar": "workspace:*",
"@uppy/transloadit": "workspace:*",
"@uppy/vue": "workspace:*",
"core-js": "^3.6.5",
"shallow-equal": "^1.2.1",
"vue": "^2.6.14"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
"vite": "^2.7.1",
"vite-plugin-vue2": "^2.0.1",
"vue-template-compiler": "^2.6.14"
}
}
1 change: 0 additions & 1 deletion examples/vue/src/App.vue
@@ -1,6 +1,5 @@
<template>
<div id="app">
<!-- <HelloWorld msg="Welcome to Uppy Vue Demo"/> -->
<h1>Welcome to Uppy Vue Demo!</h1>
<h2>Inline Dashboard</h2>
<label>
Expand Down
58 changes: 0 additions & 58 deletions examples/vue/src/components/HelloWorld.vue

This file was deleted.

7 changes: 7 additions & 0 deletions examples/vue/vite.config.js
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [createVuePlugin()],
})
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -121,7 +121,8 @@
"temp-write": "^5.0.0",
"tsd": "^0.17.0",
"typescript": "~4.4",
"verdaccio": "^5.1.1"
"verdaccio": "^5.1.1",
"vue-template-compiler": "workspace:*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand why we need this 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the explanation there: https://github.com/transloadit/uppy/pull/3802/files#diff-4bea83be50434c7f99646e7178ae936953bfe18cd00c64066fd67442c8b7aab7R5
If we don't have a vue-template-compiler package at the root level, the vue-template-compiler of the Vue2 example will be installed to the root node_modules dir instead of the examples/vue/node_modules dir, and because we have Vue 3 installed in the root node_modules dir, it picks it up instead of the Vue 2 installed in the examples/vue/node_modules dir. I think that's the fault of this package to not list Vue 2 in its (peer) dependencies: https://github.com/vuejs/vue/blob/dev/packages/vue-template-compiler/package.json

},
"scripts": {
"build:bundle": "yarn node ./bin/build-bundle.mjs",
Expand Down
6 changes: 6 additions & 0 deletions private/vue-template-compiler/package.json
@@ -0,0 +1,6 @@
{
"name": "vue-template-compiler",
"version": "0.0.1",
"private": true,
"description": "This package is there only to avoid a version conflict in the Vue2 example."
}