Skip to content

初始化项目

前端 框架

sh
pnpm create vue@latest
sh
pnpm create umi@latest

pnpm umi g

--no-git # 创建项目,但不初始化 Git
--no-install # 创建项目,但不自动安装依赖
sh
# 需要翻墙
pnpm dlx nuxi@latest init
sh
npx degit dcloudio/uni-preset-vue#vite-ts 项目名称
sh
npx @modern-js/create@latest 项目名称

node http-server 框架

sh
pnpm init midway
sh
pnpm create hono@latest
sh
fastify generate 项目名称 --lang=ts
sh
nest new 项目名称 --strict

pnpm-workspace.yaml

pnpm-workspace.yaml

yaml
packages:
  - "web"
  - "server"
  # all packages in direct subdirs of packages/
  - "packages/*"
  # all packages in subdirs of components/
  - "components/**"
  # exclude packages that are inside test directories
  - "!**/test/**"

workspace 中 package.json 的 name 很重要!!! workspace 中 package.json 的 name 很重要!!! workspace 中 package.json 的 name 很重要!!!

pnpm add <pkg> --workspace

my node project v1

sh
npp create hono@latest
sh
pnpm add drizzle-orm pg dotenv
pnpm add -D drizzle-kit tsx @types/pg

目录结构

📦 <project root>
 ├ 📂 src
 │   ├ 📂 db
 │   │  ├ 📂 crud
 │   │  ├ 📂 schema
 │   │  └ 📜 index.ts
 │   ├ 📂 basic
 │   ├ 📂 business
 │   └ 📜 index.ts
 ├ 📜 .env
 ├ 📜 drizzle.config.ts
 ├ 📜 package.json
 └ 📜 tsconfig.json
json
{
  "compilerOptions": {
    // 路径别名
    "baseUrl": ".",
    "paths": {
      "~/*": ["./src/*"]
    }
  }
}
ts
import "dotenv/config";
import { defineConfig } from "drizzle-kit";

export default defineConfig({
  out: "./drizzle",
  schema: "./src/db/schema",
  dialect: "postgresql",
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});
sh
DATABASE_URL=postgresql://qin:1@192.168.1.4:5432/db1

Type Script

tsc --init

gitignore

.DS_Store
dist/
.idea/

node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

uniapp

创建 vue3 + uni-ui https://juejin.cn/post/7348363815657390121