Skip to content

Commit

Permalink
refactor: init project
Browse files Browse the repository at this point in the history
  • Loading branch information
chinbor committed Apr 7, 2023
0 parents commit 36ded5e
Show file tree
Hide file tree
Showing 25 changed files with 6,877 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.cache
.DS_Store
.idea
.nuxt
.output
.temp
*.local
*.log
*.vsix
.temp
.eslintcache

coverage
dist
node_modules
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# registry=https://registry.npmjs.org
ignore-workspace-root-check=true
shamefully-hoist=true
strict-peer-dependencies=false
auto-install-peers=false
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": false,
"files.eol": "\n",
"unocss.root": ["./packages/client"]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 bfu & chinbor Mn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Bfu

the demo of [this](https://www.bilibili.com/video/BV1KQ4y1S7ER/?p=2&spm_id_from=pageDriver&vd_source=42ddedc50b84f4be4022e6fb50516b63)

## Usage

run `dev` to start the project.

## License

[MIT](https://github.com/chinbor/automne/blob/main/LICENSE) License © 2023 [chinbor](https://github.com/chinbor)
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "bfu",
"version": "1.0.0",
"description": "File uploader",
"packageManager": "[email protected]",
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "nr -r dev"
},
"keywords": [
"big file",
"uploader",
"progress control"
],
"author": "chinbor",
"license": "MIT",
"devDependencies": {
"@antfu/eslint-config": "^0.38.4",
"eslint": "^8.37.0",
"lint-staged": "^13.2.0",
"only-allow": "^1.1.1",
"simple-git-hooks": "^2.8.1",
"typescript": "^5.0.3"
},
"eslintConfig": {
"extends": [
"@antfu"
]
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*.{js,ts,tsx,vue,md}": [
"eslint --fix"
]
}
}
548 changes: 548 additions & 0 deletions packages/client/auto-imports.d.ts

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions packages/client/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'

export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
10 changes: 10 additions & 0 deletions packages/client/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pages/client" />
/// <reference types="vite-plugin-vue-layouts/client" />

declare module '*.vue' {
import type { DefineComponent } from 'vue'

const component: DefineComponent<{}, {}, any>
export default component
}
13 changes: 13 additions & 0 deletions packages/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "uploader-client",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"vue": "^3.2.47",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@types/node": "^18.14.2",
"@vitejs/plugin-vue": "^4.0.0",
"@vue-macros/volar": "^0.9.5",
"@vue/tsconfig": "^0.1.3",
"@vueuse/core": "^9.13.0",
"npm-run-all": "^4.1.5",
"typescript": "~4.8.4",
"unocss": "^0.50.6",
"unplugin-auto-import": "^0.15.2",
"unplugin-vue-components": "^0.24.1",
"unplugin-vue-macros": "^2.0.0",
"vite": "^4.1.4",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-vue-layouts": "^0.8.0",
"vue-tsc": "^1.2.0"
}
}
Binary file added packages/client/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<router-view />
</template>
15 changes: 15 additions & 0 deletions packages/client/src/layouts/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<main>
<router-view v-slot="{ Component, route }">
<transition
enter-active-class="animate-fade-in animate-duration-300"
leave-active-class="animate-fade-out animate-duration-300"
mode="out-in"
>
<div>
<component :is="Component" :key="route.name" />
</div>
</transition>
</router-view>
</main>
</template>
15 changes: 15 additions & 0 deletions packages/client/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createApp } from 'vue'
import App from './App.vue'
import '@unocss/reset/tailwind.css'
import './style/main.css'
import 'uno.css'
import type { GlobModule } from './types'

console.log(1)

const app = createApp(App)

Object.values(import.meta.glob<GlobModule>('./modules/*.ts', { eager: true }))
.forEach(i => i.install?.(app))

app.mount('#app')
8 changes: 8 additions & 0 deletions packages/client/src/modules/router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router'
import generatedRoutes from 'virtual:generated-pages'
import { setupLayouts } from 'virtual:generated-layouts'
import type { UserModule } from '../types'

export const router = createRouter({ routes: setupLayouts(generatedRoutes), history: createWebHistory() })

export const install: UserModule = app => app.use(router)
16 changes: 16 additions & 0 deletions packages/client/src/pages/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<div w100vw h100vh fcc>
<button button-base class="mx-10" @click="() => $router.push('/svgLoading')">
SvgLoading
</button>
<button button-base class="mx-10" @click="() => $router.push('/flyBox')">
FlyBox
</button>
<button button-base class="mx-10" @click="() => $router.push('/fullContainer')">
FullContainer
</button>
<button button-base class="mx-10" @click="() => $router.push('/waterfallsFlow')">
WaterfallsFlow
</button>
</div>
</template>
6 changes: 6 additions & 0 deletions packages/client/src/style/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
html,
body {
width: 100%;
height: 100%;
background-color: rgb(34, 34, 34);
}
8 changes: 8 additions & 0 deletions packages/client/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { App } from 'vue'

export type UserModule = (ctx: App) => void

export interface GlobModule {
install: UserModule
[key: string]: any
}
23 changes: 23 additions & 0 deletions packages/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": ["esnext", "dom"],
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"noImplicitAny": false,
"strictNullChecks": true,
"resolveJsonModule": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"jsx": "preserve",
"types": ["node", "vite/client"],
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
}
},
"exclude": ["**/dist/**"],
"include": ["**/*.ts", "**/*.d.ts", "**/*.vue"]
}
14 changes: 14 additions & 0 deletions packages/client/unocss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig, presetAttributify, presetIcons, presetTypography, presetUno, transformerDirectives, transformerVariantGroup } from 'unocss'

export default defineConfig({
presets: [
presetUno({ preflight: false }),
presetAttributify(),
presetIcons({
scale: 1.1,
cdn: 'https://esm.sh/',
}),
presetTypography(),
],
transformers: [transformerVariantGroup(), transformerDirectives()],
})
41 changes: 41 additions & 0 deletions packages/client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { URL, fileURLToPath } from 'node:url'

import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
// @ts-expect-error: something wrong, but I need it
import VueMacros from 'unplugin-vue-macros/vite'
import Layouts from 'vite-plugin-vue-layouts'
import Pages from 'vite-plugin-pages'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
VueMacros({
plugins: {
vue: Vue(),
},
}),
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core'],
vueTemplate: true,
dts: 'auto-imports.d.ts',
}),
Components({
dts: 'components.d.ts',
}),
UnoCSS(),
Layouts({
layoutsDirs: 'src/layouts',
defaultLayout: 'Index',
}),
Pages(),
],
resolve: {
alias: {
'~': fileURLToPath(new URL('./src', import.meta.url)),
},
},
})
Loading

0 comments on commit 36ded5e

Please sign in to comment.