refactor:删除非必要文件
This commit is contained in:
parent
f7bf615ab5
commit
fe6c33b3c9
@ -14,5 +14,4 @@ src
|
||||
tsconfig.json
|
||||
tsconfig.build.json
|
||||
tsconfig.node.json
|
||||
vite.config.ts
|
||||
vitest.config.ts
|
||||
vite.config.ts
|
13
README.md
13
README.md
@ -19,3 +19,16 @@ vue3的UI库
|
||||
npm run build:lib
|
||||
```
|
||||
|
||||
## git仓库
|
||||
|
||||
1. 关联远程仓库
|
||||
|
||||
```bash
|
||||
git remote add origin http://git.uair.cc/expressgy/ni.git
|
||||
```
|
||||
|
||||
2. 切换分支,推送到远程分支
|
||||
```bash
|
||||
git checkout -b dev
|
||||
git push -u origin dev
|
||||
```
|
38
package.json
38
package.json
@ -2,6 +2,11 @@
|
||||
"name": "ni",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"keywords": ["Vue3", "Vue UI", "Ni UI", "Ni"],
|
||||
"license": "MIT",
|
||||
"homepage": "http://uair.cc",
|
||||
"author": "星撰玉衡",
|
||||
"description": "一个基于 Vue3 的 UI 组件库,包含按钮、输入框、表单等常用组件,旨在提供简单易用的 UI 解决方案。",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist",
|
||||
@ -10,35 +15,17 @@
|
||||
"main": "./dist/ni.umd.js",
|
||||
"module": "./dist/ni.es.js",
|
||||
"types": "./types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./dist/ni.es.js",
|
||||
"require": "./dist/ni.umd.js"
|
||||
},
|
||||
"./button": {
|
||||
"types": "./types/components/button/index.d.ts",
|
||||
"import": "./dist/ni-button.es.js",
|
||||
"require": "./dist/ni-button.umd.js"
|
||||
},
|
||||
"./dist/style.css": "./dist/ni.css"
|
||||
},
|
||||
|
||||
"sideEffects": [
|
||||
"**/*.css",
|
||||
"**/*.scss"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc && vite build",
|
||||
"build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json",
|
||||
"preview": "vite preview",
|
||||
"build": "vite build --config vite.config.ts && tsc -p tsconfig.build.json",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:preview": "vitepress preview docs",
|
||||
"test": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"test:ui": "vitest --ui",
|
||||
"prepublishOnly": "npm run build:lib"
|
||||
"docs:preview": "vitepress preview docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.3.4"
|
||||
@ -51,14 +38,7 @@
|
||||
"vue-tsc": "^1.8.8",
|
||||
"sass": "^1.66.1",
|
||||
"vitepress": "^1.0.0-rc.44",
|
||||
"@types/node": "^20.5.9",
|
||||
"unplugin-vue-components": "^0.25.2",
|
||||
"unplugin-auto-import": "^0.16.7",
|
||||
"@vue/test-utils": "^2.4.3",
|
||||
"vitest": "^0.34.6",
|
||||
"@vitest/coverage-v8": "^0.34.6",
|
||||
"@vitest/ui": "^0.34.6",
|
||||
"jsdom": "^22.1.0"
|
||||
"@types/node": "^20.5.9"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.0"
|
||||
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
Before Width: | Height: | Size: 1.5 KiB |
60
src/App.vue
60
src/App.vue
@ -1,60 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { NiButton } from './components/button/index'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container">
|
||||
<h1>Ni UI 组件库示例</h1>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>按钮组件</h2>
|
||||
<div class="demo-row">
|
||||
<NiButton>默认按钮</NiButton>
|
||||
<NiButton type="primary">主要按钮</NiButton>
|
||||
<NiButton type="success">成功按钮</NiButton>
|
||||
<NiButton type="warning">警告按钮</NiButton>
|
||||
<NiButton type="danger">危险按钮</NiButton>
|
||||
</div>
|
||||
|
||||
<div class="demo-row">
|
||||
<NiButton size="small">小型按钮</NiButton>
|
||||
<NiButton>默认大小</NiButton>
|
||||
<NiButton size="large">大型按钮</NiButton>
|
||||
</div>
|
||||
|
||||
<div class="demo-row">
|
||||
<NiButton disabled>禁用按钮</NiButton>
|
||||
<NiButton type="primary" disabled>禁用主要按钮</NiButton>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
margin-bottom: 40px;
|
||||
|
||||
h2 {
|
||||
margin-bottom: 20px;
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-row {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
Before Width: | Height: | Size: 496 B |
@ -1,58 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Button from '../Button.vue'
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('renders slot content', () => {
|
||||
const wrapper = mount(Button, {
|
||||
slots: {
|
||||
default: '按钮文本'
|
||||
}
|
||||
})
|
||||
expect(wrapper.text()).toBe('按钮文本')
|
||||
})
|
||||
|
||||
it('applies type class', () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: {
|
||||
type: 'primary'
|
||||
}
|
||||
})
|
||||
expect(wrapper.classes()).toContain('ni-button--primary')
|
||||
})
|
||||
|
||||
it('applies size class', () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: {
|
||||
size: 'small'
|
||||
}
|
||||
})
|
||||
expect(wrapper.classes()).toContain('ni-button--small')
|
||||
})
|
||||
|
||||
it('applies disabled class and attribute', () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: {
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
expect(wrapper.classes()).toContain('is-disabled')
|
||||
expect(wrapper.attributes('disabled')).toBeDefined()
|
||||
})
|
||||
|
||||
it('emits click event when clicked', async () => {
|
||||
const wrapper = mount(Button)
|
||||
await wrapper.trigger('click')
|
||||
expect(wrapper.emitted('click')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('does not emit click event when disabled', async () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: {
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
await wrapper.trigger('click')
|
||||
expect(wrapper.emitted('click')).toBeFalsy()
|
||||
})
|
||||
})
|
@ -1,5 +0,0 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
@ -1,79 +0,0 @@
|
||||
:root {
|
||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
#app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"root":["./src/index.ts","./src/main.ts","./src/vite-env.d.ts","./src/components/index.ts","./src/components/button/index.ts","./src/components/button/__tests__/button.test.ts","./src/types/index.d.ts","./src/app.vue","./src/components/button/button.vue"],"version":"5.8.3"}
|
4
types/components/index.d.ts
vendored
4
types/components/index.d.ts
vendored
@ -1,8 +1,6 @@
|
||||
import NiButton from './button';
|
||||
import NiText from './text';
|
||||
export { NiButton, NiText };
|
||||
export { NiButton, };
|
||||
declare const _default: {
|
||||
NiButton: import("vue").DefineComponent<{}, {}, any>;
|
||||
NiText: import("vue").DefineComponent<{}, {}, any>;
|
||||
};
|
||||
export default _default;
|
||||
|
2
vite.config.d.ts
vendored
2
vite.config.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const _default: import("vite").UserConfig;
|
||||
export default _default;
|
@ -1,6 +0,0 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
});
|
@ -1,30 +1,25 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
Components({
|
||||
dirs: ['src/components'],
|
||||
dts: 'src/components.d.ts',
|
||||
resolvers: [
|
||||
(name) => {
|
||||
if (name.startsWith('Ni')) {
|
||||
return {
|
||||
name,
|
||||
from: 'ni',
|
||||
sideEffects: 'ni/dist/style.css'
|
||||
}
|
||||
}
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
formats: ['es'],
|
||||
fileName: (format) => `ni.${format}.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ['vue'],
|
||||
output: {
|
||||
globals: {
|
||||
vue: 'Vue'
|
||||
},
|
||||
assetFileNames: (assetInfo) => {
|
||||
return assetInfo.name === 'style.css' ? 'ni.css' : assetInfo.name || ''
|
||||
}
|
||||
]
|
||||
}),
|
||||
AutoImport({
|
||||
imports: ['vue'],
|
||||
dts: 'src/auto-imports.d.ts'
|
||||
})
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
@ -1,25 +0,0 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
formats: ['es'],
|
||||
fileName: (format) => `ni.${format}.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ['vue'],
|
||||
output: {
|
||||
globals: {
|
||||
vue: 'Vue'
|
||||
},
|
||||
assetFileNames: (assetInfo) => {
|
||||
return assetInfo.name === 'style.css' ? 'ni.css' : assetInfo.name || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
2
vitest.config.d.ts
vendored
2
vitest.config.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const _default: import("vite").UserConfig & Promise<import("vite").UserConfig> & (import("vitest/config").UserConfigFnObject & import("vitest/config").UserConfigExport);
|
||||
export default _default;
|
@ -1,26 +0,0 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { resolve } from 'path';
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
globals: true,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'json', 'html'],
|
||||
exclude: [
|
||||
'node_modules/**',
|
||||
'dist/**',
|
||||
'**/*.d.ts',
|
||||
'test/**',
|
||||
'vitest.config.ts',
|
||||
],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
});
|
@ -1,27 +0,0 @@
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
globals: true,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'json', 'html'],
|
||||
exclude: [
|
||||
'node_modules/**',
|
||||
'dist/**',
|
||||
'**/*.d.ts',
|
||||
'test/**',
|
||||
'vitest.config.ts',
|
||||
],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue
Block a user