提交 6a182a2c 作者: 方治民

style: 代码格式问题修复

上级 619016b3
......@@ -30,12 +30,7 @@ export function getThemeColors(color?: string) {
return [...lightColors, ...modeColors]
}
export function generateColors({
color = primaryColor,
mixLighten,
mixDarken,
tinycolor,
}: GenerateColorsParams) {
export function generateColors({ color = primaryColor, mixLighten, mixDarken, tinycolor }: GenerateColorsParams) {
const arr = new Array(19).fill(0)
const lightens = arr.map((_t, i) => {
return mixLighten(color, i / 5)
......
import path from 'path'
import path from 'node:path'
import fs from 'fs-extra'
import inquirer from 'inquirer'
import colors from 'picocolors'
......@@ -30,7 +30,7 @@ async function generateIcon() {
{
type: 'list',
name: 'iconSet',
choices: choices,
choices,
message: 'Select the icon set that needs to be generated?',
},
{
......@@ -51,25 +51,17 @@ async function generateIcon() {
if (data) {
const { prefix } = data
const isLocal = useType === 'local'
const icons = Object.keys(data.icons).map(
(item) => `${isLocal ? prefix + ':' : ''}${item}`,
)
const icons = Object.keys(data.icons).map((item) => `${isLocal ? `${prefix}:` : ''}${item}`)
await fs.writeFileSync(
path.join(output, `icons.data.ts`),
`export default ${
isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })
}`,
`export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`,
)
prefixSet.push(prefix)
}
}
fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'))
console.log(
`✨ ${colors.cyan(`[${pkg.name}]`)}` +
' - Icon generated successfully:' +
`[${prefixSet}]`,
)
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`)
})
}
......
import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'
import dotenv from 'dotenv'
export function isDevFn(mode: string): boolean {
......@@ -50,7 +50,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
*/
function getConfFiles() {
const script = process.env.npm_lifecycle_script
const reg = new RegExp('--mode ([a-z_\\d]+)')
const reg = /--mode ([a-z_\d]+)/
const result = reg.exec(script as string) as any
if (result) {
const mode = result[1] as string
......
......@@ -70,7 +70,7 @@ export function configStyleImportPlugin(_isBuild: boolean) {
return ignoreList.includes(name)
? ''
: replaceList.hasOwnProperty(name)
: Object.prototype.hasOwnProperty.call(replaceList, name)
? `ant-design-vue/es/${replaceList[name]}/style/index`
: `ant-design-vue/es/${name}/style/index`
},
......
......@@ -3,8 +3,8 @@
* https://github.com/anncwb/vite-plugin-svg-icons
*/
import path from 'node:path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'path'
export function configSvgIconsPlugin(isBuild: boolean) {
const svgIconsPlugin = createSvgIconsPlugin({
......
......@@ -2,16 +2,10 @@
* Vite plugin for website theme color switching
* https://github.com/anncwb/vite-plugin-theme
*/
import path from 'node:path'
import type { PluginOption } from 'vite'
import path from 'path'
import {
viteThemePlugin,
antdDarkThemePlugin,
mixLighten,
mixDarken,
tinycolor,
} from 'vite-plugin-theme'
import { getThemeColors, generateColors } from '../../config/themeConfig'
import { antdDarkThemePlugin, mixDarken, mixLighten, tinycolor, viteThemePlugin } from 'vite-plugin-theme'
import { generateColors, getThemeColors } from '../../config/themeConfig'
import { generateModifyVars } from '../../generate/generateModifyVars'
export function configThemePlugin(isBuild: boolean): PluginOption[] {
......@@ -48,7 +42,7 @@ export function configThemePlugin(isBuild: boolean): PluginOption[] {
antdDarkThemePlugin({
preloadFiles: [
path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.less'),
//path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.dark.less'),
// path.resolve(process.cwd(), 'node_modules/ant-design-vue/dist/antd.dark.less'),
path.resolve(process.cwd(), 'src/design/index.less'),
],
filter: (id) => (isBuild ? !id.endsWith('antd.less') : true),
......
......@@ -22,7 +22,7 @@ export function createProxy(list: ProxyList = []) {
// https://github.com/http-party/node-http-proxy#options
ret[prefix] = {
target: target,
target,
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
......
// import * as Pont from 'pont-engine'
import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine'
import type { BaseClass, Interface } from 'pont-engine'
import { CodeGenerator, Property } from 'pont-engine'
// 接口 API 前缀
// 通常与项目的 env 配置中的 VITE_GLOB_API_URL_PREFIX 相同
......@@ -38,7 +39,7 @@ export default class BasicGenerator extends CodeGenerator {
return `${requestParams.replace(
'options?: any',
`config?: http.RequestConfig<${
bodyTypeDef ? bodyTypeDef : `Params${requestParams.includes('form') ? ' | FormData' : ''}`
bodyTypeDef || `Params${requestParams.includes('form') ? ' | FormData' : ''}`
}>`,
)}, options?: http.RequestOptions`
}
......
import { StandardDataSource } from 'pont-engine'
import type { StandardDataSource } from 'pont-engine'
export default function transform(dataSource: StandardDataSource): StandardDataSource {
console.log(dataSource)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论