Skip to content

Commit

Permalink
feat(projects): init
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Oct 12, 2023
0 parents commit 77b6e97
Show file tree
Hide file tree
Showing 168 changed files with 9,123 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
VITE_BASE_URL=/

VITE_APP_TITLE=SoybeanAdmin

VITE_APP_DESC=SoybeanAdmin is a fresh and elegant admin template

# the prefix of the icon name
VITE_ICON_PREFIX=icon

# the prefix of the local svg icon component, must include VITE_ICON_PREFIX
# format {VITE_ICON_PREFIX}-{local icon name}
VITE_ICON_LOCAL_PREFIX=icon-local
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_HTTP_PROXY=Y

1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_ROUTER_HISTORY_MODE=hash
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "sa/vue",
"settings": {
"import/core-modules": ["uno.css", "~icons/*", "virtual:svg-icons-register"]
}
}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/launch.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

package-lock.json
yarn.lock
pnpm-lock.yaml
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmmirror.com/
shamefully-hoist=true
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"recommendations": [
"antfu.unocss",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"formulahendry.auto-complete-tag",
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag",
"kisstkondoros.vscode-gutter-preview",
"mariusalchimavicius.json-to-ts",
"mhutchie.git-graph",
"sdras.vue-vscode-snippets",
"vue.volar",
"vue.vscode-typescript-vue-plugin"
]
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Vue debugger",
"url": "http://localhost:9527",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "TS debugger",
"skipFiles": ["<node_internals>/**"],
"runtimeArgs": ["--loader", "tsx"],
"program": "${relativeFile}"
}
]
}
54 changes: 54 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"cSpell.words": [
"Antd",
"antv",
"clsx",
"colord",
"consola",
"EDITMSG",
"espree",
"execa",
"hexcode",
"iconify",
"INDEXEDDB",
"jiti",
"kolorist",
"Laba",
"localforage",
"LOCALSTORAGE",
"nocheck",
"nprogress",
"ofetch",
"preflights",
"sider",
"tada",
"Uncapitalize",
"unocss",
"unplugin",
"VITE",
"vitepress",
"vueuse",
"WEBSQL",
"wechat"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.fontLigatures": true,
"editor.formatOnSave": false,
"editor.quickSuggestions": {
"strings": true
},
"editor.tabSize": 2,
"files.associations": {
"*.env.*": "dotenv",
"*.svg": "html"
},
"files.eol": "\n",
"unocss.root": ["./"],
"[html][css][less][scss][sass][markdown][yaml][yml][json][jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"]
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @sa/antv

SoybeanAdmin AntV
1 change: 1 addition & 0 deletions build/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './plugins';
37 changes: 37 additions & 0 deletions build/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { PluginOption } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import VueDevtools from 'vite-plugin-vue-devtools';
import ElegantVueRouter from '@elegant-router/vue/vite';
import progress from 'vite-plugin-progress';
import { setupUnocss } from './unocss';
import { setupUnplugin } from './unplugin';

export function setupVitePlugins(viteEnv: Env.ImportMeta) {
const plugins: PluginOption = [
vue({
script: {
defineModel: true
}
}),
vueJsx(),
VueDevtools(),
setupUnocss(viteEnv),
...setupUnplugin(viteEnv),
progress()
];

if (viteEnv.DEV) {
plugins.push(
ElegantVueRouter({
layouts: {
base: 'src/layouts/base-layout/index.vue',
blank: 'src/layouts/blank-layout/index.vue'
},
layoutLazyImport: () => false
})
);
}

return plugins;
}
33 changes: 33 additions & 0 deletions build/plugins/unocss.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import path from 'node:path';
import unocss from '@unocss/vite';
import presetIcons from '@unocss/preset-icons';
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders';

