Skip to content

rockhentai/umi-demo

Repository files navigation

Environment Prepare

Install node_modules:

npm install

or

yarn

Start project

npm start

Build project

npm run build

导出多页面

// config.js
exportStatic: {
  htmlSuffix: true,
},

Check code style

npm run lint

Deploy project

  • 更新版本号

根据实际版本情况选择更新patch/minor/major版本,以minor示例

npm version minor 
  • 配置阿里云oss

umi-plugin-oss文档

在打包之前注意将你的oss信息配置正确

// config/config.oss.js
export default {
  plugins: [
    ...plugins,
    ['umi-plugin-oss', {
      accessKeyId: 'string',
      accessKeySecret: 'string',
      acl: 'public-read',
      bucket: {
        name: 'lilith-xx-cn',
        endpoint: 'oss-cn-shanghai.aliyuncs.com',
      },
      prefix: `static/${pkg.version}/`,
    }]
  ]
}

prefix为相对应的项目版本号

  • 打包并上传静态资源
npm run build:oss

记录Change record

  • 安装工具

conventional-changelog-cli可以根据git元数据生成更新日志

npm install -g conventional-changelog-cli

commitizen可以规范你的git commit信息,conventional-changelog-cli从而可以生成更清晰的日志

npm install -g commitizen
  • 初始化

项目根目录下生成CHANGELOG.md

conventional-changelog -p angular -i CHANGELOG.md -s
commitizen init cz-conventional-changelog --save --save-exact

运行成功后,package.json会新增如下内容:

"devDependencies": {
  "cz-conventional-changelog": "^3.1.0"
},
"config": {
  "commitizen": {
    "path": "./node_modules/cz-conventional-changelog"
  }
}
  • 提交commit

完成以上操作后,git commit 便可以通过 git cz 代替,通过交互式命令完成commit操作

// 工作区
git add .
git cz

[email protected], [email protected]

? Select the type of change that youre committing: feat:     A new feature
? What is the scope of this change (e.g. component or file name): (press enter to skip) 
? Write a short, imperative tense description of the change (max 94 chars):
 (10) 你的commit信息
? Provide a longer description of the change: (press enter to skip)
 
? Are there any breaking changes? No
? Does this change affect any open issues? No
  • 记录版本号,更新CHANGELOG

结合npm version和conventional-changelog使用,可以同时更新CHANGELOG.md

准备好脚本

// package.json
"scripts": {
  "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
}
npm version patch -m "xxx"

执行这条命令会更新package.json中的version字段

同时会执行conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md,更新CHANGELOG.md

执行完这条命令后,可以看到CHANGELOG.md已经被修改了

change log

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published