Skip to content

Commit

Permalink
style(projects): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Dec 14, 2023
1 parent a176dc4 commit a748166
Show file tree
Hide file tree
Showing 127 changed files with 2,453 additions and 2,987 deletions.
7 changes: 4 additions & 3 deletions build/config/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { ProxyOptions } from 'vite';
import { createServiceConfig, createProxyPattern } from '../../env.config';
import { createProxyPattern, createServiceConfig } from '../../env.config';

/**
* set http proxy
* @param env - the current env
* Set http proxy
*
* @param env - The current env
*/
export function createViteProxy(env: Env.ImportMeta) {
const isEnableHttpProxy = env.VITE_HTTP_PROXY === 'Y';
Expand Down
5 changes: 2 additions & 3 deletions build/plugins/unocss.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process';
import path from 'node:path';
import unocss from '@unocss/vite';
import presetIcons from '@unocss/preset-icons';
Expand All @@ -8,9 +9,7 @@ export function setupUnocss(viteEnv: Env.ImportMeta) {

const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon');

/**
* the name of the local icon collection
*/
/** The name of the local icon collection */
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '');

return unocss({
Expand Down
5 changes: 2 additions & 3 deletions build/plugins/unplugin.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process';
import path from 'node:path';
import type { PluginOption } from 'vite';
import Icons from 'unplugin-icons/vite';
Expand All @@ -12,9 +13,7 @@ export function setupUnplugin(viteEnv: Env.ImportMeta) {

const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon');

/**
* the name of the local icon collection
*/
/** The name of the local icon collection */
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '');

const plugins: PluginOption[] = [
Expand Down
10 changes: 6 additions & 4 deletions env.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* create service config by current env
* @param env the current env
* Create service config by current env
*
* @param env The current env
*/
export function createServiceConfig(env: Env.ImportMeta) {
const mockURL = 'https://mock.apifox.com/m1/3109515-0-default';
Expand Down Expand Up @@ -32,8 +33,9 @@ export function createServiceConfig(env: Env.ImportMeta) {
}

/**
* get proxy pattern of service url
* @param key if not set, will use the default key
* Get proxy pattern of service url
*
* @param key If not set, will use the default key
*/
export function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
if (!key) {
Expand Down
61 changes: 32 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "soybean-admin",
"type": "module",
"version": "1.0.0",
"packageManager": "pnpm@8.10.5",
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。",
"author": {
"name": "Soybean",
"email": "soybeanjs@outlook.com",
"url": "https://github.com/soybeanjs"
},
"type": "module",
"packageManager": "pnpm@8.10.5",
"scripts": {
"dev": "vite",
"build": "run-s typecheck build-only",
"preview": "vite preview",
"build-only": "vite build",
"typecheck": "vue-tsc --noEmit --skipLibCheck",
"lint": "eslint . --fix",
"format": "sa prettier-write",
"commit": "sa git-commit",
"cleanup": "sa cleanup",
"update-pkg": "sa update-pkg",
"prepare": "simple-git-hooks"
"commit": "sa git-commit",
"dev": "vite",
"format": "sa prettier-write",
"lint": "eslint . --fix",
"prepare": "simple-git-hooks",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit --skipLibCheck",
"update-pkg": "sa update-pkg"
},
"dependencies": {
"@better-scroll/core": "2.5.1",
Expand All @@ -30,45 +30,48 @@
"@sa/materials": "workspace:*",
"@sa/request": "workspace:*",
"@sa/utils": "workspace:*",
"@vueuse/core": "10.6.1",
"@vueuse/core": "10.7.0",
"clipboard": "2.0.11",
"dayjs": "1.11.10",
"lodash-es": "4.17.21",
"naive-ui": "2.35.0",
"nprogress": "0.2.0",
"pinia": "2.1.7",
"vue": "3.3.8",
"vue-i18n": "9.7.0",
"vue": "3.3.11",
"vue-i18n": "9.8.0",
"vue-router": "4.2.5"
},
"devDependencies": {
"@elegant-router/vue": "0.3.1",
"@iconify/json": "2.2.143",
"@iconify/json": "2.2.157",
"@sa/scripts": "workspace:*",
"@sa/uno-preset": "workspace:*",
"@soybeanjs/eslint-config": "^1.1.2",
"@types/lodash-es": "4.17.11",
"@types/node": "20.9.1",
"@soybeanjs/eslint-config": "1.1.3",
"@types/lodash-es": "4.17.12",
"@types/node": "20.10.4",
"@types/nprogress": "0.2.3",
"@unocss/preset-icons": "0.57.5",
"@unocss/preset-uno": "0.57.5",
"@unocss/transformer-directives": "0.57.5",
"@unocss/transformer-variant-group": "0.57.5",
"@unocss/vite": "0.57.5",
"@vitejs/plugin-vue": "4.5.0",
"@unocss/preset-icons": "0.58.0",
"@unocss/preset-uno": "0.58.0",
"@unocss/transformer-directives": "0.58.0",
"@unocss/transformer-variant-group": "0.58.0",
"@unocss/vite": "0.58.0",
"@vitejs/plugin-vue": "4.5.2",
"@vitejs/plugin-vue-jsx": "3.1.0",
"cross-env": "7.0.3",
"eslint": "8.55.0",
"eslint-plugin-vue": "9.19.2",
"npm-run-all": "4.1.5",
"sass": "1.69.5",
"simple-git-hooks": "2.9.0",
"typescript": "5.2.2",
"unplugin-icons": "0.17.4",
"unplugin-vue-components": "0.25.2",
"vite": "5.0.0",
"typescript": "5.3.3",
"unplugin-icons": "0.18.1",
"unplugin-vue-components": "0.26.0",
"vite": "5.0.8",
"vite-plugin-progress": "0.0.7",
"vite-plugin-svg-icons": "2.0.1",
"vite-plugin-vue-devtools": "1.0.0-rc.5",
"vue-tsc": "1.8.22"
"vite-plugin-vue-devtools": "1.0.0-rc.8",
"vue-eslint-parser": "9.3.2",
"vue-tsc": "1.8.25"
},
"simple-git-hooks": {
"commit-msg": "pnpm sa git-commit-verify",
Expand Down
4 changes: 1 addition & 3 deletions packages/color-palette/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
},
"typesVersions": {
"*": {
"*": [
"./src/*"
]
"*": ["./src/*"]
}
},
"dependencies": {
Expand Down
22 changes: 11 additions & 11 deletions packages/color-palette/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { getColorPaletteFamily } from './palette';
import { getColorName } from './name';
import type { ColorPalette, ColorPaletteNumber, ColorPaletteItem, ColorPaletteFamily } from './type';
import type { ColorPalette, ColorPaletteFamily, ColorPaletteItem, ColorPaletteNumber } from './type';
import defaultPalettes from './json/palette.json';

/**
* get color palette by provided color and color name
* @param color the provided color
* @param colorName color name
* Get color palette by provided color and color name
*
* @param color The provided color
* @param colorName Color name
*/
export function getColorPalette(color: string, colorName: string) {
const colorPaletteFamily = getColorPaletteFamily(color, colorName);
Expand All @@ -31,10 +32,11 @@ export function getColorPalette(color: string, colorName: string) {
}

/**
* get color by color palette number
* @param color color
* @param num color palette number
* @return color hexcode
* Get color by color palette number
*
* @param color Color
* @param num Color palette number
* @returns Color hexcode
*/
export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNumber) {
const colorPalette = getColorPalette(color, color);
Expand All @@ -46,9 +48,7 @@ export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNum

export default getColorPalette;

/**
* the builtin color palettes
*/
/** The builtin color palettes */
const colorPalettes = defaultPalettes as ColorPaletteFamily[];

export { getColorName, colorPalettes };
Expand Down
2 changes: 1 addition & 1 deletion packages/color-palette/src/name.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getHex, getRgb, getHsl } from './color';
import { getHex, getHsl, getRgb } from './color';
import colorNames from './json/color-name.json';

export function getColorName(color: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/color-palette/src/palette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValidColor, getHsl, getDeltaE, transformHslToHex } from './color';
import { getDeltaE, getHsl, isValidColor, transformHslToHex } from './color';
import { getColorName } from './name';
import type { ColorPaletteFamily, ColorPaletteFamilyWithNearestPalette } from './type';
import defaultPalettes from './json/palette.json';
Expand Down
40 changes: 13 additions & 27 deletions packages/color-palette/src/type.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
/**
* the color palette number
*/
/** The color palette number */
export type ColorPaletteNumber = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;

/**
* the color palette item
*/
/** The color palette item */
export type ColorPaletteItem = {
/**
* the color hexcode
*/
/** The color hexcode */
hexcode: string;
/**
* the color number
* The color number
*
* @link {@link ColorPaletteNumber}
*/
number: ColorPaletteNumber;
/**
* the color name
*/
/** The color name */
name: string;
};

export type ColorPaletteFamily = {
/**
* the color palette family key
*/
/** The color palette family key */
key: string;
/**
* the color palette family's palettes
*/
/** The color palette family's palettes */
palettes: ColorPaletteItem[];
};

Expand All @@ -47,17 +36,14 @@ export type ColorPaletteFamilyWithNearestPalette = ColorPaletteFamily & {
};

export type ColorPalette = ColorPaletteFamily & {
/**
* the color map of the palette
*/
/** The color map of the palette */
colorMap: Map<ColorPaletteNumber, ColorPaletteItem>;
/**
* the main color of the palette
* @description which number is 500
* The main color of the palette
*
* Which number is 500
*/
main: ColorPaletteItemWithName;
/**
* the match color of the palette
*/
/** The match color of the palette */
match: ColorPaletteItemWithName;
};
1 change: 1 addition & 0 deletions packages/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process';
import path from 'node:path';
import { defineConfig } from 'vitepress';

Expand Down
6 changes: 1 addition & 5 deletions packages/docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
var(--vp-c-brand-darker)
);

--vp-home-hero-image-background-image: linear-gradient(
-45deg,
var(--vp-c-brand-lightest) 30%,
var(--vp-c-brand) 50%
);
--vp-home-hero-image-background-image: linear-gradient(-45deg, var(--vp-c-brand-lightest) 30%, var(--vp-c-brand) 50%);
--vp-home-hero-image-filter: blur(40px);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "@sa/docs",
"version": "1.0.0",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"dev": "vitepress dev",
"serve": "vitepress serve"
},
"devDependencies": {
"vitepress": "1.0.0-rc.27"
"vitepress": "1.0.0-rc.31"
}
}
4 changes: 1 addition & 3 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
},
"typesVersions": {
"*": {
"*": [
"./src/*"
]
"*": ["./src/*"]
}
}
}
5 changes: 3 additions & 2 deletions packages/hooks/src/use-boolean.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ref } from 'vue';

/**
* boolean
* @param initValue init value
* Boolean
*
* @param initValue Init value
*/
export default function useBoolean(initValue = false) {
const bool = ref(initValue);
Expand Down
Loading

0 comments on commit a748166

Please sign in to comment.