Skip to content

Commit 0ef3ad0

Browse files
committed
Version 0.0.2
1 parent ccd601b commit 0ef3ad0

8 files changed

+117
-76
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [0.0.2] - August 16, 2022
6+
- Added typescript declarations
7+
- Fixed some typescript errors
8+
- Updated readme
9+
10+
## [0.0.1] - July 14, 2022
11+
- Initial release

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# vue3-sticky-directive
1+
# Vue3 Sticky Directive
22

33
Vue3-sticky-directive is a powerful Vue 3 directive make element sticky. This is an implementation of the [vue-sticky-directive](https://github.com/mehwww/vue-sticky-directive) package for Vue 2.
44

index.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

package-lock.json

Lines changed: 63 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"name": "vue3-sticky-directive",
33
"author": "DapperBenji <[email protected]>",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"type": "module",
6-
"files": [
7-
"dist"
8-
],
6+
"files": ["dist"],
7+
"main": "./dist/index.umd.cjs",
8+
"module": "./dist/index.js",
99
"exports": {
10-
".": "./dist/index.es.js"
10+
".": {
11+
"import": "./dist/index.js",
12+
"require": "./dist/index.umd.cjs"
13+
}
1114
},
1215
"license": "MIT",
13-
"types": "./index.d.ts",
16+
"types": "./dist/index.d.ts",
1417
"repository": {
1518
"type": "git",
1619
"url": "https://github.com/DapperBenji/vue3-sticky-directive.git"
@@ -29,8 +32,11 @@
2932
"vue": "3.2.37"
3033
},
3134
"devDependencies": {
35+
"@types/node": "^18.7.5",
3236
"@vitejs/plugin-vue": "3.0.0",
33-
"typescript": "^4.6.4",
37+
"rollup-plugin-typescript2": "^0.32.1",
38+
"tslib": "^2.4.0",
39+
"typescript": "^4.7.4",
3440
"vite": "3.0.0",
3541
"vue-tsc": "0.38.4"
3642
}

src/index.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import { App } from 'vue'
1+
import type { App, Plugin } from 'vue'
22
import Sticky from './sticky'
33

4-
const install = (app: App) => {
5-
app.directive('Sticky', Sticky)
6-
}
7-
8-
/* @ts-ignore */
9-
Sticky.install = install
10-
11-
export default {
12-
install: (app: App) => {
4+
export const StickyPlugin: Plugin = {
5+
install(app: App) {
136
app.directive('Sticky', Sticky)
147
}
158
}
9+
10+
export default StickyPlugin

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"skipLibCheck": true
1616
},
1717
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
18-
"references": [{ "path": "./tsconfig.node.json" }]
18+
"references": [{ "path": "./tsconfig.node.json" }],
19+
"types": ["node"]
1920
}

vite.config.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import path from 'path'
1+
import { resolve } from 'path'
22
import { defineConfig } from 'vite'
33
import vue from '@vitejs/plugin-vue'
4+
import typescript from 'rollup-plugin-typescript2'
45

5-
// https://vitejs.dev/config/
66
export default defineConfig({
77
build: {
8+
minify: true,
89
lib: {
9-
entry: path.resolve(__dirname, 'src/index.ts'),
10+
entry: resolve(__dirname, 'src/index.ts'),
1011
name: 'vue3-sticky-directive',
1112
formats: ['es', 'cjs'],
12-
fileName: (format) => `index.${format}.js`
13+
fileName: (format) => (format === 'es' ? 'index.js' : 'index.umd.cjs')
1314
},
1415
rollupOptions: {
1516
external: ['vue'],
@@ -21,6 +22,22 @@ export default defineConfig({
2122
}
2223
},
2324
plugins: [
24-
vue()
25+
vue(),
26+
typescript({
27+
check: false,
28+
tsconfig: 'tsconfig.json',
29+
include: [
30+
'src/index.ts',
31+
'src/sticky.ts'
32+
],
33+
tsconfigOverride: {
34+
compilerOptions: {
35+
declaration: true
36+
}
37+
},
38+
exclude: [
39+
'vite.config.ts'
40+
]
41+
})
2542
]
2643
})

0 commit comments

Comments
 (0)