Skip to content

Commit 16b0fca

Browse files
committed
Revert language tools version & generate dts by vite-plugin-dts to avoid relative paths
1 parent dbcb0c6 commit 16b0fca

File tree

6 files changed

+267
-140
lines changed

6 files changed

+267
-140
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020
"LICENSE",
2121
"README.md"
2222
],
23-
"locales": "./dist/locales",
24-
"types": "./dist/types/src/polaris-vue.d.ts",
23+
"types": "./dist/types/polaris-vue.d.ts",
2524
"main": "./dist/polaris-vue.umd.js",
2625
"module": "./dist/polaris-vue.es.js",
2726
"scripts": {
2827
"dev": "vite",
29-
"build": "rimraf dist && vite build && vue-tsc --declaration --emitDeclarationOnly && npm run gen-dts && npm run copy-locales && npm run remove-trashes",
28+
"build": "rimraf dist && vue-tsc --noEmit && vite build && npm run gen-dts && npm run copy-locales && npm run remove-trashes",
3029
"preview": "vite preview --port 5050",
3130
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
3231
"gen-dts": "esbuild build/gen-component-declaration.js --bundle --platform=node | node && npm run move-dts",
@@ -53,7 +52,7 @@
5352
"@shopify/postcss-plugin": "^5.0.2",
5453
"@types/node": "^20.10.4",
5554
"@vitejs/plugin-vue": "^5.0.2",
56-
"@vue/language-plugin-pug": "^2.0.6",
55+
"@vue/language-plugin-pug": "1.8.27",
5756
"change-case": "^5.3.0",
5857
"eslint": "^8.54.0",
5958
"eslint-plugin-vue": "^9.18.1",
@@ -70,13 +69,14 @@
7069
"typescript": "^5.3.3",
7170
"url": "^0.11.3",
7271
"vite": "^5.0.10",
72+
"vite-plugin-dts": "^3.7.3",
7373
"vite-plugin-eslint": "^1.8.1",
7474
"vite-plugin-replace": "^0.1.1",
7575
"vitepress": "^1.0.0-rc.35",
7676
"vue": "^3.4.19",
7777
"vue-component-meta": "^1.8.27",
7878
"vue-router": "^4.2.5",
79-
"vue-tsc": "^2.0.6"
79+
"vue-tsc": "^1.8.27"
8080
},
8181
"peerDependencies": {
8282
"vue": "^3.3"

src/main.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import { createApp } from 'vue';
2-
import { createWebHistory, createRouter } from 'vue-router';
32
import App from './Demo.vue';
43
import PolarisVue from './polaris-vue';
54

6-
// Define routes for development stage
7-
const routes = [
8-
{ path: '/', component: App },
9-
];
10-
11-
const router = createRouter({
12-
history: createWebHistory(),
13-
routes,
14-
});
15-
165
createApp(App)
176
.use(PolarisVue)
18-
.use(router)
197
.mount('#app');

src/polaris-vue.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { App } from 'vue';
22

3-
import * as components from '@/components';
3+
import * as components from './components';
44

55
const PolarisVue = {
66
install(Vue: App) {
@@ -10,10 +10,10 @@ const PolarisVue = {
1010
},
1111
};
1212

13-
export * from '@/components';
13+
export * from './components';
1414

15-
export { useBreakpoints } from '@/use/useBreakpoints';
16-
export { useIndexResourceState } from '@/use/useIndexResourceState';
17-
export { useSetIndexFiltersMode } from '@/use/useSetIndexFiltersMode';
15+
export { useBreakpoints } from './use/useBreakpoints';
16+
export { useIndexResourceState } from './use/useIndexResourceState';
17+
export { useSetIndexFiltersMode } from './use/useSetIndexFiltersMode';
1818

1919
export default PolarisVue;

tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,19 @@
88
"skipLibCheck": true,
99
"paths": {
1010
"@/*": ["./src/*"],
11-
"@polaris/*": ["./polaris/polaris-react/src/*"]
11+
"@polaris/*": ["./polaris/polaris-react/src/*"],
1212
},
1313
"types": [
1414
"node",
1515
"vite/client"
1616
],
1717
"outDir": "dist/types",
18-
1918
// "noEmit": true,
2019
"moduleResolution": "node",
2120
// "allowImportingTsExtensions": true,
2221
"resolveJsonModule": true,
2322
"isolatedModules": true,
2423
"jsx": "preserve",
25-
2624
"strict": true,
2725
"noUnusedLocals": true,
2826
"noUnusedParameters": true,

vite.config.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { defineConfig, loadEnv } from 'vite';
1+
import { defineConfig } from 'vite';
22
import vue from '@vitejs/plugin-vue';
33
import svgLoader from 'vite-svg-loader';
44
import { fileURLToPath } from 'url';
55
import { replaceCodePlugin } from 'vite-plugin-replace';
66
import packageJson from './package.json';
77
import { generateScopedName } from './build/namespaced-classname.js';
8+
import dts from 'vite-plugin-dts';
89

910
// https://vitejs.dev/config/
10-
export default ({ mode }) => {
11-
const env = loadEnv(mode, '.');
12-
11+
export default () => {
1312
return defineConfig({
1413
plugins: [
1514
vue(),
@@ -22,6 +21,10 @@ export default ({ mode }) => {
2221
},
2322
],
2423
}),
24+
dts({
25+
rollupTypes: true,
26+
outDir: 'dist/types',
27+
}),
2528
],
2629
resolve: {
2730
alias: {
@@ -40,7 +43,6 @@ export default ({ mode }) => {
4043
},
4144
},
4245
modules: {
43-
// generateScopedName: `${env.VITE_CLASS_PREFIX}-[local]`,
4446
generateScopedName,
4547
},
4648
},

0 commit comments

Comments
 (0)