Compare commits

...

2 Commits

Author SHA1 Message Date
ae025850b0 feat: add bunder 2023-05-03 20:09:26 +08:00
febc297d5e feat: add build 2023-05-03 19:43:56 +08:00
8 changed files with 1403 additions and 59 deletions

View File

@ -1,3 +1,5 @@
cache
.temp
*.log
es
lib

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ node_modules
dist
cache
.temp
es
lib

View File

@ -1,7 +1,12 @@
import { generate } from '@ant-design/colors'
import genControlHeight from '../shared/genControlHeight'
import genSizeMapToken from '../shared/genSizeMapToken'
import type { ColorPalettes, MapToken, PresetColorType, SeedToken } from '../../interface'
import type {
ColorPalettes,
MapToken,
PresetColorType,
SeedToken
} from '../../interface'
import { defaultPresetColors } from '../seed'
import genColorMapToken from '../shared/genColorMapToken'
import genCommonMapToken from '../shared/genCommonMapToken'
@ -10,7 +15,8 @@ import { generateColorPalettes, generateNeutralColorPalettes } from './colors'
export default function derivative(token: SeedToken): MapToken {
const colorPalettes = Object.keys(defaultPresetColors)
.map((colorKey: keyof PresetColorType) => {
.map((value) => {
const colorKey = value as keyof PresetColorType
const colors = generate(token[colorKey])
return new Array(10).fill(1).reduce((prev, _, i) => {

View File

@ -13,12 +13,23 @@
],
"license": "MIT",
"author": "aibayanyu",
"main": "dist/index.js",
"main": "lib/index.js",
"module": "es/index.js",
"types": "lib/index.d.ts",
"files": [
"lib",
"es",
"dist",
"README.md"
],
"scripts": {
"test": "vitest",
"prepare": "husky install",
"dev": "vitepress dev",
"build:site": "vitepress build",
"build:lib": "vite build --config vite.build.config.ts",
"build:umd": "vite build --config vite.bundle.config.ts",
"copy:css": "cpx \"components/style/*.css\" dist",
"preview": "vitepress preview"
},
"dependencies": {
@ -34,17 +45,19 @@
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@mistjs/eslint-config-vue-jsx": "^0.0.7",
"@mistjs/tsconfig": "^1.0.0",
"@mistjs/tsconfig-vue": "^0.0.3",
"@mistjs/tsconfig": "^1.1.1",
"@mistjs/tsconfig-vue": "^1.1.2",
"@types/node": "^18.15.10",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"cpx": "^1.5.0",
"eslint": "^8.36.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"typescript": "^4.9.5",
"typescript": "^5.0.4",
"unbuild": "^1.1.2",
"vite": "^4.2.1",
"vite-plugin-dts": "^2.3.0",
"vite-plugin-vitepress-demo": "2.0.0-beta.29",
"vitepress": "1.0.0-alpha.69",
"vitest": "^0.28.5"

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
{
"extends": "@mistjs/tsconfig-vue"
"extends": "@mistjs/tsconfig-vue",
"compilerOptions": {
"moduleResolution": "bundler"
}
}

46
vite.build.config.ts Normal file
View File

@ -0,0 +1,46 @@
import { defineConfig } from 'vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
import dts from 'vite-plugin-dts'
export default defineConfig({
plugins: [
vueJsx(),
dts({
outputDir: ['es', 'lib'],
include: ['components/**/*.ts', 'components/**/*.tsx']
})
],
build: {
rollupOptions: {
external: [
'@ant-design/colors',
/^@ant-design\/icons-vue/,
'@antd-tiny-vue/cssinjs',
'@ctrl/tinycolor',
'@v-c/utils',
'@vueuse/core',
'vue'
],
output: [
{
format: 'es',
dir: 'es',
entryFileNames: '[name].js',
preserveModules: true,
preserveModulesRoot: 'components'
},
{
format: 'cjs',
dir: 'lib',
entryFileNames: '[name].js',
preserveModules: true,
preserveModulesRoot: 'components',
exports: 'named'
}
]
},
lib: {
entry: 'components/index.ts',
formats: ['es', 'cjs']
}
}
})

13
vite.bundle.config.ts Normal file
View File

@ -0,0 +1,13 @@
import { defineConfig } from 'vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
plugins: [vueJsx()],
build: {
lib: {
entry: 'components/index.ts',
name: 'Antd',
fileName: () => `antd.js`,
formats: ['umd']
}
}
})