Music Markdown 项目教程
1. 项目的目录结构及介绍
Music Markdown 项目的目录结构如下:
music-markdown/
├── github/workflows/
├── public/
├── src/
├── .firebaserc
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── LICENSE
├── README.md
├── custom-chord.png
├── firebase.json
├── index.html
├── package-lock.json
├── package.json
├── tsconfig.json
└── vite.config.ts
目录介绍
github/workflows/
: 包含 GitHub Actions 的工作流配置文件。public/
: 存放公共静态资源文件。src/
: 包含项目的源代码文件。.firebaserc
: Firebase 配置文件。.gitignore
: Git 忽略文件配置。.prettierignore
: Prettier 忽略文件配置。.prettierrc.json
: Prettier 代码格式化配置文件。LICENSE
: 项目许可证文件。README.md
: 项目说明文档。custom-chord.png
: 自定义和弦图。firebase.json
: Firebase 项目配置文件。index.html
: 项目主页文件。package-lock.json
: npm 依赖锁定文件。package.json
: npm 项目配置文件。tsconfig.json
: TypeScript 配置文件。vite.config.ts
: Vite 配置文件。
2. 项目的启动文件介绍
项目的启动文件主要是 package.json
中的 scripts
部分:
{
"scripts": {
"start": "npm run dev",
"dev": "vite",
"build": "vite build",
"serve": "firebase emulators:start --only functions,firestore,hosting",
"deploy": "firebase deploy --only functions,firestore,hosting"
}
}
启动命令介绍
npm start
: 启动开发服务器。npm run dev
: 使用 Vite 启动开发服务器。npm run build
: 构建项目。npm run serve
: 启动 Firebase 模拟器。npm run deploy
: 部署项目到 Firebase。
3. 项目的配置文件介绍
vite.config.ts
Vite 配置文件,用于配置开发服务器和构建过程:
import { defineConfig } from 'vite';
export default defineConfig({
// 配置选项
});
tsconfig.json
TypeScript 配置文件,用于配置 TypeScript 编译选项:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"]
},
"include": ["src"]
}
firebase.json
Firebase 配置文件,用于配置 Firebase 项目:
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
package.json
npm 项目配置文件,包含项目依赖和脚本:
{
"name": "music-markdown",
"version": "1.0.0",
"scripts": {
"start": "npm run dev",
"dev": "vite",
"build": "vite build",
"serve": "firebase emulators:start --only functions,firestore,hosting",
"deploy": "firebase deploy --only functions,firestore,hosting"
},
"dependencies": {
// 依赖列表
},
"devDependencies": {
// 开发依赖列表
}
}
以上是 Music Markdown 项目的目录结构、启动文件