Skip to content

Commit

Permalink
others($cmd): add render package cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
iq9891 committed Mar 18, 2022
1 parent 3e4ca7a commit fea0a55
Show file tree
Hide file tree
Showing 14 changed files with 949 additions and 50 deletions.
97 changes: 97 additions & 0 deletions docs/introduce/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!-- @format -->

# 参与贡献

记录一下开发的相关事宜~

## 环境准备

### node 和 pnpm

开发 BIU 需要 node 16+ 和 pnpm。node 推荐用 nvm 安装,避免权限问题的同时还随时切换 node 版本;pnpm 去[他的官网](https://pnpm.io/installation)选择一种方式安装即可。

### Clone 项目

```bash
$ git clone git@github.com:fe6/biu.git
$ cd biu
```

### 安装依赖

```bash
$ pnpm i
```

## 常用任务

### 启动 start 命令

本地开发 BIU 必开命令,用于编译 src 下的 TypeScript 文件到 dist 目录,同时监听文件变更,有变更时增量编译。

```bash
$ pnpm start
```

如果觉得比较慢,也可以只跑特定 pacakge 的 start 命令,比如。

```bash
$ cd packages/biu
$ pnpm start
```

### 跑 example

demos 目录下保存了各种用于测试的例子,跑 demo 是开发 Umi 时确认功能正常的常用方式。每个 example 都配了 dev script,所以进入 example 然后执行 `pnpm start` 即可。

```bash
$ cd demos/hello-word
$ pnpm start
```

### 文档

文档是 vitepress。

```bash
$ pnpm doc:dev
```

然后打开提示的端口号即可。

### 新增 package

新增 package 有封装脚本,无需手动复制 package.json 等文件。分两步,1)创建目录 2)执行 `pnpm bootstrap`

- 直接创建 biu 文件夹,并生成新的 package

```bash
$ pnpm bootstrap biu
```

- 手动创建文件夹,自动生成新是 package

```bash
$ mkdir packages/foo
$ pnpm bootstrap
```

### 更新依赖

> 不推荐。
执行 `pnpm dep:update` 可更新依赖。

```bash
$ pnpm dep:update
```

由于 BIU 有针对依赖做预打包处理,更新依赖后还需检查更新的依赖是否为 devDependencies 并且有对此做依赖预打包。如果有,需要在对应 package 下执行 `pnpm build:deps` 并指定依赖,用于更新预打包的依赖文件。

```bash
$ pnpm build:deps --dep webpack-manifest-plugin
```

### 发布

TODO
28 changes: 2 additions & 26 deletions docs/plugin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,8 @@

# 插件

:::tip 主要项
EMP v2 plugin 结合 webpack chain 提供对 webpack 自定义配置,详细类型 [[点击了解]](https://github.com/efoxTeam/emp/blob/26c89aa3fc5494f274a714b6b09844b66b5e1237/packages/emp/src/config/plugins.ts#L9)
:::
TODO

## 官方插件

### [@efox/emp/plugin-vue-2](https://github.com/efoxTeam/emp/tree/next/packages/plugin-vue-2)

- 提供 vue 2 编译支持

```js
const { defineConfig } = require('@efox/emp');
const vue = require('@efox/plugin-vue-2');
module.exports = defineConfig({
plugins: [vue],
});
```

### [@efox/emp/plugin-babel-react](https://github.com/efoxTeam/emp/tree/next/packages/plugin-babel-react)

- 提供 react babel 编译支持

```js
const { defineConfig } = require('@efox/emp');
const babelReact = require('@efox/plugin-babel-react');
module.exports = defineConfig({
plugins: [babelReact],
});
```
TODO
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
"name": "biu",
"description": "Pluggable enterprise-level application framework.",
"scripts": {
"bootstrap": "esno scripts/bootstrap.ts",
"build": "pnpm build:pkg",
"build:pkg": "pnpm run --filter=@efox/emp build && pnpm run --filter=@efox/* --filter=!@efox/emp --parallel build",
"docs:dev": "vitepress dev docs --host",
"docs:build": "vitepress build docs",
"docs:start": "vitepress serve docs --host",
"prebuild": "[[ $CI = true ]] && npx pnpm@6 install -r --store=node_modules/.pnpm-store || echo skiping pnpm install",
"lint": "pretty-quick",
"postinstall": "husky install"
"preinstall": "npx only-allow pnpm",
"prepare": "husky install"
},
"repository": {
"type": "git",
Expand All @@ -26,11 +28,19 @@
"@commitlint/config-conventional": "^16.2.1",
"@fe6/norm-git-cz-config": "^0.1.1",
"@fe6/norm-prettier": "^0.1.0",
"@types/node": "^17.0.21",
"cz-customizable": "^6.3.0",
"esno": "^0.14.1",
"husky": "^7.0.4",
"only-allow": "^1.1.0",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"vitepress": "^0.22.3"
"ts-node": "^10.7.0",
"ts-transform-paths": "^2.0.3",
"ttypescript": "^1.5.13",
"typescript": "^4.6.2",
"vitepress": "^0.22.3",
"zx": "4.3.0"
},
"packageManager": "pnpm@6.32.0",
"engines": {
Expand Down
3 changes: 3 additions & 0 deletions packages/biu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- @format -->

# @fe6/biu
28 changes: 28 additions & 0 deletions packages/biu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@fe6/biu",
"version": "0.0.0",
"description": "@fe6/biu",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "pnpm ttsc",
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
"start": "pnpm ttsc -w"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fe6/biu.git",
"directory": "packages/biu"
},
"authors": [
"tainyi <649076408@qq.com> (https://github.com/iq9891)"
],
"license": "MIT",
"bugs": "https://github.com/fe6/biu/issues",
"publishConfig": {
"access": "public"
}
}
5 changes: 5 additions & 0 deletions packages/biu/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @format */

export default () => {
return '@fe6/biu';
};
8 changes: 8 additions & 0 deletions packages/biu/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "dist"
},
"include": ["src"]
}
18 changes: 18 additions & 0 deletions packages/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"strict": true,
"declaration": true,
"declarationMap": true,
"noUnusedLocals": false,
"esModuleInterop": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"plugins": [{ "transform": "ts-transform-paths" }]
},
"exclude": ["node_modules", ".pnpm", "**/node_modules", "**/demo", "**/dist"]
}
Loading

0 comments on commit fea0a55

Please sign in to comment.