Skip to content

Commit

Permalink
feat: introduce create qiankun cli (#2700)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakushinring authored Jan 4, 2024
1 parent 56fef69 commit 4c7a773
Show file tree
Hide file tree
Showing 216 changed files with 5,261 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-jars-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-qiankun': minor
---

feat: introduce qiankun scaffold
5 changes: 5 additions & 0 deletions .changeset/lovely-colts-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@qiankunjs/create-qiankun": patch
---

feat: introduce qiankun scaffold
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
examples
dist
writable-dom
template

# TODO not linting test files temporary
__tests__/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ examples
.changeset/*
pnpm-lock.yaml
packages/sandbox/src/core/globals.ts
packages/create-qiankun/template

# changeset 会修改这个文件,导致 prettier:check 失败
packages/**/*/package.json
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"ci": "pnpm run build && pnpm run eslint && pnpm run prettier:check",
"ci:publish": "changeset publish",
"test": "pnpm -r run test",
"prepare": "husky install && dumi setup"
"prepare": "husky install && dumi setup",
"clean": "rimraf node_modules **/*/node_modules"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
Expand All @@ -39,6 +40,7 @@
"husky": "^8.0.3",
"lint-staged": "^9.5.0",
"prettier": "^3.0.3",
"rimraf": "^3.0.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/create-qiankun/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
platform: 'node',
cjs: {
input: 'src',
output: 'dist',
},
};
65 changes: 65 additions & 0 deletions packages/create-qiankun/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# @qiankunjs/create-qiankun

`@qiankunjs/create-qiankun` 是一个为 [qiankun](https://github.com/umijs/qiankun) 微前端框架设计的脚手架功能。旨在快速启动示例项目,方便开发者快速上手。

## 功能

- 支持选择一个或多个子应用来创建一个新的项目
- 支持主,子应用路由模式 `(hash, history)` 选择
- 支持一键生成 `npm/yarn/pnpm/pnpm workspace` 工程
- 注入启动应用脚本以及端口冲突检测

## 环境要求

1. 建议使用 Node.js 版本 v18 或更高版本。,推荐使用 [fnm](https://github.com/Schniz/fnm) 管理 node 版本

## 安装

使用 npm:

```bash
npx create-qiankun@latest
```

或使用 yarn:

```bash
yarn create qiankun@latest
```

或使用 pnpm:

```bash
pnpm dlx create-qiankun@latest
```

## 使用

## 模板列表

### 主应用模板

| 模板名称 | |
| --------------- | --- |
| React18+Webpack | |
| Vue3+Webpack | |
| React18+umi | |

### 子应用模板

| 模板名称 | |
| --------------- | --------------------------- |
| React18+Webpack | |
| React16+Webpack | |
| Vue3+Webpack | |
| Vue2+Webpack | ❗ 在 pnpm workspace 有问题 |
| Vite+Vue3 | 🚧 建设中 |
| Vite+React18 | 🚧 建设中 |

## 贡献

欢迎任何形式的贡献!请提交 PR 或开启 issue 讨论。

## 许可证

MIT
33 changes: 33 additions & 0 deletions packages/create-qiankun/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "create-qiankun",
"version": "0.0.1-rc.1",
"description": "An easy way to start a qiankun project",
"bin": {
"create-qiankun": "./dist/index.js"
},
"main": "./dist/index.js",
"scripts": {
"dev": "father dev",
"build": "father build"
},
"files": [
"dist"
],
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^3.1.9",
"execa": "^5.1.1",
"fs-extra": "^10.1.0",
"kolorist": "^1.8.0",
"minimist": "^1.2.6",
"prompts": "^2.4.2"
},
"devDependencies": {
"@types/ejs": "^3.1.3",
"@types/fs-extra": "^11.0.2",
"@types/minimist": "^1.2.3",
"@types/prompts": "^2.4.4"
}
}
Loading

0 comments on commit 4c7a773

Please sign in to comment.