add overlayscrollbars-vue

This commit is contained in:
Rene Haas
2022-10-19 18:05:32 +02:00
parent 074e367341
commit bdb2874fbe
17 changed files with 8935 additions and 216 deletions
+16 -1
View File
@@ -128,12 +128,27 @@ module.exports = {
},
},
{
files: ['*.test.*', '**/tests/**'],
files: ['*.test.*.ts', '**/test/**/*.ts'],
extends: [...defaultExtends, 'plugin:@typescript-eslint/recommended'],
plugins: defaultPlugins,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: [
'./packages/**/tsconfig.json',
'./examples/**/tsconfig.json',
'./website/**/tsconfig.json',
'./local/**/tsconfig.json',
],
},
rules: {
...defaultRules,
'no-shadow': 'off',
'no-use-before-define': 'off',
'no-restricted-syntax': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-floating-promises': 'off',
@@ -29,6 +29,7 @@ yarn-error.log
.history/*
# Miscellaneous
/.angular
/.angular/cache
.sass-cache/
/connect.lock
+1999 -214
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
# 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
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+46
View File
@@ -0,0 +1,46 @@
# vue-project
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
```
### Run Unit Tests with [Vitest](https://vitest.dev/)
```sh
npm run test:unit
```
+4
View File
@@ -0,0 +1,4 @@
declare module '*.vue' {
const vue: any;
export default vue;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,29 @@
{
"name": "vue-project",
"version": "0.0.0",
"scripts": {
"build": "run-p build-js build-types",
"test": "vitest --environment jsdom",
"build-js": "vite build",
"build-types": "vue-tsc --emitDeclarationOnly -p tsconfig.types.json --composite false"
},
"peerDependencies": {
"vue": ">=2.0.0"
},
"devDependencies": {
"@types/jsdom": "^16.2.14",
"@types/node": "^16.11.45",
"@vitejs/plugin-vue2": "^1.1.2",
"@vue/test-utils": "^1.3.0",
"@vue/tsconfig": "^0.1.3",
"jsdom": "^20.0.0",
"npm-run-all": "^4.1.5",
"terser": "^5.14.2",
"typescript": "~4.7.4",
"vite": "^3.0.2",
"vitest": "^0.18.1",
"vue": "^2.7.7",
"vue-template-compiler": "^2.7.7",
"vue-tsc": "^0.38.9"
}
}
@@ -0,0 +1,16 @@
<script setup lang="ts">
defineProps<{
msg: string;
}>();
</script>
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
Youve successfully created a project with
<a target="_blank" href="https://vitejs.dev/">Vite</a> +
<a target="_blank" href="https://v2.vuejs.org/">Vue 2</a>.
</h3>
</div>
</template>
@@ -0,0 +1 @@
export { default as OverlayScrollbarsComponent } from './OverlayScrollbars.vue';
@@ -0,0 +1,10 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import HelloWorld from '~/OverlayScrollbars.vue';
describe('HelloWorld', () => {
it('renders properly', () => {
const wrapper = mount(HelloWorld, { propsData: { msg: 'Hello Vitest' } });
expect(wrapper.text()).toContain('Hello Vitest');
});
});
@@ -0,0 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
}
}
}
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*"],
"compilerOptions": {
"rootDir": "./src/",
"outDir": "dist",
"declaration": true,
"composite": true,
}
}
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
}
}
@@ -0,0 +1,29 @@
import path from 'node:path';
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue2 from '@vitejs/plugin-vue2';
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'OverlayScrollbarsVue',
fileName: (format) => `overlayscrollbars-vue.${format}.js`,
},
rollupOptions: {
external: ['vue'],
output: {
dir: 'dist',
globals: {
vue: 'Vue',
},
},
},
},
resolve: {
alias: {
'~': fileURLToPath(new URL('./src', import.meta.url)),
},
},
plugins: [vue2()],
});
@@ -100,6 +100,7 @@ const testBundler = (bundlerName) => async () => {
cleanBundle && fs.rmSync(outputDir, { recursive: true });
// eslint-disable-next-line no-console
console.info(`${bundlerName} size`, {
normal,
treeshaked,
+2 -1
View File
@@ -3,6 +3,7 @@
"compilerOptions": {
"paths": {
"~/*": ["./src/*"]
}
},
"types": ["jest"],
}
}