export function setupUnocss(viteEnv: Env.ImportMeta) {
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv;

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

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

return unocss({
presets: [
presetIcons({
prefix: `${VITE_ICON_PREFIX}-`,
scale: 1,
extraProperties: {
display: 'inline-block'
},
collections: {
[collectionName]: FileSystemIconLoader(localIconPath, svg =>
svg.replace(/^<svg\s/, '<svg width="1em" height="1em" ')
)
},
warn: true
})
]
});
}
50 changes: 50 additions & 0 deletions build/plugins/unplugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import path from 'node:path';
import type { PluginOption } from 'vite';
import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';

export function setupUnplugin(viteEnv: Env.ImportMeta) {
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv;

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

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

const plugins: PluginOption[] = [
Icons({
compiler: 'vue3',
customCollections: {
[collectionName]: FileSystemIconLoader(localIconPath, svg =>
svg.replace(/^<svg\s/, '<svg width="1em" height="1em" ')
)
},
scale: 1,
defaultClass: 'inline-block'
}),
Components({
dts: 'src/typings/components.d.ts',
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
resolvers: [
AntDesignVueResolver({
importStyle: false
}),
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
]
}),
createSvgIconsPlugin({
iconDirs: [localIconPath],
symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
inject: 'body-last',
customDomId: '__SVG_ICON_LOCAL__'
})
];

return plugins;
}
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>%VITE_APP_TITLE%</title>
</head>
<body>
<div id="app">
<div id="appLoading"></div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
76 changes: 76 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "@sa/antv",
"version": "2.0.0",
"description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、AntV and UnoCSS.",
"author": {
"name": "Soybean",
"email": "soybeanjs@outlook.com",
"url": "https://github.com/soybeanjs"
},
"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"
},
"dependencies": {
"@iconify/vue": "^4.1.1",
"@sa/materials": "workspace:*",
"@sa/utils": "workspace:*",
"@vueuse/core": "10.5.0",
"ant-design-vue": "4.0.3",
"lodash-es": "4.17.21",
"nprogress": "0.2.0",
"pinia": "2.1.6",
"vue": "3.3.4",
"vue-i18n": "9.5.0",
"vue-router": "4.2.5"
},
"devDependencies": {
"@elegant-router/vue": "0.2.2",
"@iconify-json/heroicons": "1.1.12",
"@iconify-json/ic": "1.1.14",
"@iconify-json/icon-park-outline": "1.1.12",
"@iconify-json/line-md": "1.1.31",
"@iconify-json/logos": "1.1.37",
"@iconify-json/material-symbols": "1.1.59",
"@iconify-json/ph": "1.1.6",
"@iconify-json/tabler": "1.1.94",
"@sa/scripts": "workspace:*",
"@sa/uno-preset": "workspace:*",
"@types/lodash-es": "4.17.9",
"@types/node": "20.8.4",
"@types/nprogress": "0.2.1",
"@unocss/preset-icons": "0.56.5",
"@unocss/preset-uno": "0.56.5",
"@unocss/transformer-directives": "0.56.5",
"@unocss/transformer-variant-group": "0.56.5",
"@unocss/vite": "0.56.5",
"@vitejs/plugin-vue": "4.4.0",
"@vitejs/plugin-vue-jsx": "3.0.2",
"cross-env": "7.0.3",
"eslint-config-sa": "workspace:*",
"npm-run-all": "4.1.5",
"simple-git-hooks": "2.9.0",
"typescript": "5.2.2",
"unocss-preset-scrollbar": "0.3.0",
"unplugin-icons": "0.17.0",
"unplugin-vue-components": "0.25.2",
"vite": "4.4.11",
"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.19"
},
"simple-git-hooks": {
"commit-msg": "pnpm sa git-commit-verify",
"pre-commit": "pnpm typecheck && pnpm sa lint-staged"
}
}
17 changes: 17 additions & 0 deletions packages/color-palette/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@sa/color-palette",
"version": "2.0.0",
"exports": {
".": "./src/index.ts"
},
"typesVersions": {
"*": {
"*": [
"./src/*"
]
}
},
"dependencies": {
"colord": "2.9.3"
}
}
Loading

0 comments on commit 77b6e97

Please sign in to comment.