
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
一个脚手架,平时用来做一些自动化的操作 或者生成一个通用的项目 后续慢慢添加好用的功能,持续更新中
设计本脚手架的初衷是为了省去重复且无聊的步骤(其实就是想偷懒 😁),脚手架中的一些命令是为了配合动态路由而设计的,当然你可以选择直接使用脚手架生成一个项目,这个项目已经包含了动态路由相关的;如果你是想抱着练习的态度你完全可以使用这些命令,这样会让你加深对动态路由的认识,本套 cms 的设计思想如下(这里提一嘴,每个人的思想和架构是不同的,我们没必要去抵触,选取有用的学习就行了,正所谓多条思路不是多个办法吗~)
所有文件夹都采用一一对应的设计模式
路由,每个路由对应一个文件夹,该文件夹下对应当前路由的路由对象
// 读取router/main下面的所有ts文件,拿到路由对象,放到localRoutes数组里
const files: Record<string, any> = import.meta.glob(
'../router/main/**/*.ts',
{
eager: true,
}
)
// 上面会拿到一个数组,然后遍历即可
for (const file in files) {
const module = files[file]
console.log(module.default)
localRoutes.push(module.default)
}
src
├─ App.vue
├─ assets
│ └─ logo.svg
├─ components
├─ main.ts
├─ router
│ ├─ index.ts
│ └─ main
│ ├─ product
│ │ └─ goods
│ │ └─ goods.ts
│ └─ story
│ ├─ chat
│ │ └─ chat.ts
│ └─ list
│ └─ list.ts
├─ service
│ ├─ index.ts
│ ├─ main
│ │ ├─ main.ts
│ │ ├─ product
│ │ │ └─ goods
│ │ │ └─ goods.ts
│ │ └─ story
│ │ ├─ chart
│ │ │ └─ chart.ts
│ │ └─ list
│ │ └─ list.ts
│ └─ request
│ ├─ index.ts
│ └─ types.ts
├─ store
│ ├─ index.ts
│ └─ main
│ ├─ main.ts
│ ├─ product
│ │ └─ goods
│ │ └─ goods.ts
│ └─ story
│ ├─ chart
│ │ └─ chart.ts
│ └─ list
│ └─ list.ts
└─ views
└─ main
├─ main.ts
├─ product
│ └─ goods
│ └─ goods.ts
└─ story
├─ chart
│ └─ chart.ts
└─ list
└─ list.ts
会生成一个 vue 通用后台项目
ymcli create project
# project 项目名称
eg: ymcli create demo
如果我们需要大量生成重复的组件,不要每个都手写(是可以 copy,但是里面的名称还要手动的更改,好麻烦哦) 比如我们在创建一个后台项目的时候,有多少个菜单就要创建多少个 vue 文件。。。
不用担心文件夹不存在哦 如果不存在的话会自动帮你创建的 默认情况下创建的是 VUE3 的组件
./src/components 下创建当前组件 # NavBar 是组件名称
ymcli addcpn cpnname
eg: ymcli addcpn NavBar
# NavBar 是组件名称
ymcli addcpn cpnname --dest url
eg: ymcli addcpn NavBar --dest ./src/views/home
ymcli addcpn cpnname type --dest ./src/views/home
eg: ymcli addcpn NavBar v3t --dest ./src/views/home
| 类型 | 解释 |
|---|---|
| v3 | 默认值,创建一个 vue3 的模版 |
| v2 | 创建一个 vu2 的模版 |
| v3t | 创建一个 vue3+ts 的模版 |
该命令会自动生成一个 route 文件,并且会生成该 route 对应的 vue 文件
# NavBar 是组件名称
# type: 如果是js 会创建js路由文件 同时创建vue3的模版
# type: 如果是ts 会创建ts路由文件 同时创建vue3+ts的模版
# type 默认是js
ymcli addroutefile routefilename type --dest url
eg: ymcli addroutefile demo --dest ./src/router/demo
创建一个基于 ElementUI 的 Vue2 Dialog 组件
ymcli adddialog name --dest url
eg: ymcli adddialog ymDialog --dest ./src/views/home
会根据 js/ts 文件生成对应的 route 对象和该 route 对应的 vue 组件,注意导出的时候要使用commonjs的导出方式
ymcli addroutecpns filepath type
# filepath:文件地址 type:ts || js 默认type js
eg: ymcli adddialog ./index.ts ts
// name 和 dest 是必要的
// title是非必要的,title的作用是让自己可以知道模块叫啥方便自己阅读
module.exports = [
{
name: 'login', // 生成的文件名称
dest: 'src/views/login', // 生成到拿个文件夹
},
{
name: 'main',
dest: 'src/views/main',
},
{
title: '模型锤炼',
name: 'modelTemperingInfo',
dest: 'src/views/main/modelManager/modelTemperingInfo',
},
]
FAQs
一个脚手架,平时用来做一些自动化的操作 或者生成一个通用的项目 后续慢慢添加好用的功能,持续更新中
The npm package wscym receives a total of 22 weekly downloads. As such, wscym popularity was classified as not popular.
We found that wscym demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.