Skip to content

Commit

Permalink
Revert language tools version & generate dts by vite-plugin-dts to av…
Browse files Browse the repository at this point in the history
…oid relative paths
  • Loading branch information
juzser committed Mar 26, 2024
1 parent dbcb0c6 commit 16b0fca
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 140 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
"LICENSE",
"README.md"
],
"locales": "./dist/locales",
"types": "./dist/types/src/polaris-vue.d.ts",
"types": "./dist/types/polaris-vue.d.ts",
"main": "./dist/polaris-vue.umd.js",
"module": "./dist/polaris-vue.es.js",
"scripts": {
"dev": "vite",
"build": "rimraf dist && vite build && vue-tsc --declaration --emitDeclarationOnly && npm run gen-dts && npm run copy-locales && npm run remove-trashes",
"build": "rimraf dist && vue-tsc --noEmit && vite build && npm run gen-dts && npm run copy-locales && npm run remove-trashes",
"preview": "vite preview --port 5050",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"gen-dts": "esbuild build/gen-component-declaration.js --bundle --platform=node | node && npm run move-dts",
Expand All @@ -53,7 +52,7 @@
"@shopify/postcss-plugin": "^5.0.2",
"@types/node": "^20.10.4",
"@vitejs/plugin-vue": "^5.0.2",
"@vue/language-plugin-pug": "^2.0.6",
"@vue/language-plugin-pug": "1.8.27",
"change-case": "^5.3.0",
"eslint": "^8.54.0",
"eslint-plugin-vue": "^9.18.1",
Expand All @@ -70,13 +69,14 @@
"typescript": "^5.3.3",
"url": "^0.11.3",
"vite": "^5.0.10",
"vite-plugin-dts": "^3.7.3",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-replace": "^0.1.1",
"vitepress": "^1.0.0-rc.35",
"vue": "^3.4.19",
"vue-component-meta": "^1.8.27",
"vue-router": "^4.2.5",
"vue-tsc": "^2.0.6"
"vue-tsc": "^1.8.27"
},
"peerDependencies": {
"vue": "^3.3"
Expand Down
12 changes: 0 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import { createApp } from 'vue';
import { createWebHistory, createRouter } from 'vue-router';
import App from './Demo.vue';
import PolarisVue from './polaris-vue';

// Define routes for development stage
const routes = [
{ path: '/', component: App },
];

const router = createRouter({
history: createWebHistory(),
routes,
});

createApp(App)
.use(PolarisVue)
.use(router)
.mount('#app');
10 changes: 5 additions & 5 deletions src/polaris-vue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { App } from 'vue';

import * as components from '@/components';
import * as components from './components';

const PolarisVue = {
install(Vue: App) {
Expand All @@ -10,10 +10,10 @@ const PolarisVue = {
},
};

export * from '@/components';
export * from './components';

export { useBreakpoints } from '@/use/useBreakpoints';
export { useIndexResourceState } from '@/use/useIndexResourceState';
export { useSetIndexFiltersMode } from '@/use/useSetIndexFiltersMode';
export { useBreakpoints } from './use/useBreakpoints';
export { useIndexResourceState } from './use/useIndexResourceState';
export { useSetIndexFiltersMode } from './use/useSetIndexFiltersMode';

export default PolarisVue;
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@
"skipLibCheck": true,
"paths": {
"@/*": ["./src/*"],
"@polaris/*": ["./polaris/polaris-react/src/*"]
"@polaris/*": ["./polaris/polaris-react/src/*"],
},
"types": [
"node",
"vite/client"
],
"outDir": "dist/types",

// "noEmit": true,
"moduleResolution": "node",
// "allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",

"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
Expand Down
12 changes: 7 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { defineConfig, loadEnv } from 'vite';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import svgLoader from 'vite-svg-loader';
import { fileURLToPath } from 'url';
import { replaceCodePlugin } from 'vite-plugin-replace';
import packageJson from './package.json';
import { generateScopedName } from './build/namespaced-classname.js';
import dts from 'vite-plugin-dts';

// https://vitejs.dev/config/
export default ({ mode }) => {
const env = loadEnv(mode, '.');

export default () => {
return defineConfig({
plugins: [
vue(),
Expand All @@ -22,6 +21,10 @@ export default ({ mode }) => {
},
],
}),
dts({
rollupTypes: true,
outDir: 'dist/types',
}),
],
resolve: {
alias: {
Expand All @@ -40,7 +43,6 @@ export default ({ mode }) => {
},
},
modules: {
// generateScopedName: `${env.VITE_CLASS_PREFIX}-[local]`,
generateScopedName,
},
},
Expand Down
Loading

0 comments on commit 16b0fca

Please sign in to comment.