Skip to content

Commit 9c877e7

Browse files
feat: Migrate build configuration to vite
2 parents 7ec4b50 + 37d6dfe commit 9c877e7

File tree

9 files changed

+87
-60
lines changed

9 files changed

+87
-60
lines changed

.eslintrc.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ module.exports = {
88
'@vue/airbnb'
99
],
1010
parserOptions: {
11-
ecmaVersion: 'latest'
11+
parser: '@typescript-eslint/parser',
12+
ecmaVersion: 'latest',
13+
project: ['./tsconfig.json']
1214
},
1315
overrides: [
1416
{
15-
files: ['*.vue'],
17+
files: ['*.vue', '*.ts'],
1618
rules: {
1719
'vue/multi-word-component-names': 'off'
1820
}
@@ -63,8 +65,8 @@ module.exports = {
6365
'vue/html-indent': 'off',
6466
'vue/max-attributes-per-line': 'off',
6567
'no-spaced-func': 'off',
66-
'@typescript-eslint/consistent-type-imports': 'error',
6768
'vuejs-accessibility/form-control-has-label': 'off',
69+
'@typescript-eslint/consistent-type-imports': 'error',
6870
'vue/first-attribute-linebreak': 'off',
6971
indent: ['off'],
7072
curly: ['error', 'multi', 'consistent'],

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "@siren/vue-inbox",
33
"version": "1.0.0",
44
"description": "Vue SDK for in-app notification inbox",
5-
"main": "dist/index.js",
6-
"types": "dist.type.d.ts",
5+
"types": "./dist/@siren/index.d.ts",
76
"type": "module",
7+
"module": "./dist/siren-vue-inbox.js",
88
"scripts": {
9-
"build": "rm -rf dist && rollup -c",
10-
"prepare": "husky",
11-
"lint": "eslint src"
9+
"dev": "vite",
10+
"build": "vite build && vue-tsc",
11+
"types": "vue-tsc ",
12+
"preview": "vite preview",
13+
"lint": "eslint src/"
1214
},
1315
"repository": {
1416
"type": "git",
@@ -26,29 +28,27 @@
2628
"url": "https://github.com/KeyValueSoftwareSystems/siren-vue-inbox/issues"
2729
},
2830
"homepage": "https://github.com/KeyValueSoftwareSystems/siren-vue-inbox#readme",
29-
"dependencies": {
31+
"devDependencies": {
32+
"@types/node": "^20.2.5",
33+
"@typescript-eslint/parser": "^7.5.0",
34+
"@vitejs/plugin-vue": "^5.0.4",
3035
"@vue/eslint-config-airbnb": "^8.0.0",
3136
"@vue/eslint-config-prettier": "^9.0.0",
32-
"@vue/eslint-config-typescript": "^12.0.0",
33-
"eslint": "^8.57.0",
34-
"eslint-plugin-vue": "^9.22.0",
35-
"husky": "^9.0.11",
36-
"test_notification": "^1.0.5",
37+
"@vue/eslint-config-typescript": "^13.0.0",
38+
"eslint-plugin-vue": "^9.24.0",
39+
"path": "^0.12.7",
3740
"typescript": "^5.3.3",
41+
"vite": "^5.1.6",
42+
"vite-plugin-css-injected-by-js": "^3.4.0",
3843
"vue-tsc": "^2.0.5"
3944
},
40-
"devDependencies": {
41-
"@rollup/plugin-terser": "^0.4.4",
42-
"@vue/tsconfig": "^0.5.1",
43-
"rollup-plugin-typescript2": "^0.36.0",
44-
"rollup-plugin-vue": "^6.0.0"
45-
},
4645
"peerDependencies": {
47-
"vue": "^3.4.15"
46+
"vue": ">=3.0.0"
4847
},
4948
"files": [
5049
"dist",
5150
"package.json",
52-
"README.md"
51+
"README.md",
52+
"license"
5353
]
5454
}

rollup.config.js

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

src/components/SirenInbox.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
Siren
3+
</template>

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import SirenInbox from './components/SirenInbox.vue';
2+
3+
export { SirenInbox };

src/index.vue

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

tsconfig.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
{
2-
"extends": "@vue/tsconfig/tsconfig.dom.json",
32
"compilerOptions": {
4-
"allowJs": true,
5-
"allowSyntheticDefaultImports": true,
6-
"forceConsistentCasingInFileNames": true,
7-
"noFallthroughCasesInSwitch": true,
8-
"declaration": true,
9-
"rootDir": ".",
10-
"target": "es5",
11-
"module": "esnext",
12-
"outDir": "dist",
13-
"declarationDir": "dist",
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
"moduleResolution": "bundler",
9+
"allowImportingTsExtensions": true,
10+
"noEmit": true,
11+
"resolveJsonModule": true,
12+
"isolatedModules": true,
13+
"jsx": "preserve",
14+
"declaration": true,
15+
"strict": true,
16+
"noUnusedLocals": true,
17+
"noUnusedParameters": true,
18+
"noFallthroughCasesInSwitch": true
1419
},
15-
"include": ["./"],
16-
"exclude": ["node_modules"]
17-
}
20+
"include": ["src"],
21+
"exclude": ["node_modules"],
22+
"references": [{ "path": "./tsconfig.node.json" }]
23+
}
24+

tsconfig.node.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": ["vite.config.ts"]
10+
}
11+

vite.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from 'vite';
2+
import path from 'path';
3+
import vue from '@vitejs/plugin-vue';
4+
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
5+
6+
export default defineConfig({
7+
plugins: [vue(), cssInjectedByJsPlugin()],
8+
build: {
9+
lib: {
10+
entry: path.resolve(__dirname, 'src/index.ts'),
11+
name: 'Siren',
12+
fileName: 'siren-vue-inbox',
13+
formats: ['es']
14+
},
15+
rollupOptions: {
16+
external: ['vue'],
17+
output: {
18+
globals: {
19+
vue: 'Vue'
20+
},
21+
format: 'esm'
22+
},
23+
}
24+
}
25+
});

0 commit comments

Comments
 (0)