Skip to content

Conversation

2nthony
Copy link
Member

@2nthony 2nthony commented Nov 6, 2021

Preview

Kapture 2021-11-06 at 21 33 20

Friendly Tips

此 PR 看似改动量很大,实则不然,在除去 https://github.com/antfu/unplugin-starter 模板提供的文件,重命名的文件,以及删除的无用文件后,需要 review 的文件大约如下:

  • readme * 2
  • build.sh
  • package.json (多为模板提供的改动
  • src/index.ts (前 index.js
  • src/snippet.ts (前 src/main.js
  • helpers/* (client 相关
  • utils/* (node 相关,前 utils/index.js

Features

  • vite, webpack, nuxt
  • 支持 popup 文本,消息和按钮 popupMessage, popupActionText

⚡️ Breaking ⚡️

参考迁移指南

image

MISC

  • 中文 readme
  • 重构 snippet.ts createInterval
  • build.sh
  • 有意义的虚拟文件入口命名 import x from 'xxx'
    • @update-popup (单一选择)
    • virtual:update-popup
    • ~update-popup
      • vite-plugin-pages 中同时具备 2, 3 情况,如需修改,同时也需要修改 readme

How

Describe your steps:

  1. use unplugin to become a universal plugin that support vite and webpack.

Test

Vite

881635853500_ pic_hd

Vue CLI

861635853378_ pic_hd

Nuxt2

901635948710_ pic_hd

Functions
$ jest --verbose
 PASS  test/pupa.test.ts (12.347 s)
  替换字符串
    ✓ 替换双花括号 {{xxx}} (2 ms)
    ✓ 跳过替换单花括号 {xxx}
    ✓ 单双花括号同时存在,只替换双花括号

 PASS  test/resolveVersionFilePath.test.ts (12.501 s)
  测试路径拼接
    ✓ `/` 开头 (3 ms)
    ✓ 应保留 `//` 开头 (2 ms)
    ✓ 无任何 `/` 开头
    ✓ http 开头
    ✓ https 开头
    ✓ // 开头

 PASS  test/compareVersion.test.ts (12.656 s)
  测试版本号对比
    ✓ 新版本 大于 旧版本 (4 ms)
    ✓ 新版本 小于 旧版本
    ✓ 两版本相同
  多位数比较
    ✓ 4 位数版本 大于 3 位数版本
    ✓ 3 位数版本 大于 4 位数版本
    ✓ 新版本 大于 旧版本 (1 ms)
    ✓ 两版本相同

Test Suites: 3 passed, 3 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        13.728 s
Ran all test suites.
✨  Done in 16.20s.

Docs

  • 新的安装
  • 新的预览图
  • 新的选项说明
  • 迁移指南

@2nthony 2nthony added the enhancement New feature or request label Nov 7, 2021
@2nthony 2nthony self-assigned this Nov 8, 2021
@2nthony 2nthony marked this pull request as ready for review December 29, 2021 14:38
@2nthony
Copy link
Member Author

2nthony commented Dec 29, 2021

review plz @levy9527 , CC @gd4Ark

你需要通过环境变量 `UPDATE_POPUP_VERSION` 来传入版本号,后续每次迭代更新只需要修改比当前大的版本号即可。
```ts
// src/main.js
import '@update-popup'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有点不太明白,为什么一些地方可以直接 @update-popup,有些地方又需要添加 scope @femessage/update-popup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xxx.config.js 中视为包名,在 client 中 @update-popup 视为虚拟文件,https://cn.vitejs.dev/guide/api-plugin.html#importing-a-virtual-file

it doesn't on designed
@gd4Ark
Copy link
Contributor

gd4Ark commented Dec 31, 2021

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants