Skip to content

Commit

Permalink
fixbug: 修改模板引用路径
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Aug 14, 2022
1 parent 7b3432f commit 18885ad
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 118 deletions.
13 changes: 7 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
module.exports = {
root: true,
globals: {
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
withDefaults: 'readonly',
},
env: {
es6: true,
browser: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:vue/vue3-recommended',
'plugin:markdown/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
Expand All @@ -25,6 +21,11 @@ module.exports = {
jsx: true,
},
},
settings: {
'import/resolver': {
node: { extensions: ['.js', '.mjs', '.ts', '.d.ts', '.tsx'] },
},
},
plugins: ['vue'],
rules: {
'prettier/prettier': 'error',
Expand Down
8 changes: 6 additions & 2 deletions build/rollup.config.dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import vue from 'rollup-plugin-vue' // 处理vue文件
import { resolve } from 'path'
const input = resolve(__dirname, '../packages') // 入口文件
const output = resolve(__dirname, '../lib') // 输出文件

const config = [
{
input: `${input}/index.ts`,
Expand All @@ -17,13 +18,16 @@ const config = [
nodeResolve(),
vue({
target: 'browser',
// css: false,
exposeFilename: false,
}),
typescript({
useTsconfigDeclarationDir: false,
tsconfig: "./tsconfig.web.json",
tsconfigOverride: {
include: ['packages/**/*'],
compilerOptions: {
composite: false,
declaration: true,
},
exclude: ['node_modules', 'examples', 'mobile', 'tests'],
},
abortOnError: false,
Expand Down
2 changes: 2 additions & 0 deletions build/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ function getAllDirbyFilename(dir, outDir = null) {
nodeResolve(),
vue(),
typescript({
tsconfig: "./tsconfig.web.json",
tsconfigOverride: {
compilerOptions: {
composite:false,
declaration: false,
},
exclude: ['node_modules', 'examples', 'mobile', 'tests'],
Expand Down
11 changes: 0 additions & 11 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ const config: UserConfig = {
// // md.use(demoBlockPlugin)
// },
},
vue: {
template: {
ssr: true,
compilerOptions: {
directiveTransforms: {
props: [],
needRuntime: true,
},
},
},
},
};

export default config;
28 changes: 14 additions & 14 deletions effect/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "effect",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.33"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
"vite": "^2.9.9"
}
"name": "effect",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.37"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.3",
"vite": "^3.0.7"
}
}
56 changes: 28 additions & 28 deletions effect/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<template>
<div>
组件实例:
<IButton @click="add"></IButton>
{{ num }}
</div>
</template>

<script setup>
import { IButton } from '../../lib/index'
import { useDeveloper } from '../../lib/hooks/useDeveloper'
import { developFn } from '../../lib/utils/myDevelop'
<script setup lang="ts">
import { IButton } from '@lib/index';
import { useDeveloper } from '@lib/hooks/useDeveloper';
import { developFn } from '@lib/utils/myDevelop';
const { num } = useDeveloper()
const { num } = useDeveloper();
function add() {
developFn()
num.value = num.value + 1
}
function add() {
developFn();
num.value = num.value + 1;
}
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
</script>

<template>
<div>
组件实例:
<IButton @click="add"></IButton>
{{ num }}
</div>
</template>

<style>
@import '../../lib/theme-default/button.css';
@import '../../lib/theme-default/button.css';
#app {
margin-top: 60px;
font-family: Avenir, Helvetica, Arial, sans-serif;
color: #2c3e50;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#app {
margin-top: 60px;
font-family: Avenir, Helvetica, Arial, sans-serif;
color: #2c3e50;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
6 changes: 3 additions & 3 deletions effect/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#app')
createApp(App).mount('#app');
13 changes: 0 additions & 13 deletions effect/tsconfig.json

This file was deleted.

33 changes: 23 additions & 10 deletions effect/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
// 服务器主机名,如果允许外部访问,可设置为"0.0.0.0"
host: '0.0.0.0',
// 服务器端口号
port: 3001,
},
})
plugins: [vue()],
server: {
// 服务器主机名,如果允许外部访问,可设置为"0.0.0.0"
host: '0.0.0.0',
// 服务器端口号
port: 3001,
},
resolve: {
alias: [
{
find: '@lib',
replacement: `${path.resolve(__dirname, '../lib')}/`,
},
{
find: '@xsComponents',
replacement: `${path.resolve(__dirname, '../packages')}/`,
},
],
},
});
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "xiaosi-vue3-components",
"name": "xs-components",
"version": "1.0.2",
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git://github.com:jsxiaosi/xiaosiCommitLib.git"
},
"main": "./lib/index.js",
"module": "./lib/index.esm.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -94,12 +98,14 @@
"stylelint-order": "^5.0.0",
"stylelint-scss": "^4.3.0",
"typescript": "^4.7.4",
"unplugin-vue-define-options": "^0.9.1",
"vite": "^3.0.7",
"vite-plugin-inspect": "^0.6.0",
"vitepress": "^1.0.0-alpha.4"
},
"dependencies": {
"@vueuse/core": "^9.1.0",
"eslint-plugin-markdown": "^3.0.0",
"markdown-it": "^13.0.1",
"markdown-it-container": "^3.0.0",
"prism-theme-vars": "^0.2.4",
Expand Down
26 changes: 26 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// https://www.tslang.cn/docs/handbook/compiler-options.html
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"removeComments": true,
"noLib": false,
"declaration": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"strictFunctionTypes": false,
"jsx": "preserve",
"baseUrl": ".",
"sourceMap": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"paths": {
"@xsComponents/*": ["../packages/"]
}
}
}
14 changes: 14 additions & 0 deletions tsconfig.effect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.web.json",
"compilerOptions": {
"allowJs": false,
"baseUrl": "./effect", // 解析非相对模块的基础地址,默认是当前目录
"lib": ["ESNext", "DOM"],
"paths": {
"@xsComponents/*": ["../packages/*"],
"@lib/*": ["../lib/*"]
}
},
"include": ["packages", "effect/", "typings/vue-shim.d.ts"],
"exclude": ["build", "lib"]
}
Loading

0 comments on commit 18885ad

Please sign in to comment.