Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-release: 2.3.0 #174

Merged
merged 18 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- run: npx changelogithub
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Install Dependencies
run: pnpm i

- name: PNPM build
run: pnpm run build

- name: Publish to NPM
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## Unreleased

## 2.3.0 (2023-05-16)

### Features

- 添加 `mangle` 配置项,可以对 `tailwindcss` 生成的类名进行缩短以及混淆
- 添加 `esm` 支持

### Chores

- 使用 `exports` 导出项目,去除根目录下的 `.d.ts`
- 升级 `pnpm` from v7 to v8
- 去除所有 `webpack4` 相关的依赖
- 使用 `jest` 测试 `cjs` , `vitest` 测试 `vite` 相关 `case`
- 采用 `Github Action` 进行正式发布以及自动生成 `github changelog`

## 2.2.0 (2023-05-07)

### Features
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,11 @@ const classArray = [
类型: `boolean`
描述: 是否压缩生成的js文件内容,默认使用环境变量判断: `process.env.NODE_ENV === 'production'`

### mangle (2.3.0+)

类型: `boolean` \| `IMangleOptions`
描述: 是否压缩混淆 `wxml`,`js` 和 `wxss` 中指定范围的 `class` 以避免选择器过长问题,默认为`false`不开启,详细配置见 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle)

### cssPreflight

类型: `Record<string,string>`\| `false`
Expand Down
10 changes: 9 additions & 1 deletion demo/gulp-app/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import gutil from 'gulp-util'
import debug from 'gulp-debug'
import ts from 'gulp-typescript'
import plumber from 'gulp-plumber'
import internal from 'stream'

const isDebug = Boolean(process.env.DEBUG)
const isWatch = Boolean(process.env.WATCH)
Expand All @@ -34,9 +35,16 @@ if (isLocal) {

// 在 gulp 里使用,先使用 postcss 转化 css,触发 tailwindcss ,然后转化 transformWxss, 然后 transformJs, transformWxml
const { transformJs, transformWxml, transformWxss } = createPlugins()
// {
// mangle: true
// }

function promisify(task: NodeJS.ReadWriteStream) {
function promisify(task: internal.Transform) {
return new Promise((resolve, reject) => {
if (task.destroyed) {
resolve(undefined)
return
}
task.on('finish', resolve).on('error', reject)
})
}
Expand Down
Binary file removed demo/gulp-app/src/image/logo.jpg
Binary file not shown.
4 changes: 1 addition & 3 deletions demo/gulp-app/src/pages/index/index.wxml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<!-- index.wxml -->
<view class="h-full text-center">
<view class="m-[20px]">
<view>
<image src="../../image/logo.jpg" mode="widthFix" class="w-full h-auto"></image>
</view>
<view class="bg-[url(https://pic1.zhimg.com/v2-3ee20468f54bbfefcd0027283b21aaa8_720w.jpg)] bg-[length:100%_100%] bg-no-repeat w-screen h-[41.54vw]"></view>
<view class="space-y-4">
<view class="text-[14px]">基于Gulp 的微信小程序前端开发工作流</view>
<view class="text-[14px] text-[#5ba4e5]" bindtap="copyText" data-text="https://github.com/sonofmagic/weapp-tailwindcss-webpack-plugin">
Expand Down
3 changes: 0 additions & 3 deletions gulp.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion gulp.js

This file was deleted.

100 changes: 48 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
{
"name": "weapp-tailwindcss-webpack-plugin",
"version": "2.2.0",
"version": "2.3.0-beta.1",
"description": "把tailwindcss jit引擎,带给小程序开发者们\nbring tailwindcss jit engine to our miniprogram developers!",
"main": "dist/index.js",
"types": "types/index.d.ts",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*"
]
}
},
"exports": {
"./package.json": "./package.json",
".": {
"types": "./types/index.d.ts",
"require": "./dist/index.js"
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./*": "./*",
"./replace": {
"types": "./types/replace.d.ts",
"import": "./dist/replace.js"
"types": "./dist/replace.d.ts",
"require": "./dist/replace.js",
"import": "./dist/replace.mjs"
},
"./postcss": {
"types": "./types/postcss/plugin.d.ts",
"require": "./dist/postcss.js"
"types": "./dist/postcss/plugin.d.ts",
"require": "./dist/postcss.js",
"import": "./dist/postcss.mjs"
},
"./vite": {
"types": "./types/framework/vite/index.d.ts",
"require": "./dist/vite.js"
"types": "./dist/vite/index.d.ts",
"require": "./dist/vite.js",
"import": "./dist/vite.mjs"
},
"./gulp": {
"types": "./types/framework/gulp/index.d.ts",
"require": "./dist/gulp.js"
"types": "./dist/gulp/index.d.ts",
"require": "./dist/gulp.js",
"import": "./dist/gulp.mjs"
}
},
"scripts": {
"dev": "yarn clean && yarn dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
"build": "yarn clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && yarn dts && yarn fix-dts",
"build": "yarn clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && yarn dts",
"build:demo": "yarn demo:del-dist && cross-env NODE_ENV=demo rollup -c rollup.config.ts --configPlugin typescript && yarn demo:sync-dist",
"build:tsc": "cross-env NODE_ENV=development tsc --build tsconfig.json",
"dts": "tsc --emitDeclarationOnly -p tsconfig.dts.json",
"fix-dts": "ts-node scripts/fix-dts.ts",
"test": "jest && vitest run",
"jest-u": "jest -u",
"vitest:test": "vitest",
"vitest:coverage": "vitest run --coverage",
"test:all": "cross-env JEST_INVALID_SKIP_CASES=1 jest",
Expand All @@ -60,6 +74,7 @@
"ls:pack": "npm pack --dry-run",
"cli:patch": "node bin/weapp-tailwindcss.js patch",
"prepare": "ts-patch install -s & tw-patch",
"release": "bumpp",
"-------": "-----------",
"postinstall": "node bin/weapp-tailwindcss.js patch"
},
Expand All @@ -69,12 +84,7 @@
},
"files": [
"bin",
"types",
"dist",
"postcss.*",
"replace.*",
"vite.*",
"gulp.*"
"dist"
],
"bin": {
"weapp-tailwindcss-webpack-plugin": "bin/weapp-tailwindcss.js",
Expand Down Expand Up @@ -124,70 +134,57 @@
"@icebreakers/eslint-config-ts": "^1.0.4",
"@icebreakers/readme": "0.1.0",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.1",
"@rollup/plugin-typescript": "^11.1.0",
"@rollup/plugin-typescript": "^11.1.1",
"@tsconfig/recommended": "^1.0.2",
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.18.5",
"@types/cssesc": "^3.0.0",
"@types/esm": "^3.2.0",
"@types/fs-extra": "^11.0.1",
"@types/gulp": "^4.0.10",
"@types/gulp-postcss": "^8.0.3",
"@types/jest": "^29.5.1",
"@types/loader-utils": "^2.0.3",
"@types/lodash": "^4.14.194",
"@types/lodash-es": "^4.17.7",
"@types/memory-fs": "^0.3.3",
"@types/micromatch": "^4.0.2",
"@types/node": "^18.16.3",
"@types/object-hash": "^3.0.2",
"@types/semver": "^7.3.13",
"@types/node": "^20.1.5",
"@types/semver": "^7.5.0",
"@types/vinyl": "^2.0.7",
"@types/webpack": "^5.28.1",
"@types/webpack-sources": "^3.2.0",
"@types/webpack4": "npm:@types/webpack@4",
"@vitest/coverage-c8": "^0.31.0",
"autoprefixer": "^10.4.14",
"babel-loader": "^8.2.5",
"babel-loader": "^9.1.2",
"bumpp": "^9.1.0",
"chalk": "4.1.2",
"cross-env": "^7.0.3",
"css-loader": "^6.7.3",
"css-loader3": "npm:[email protected]",
"cssesc": "^3.0.0",
"defu": "6.1.2",
"del": "^6.1.1",
"eslint": "8.40.0",
"esm": "^3.2.25",
"execa": "5",
"fast-glob": "^3.2.12",
"fs-extra": "^11.1.1",
"gulp": "^4.0.2",
"gulp-postcss": "^9.0.1",
"html-loader": "^4.2.0",
"html-loader1": "npm:[email protected]",
"jest": "^29.5.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"memfs": "^3.5.1",
"memory-fs": "^0.5.0",
"mini-css-extract-plugin": "^2.7.5",
"mini-css-extract-plugin1": "npm:[email protected]",
"miniprogram-automator": "^0.12.0",
"object-hash": "^3.0.0",
"open-cli": "^7.2.0",
"pkg-types": "^1.0.3",
"postcss-load-config": "^4.0.1",
"postcss-loader": "^7.3.0",
"postcss-loader4": "npm:postcss-loader@^4.3.0",
"postcss-rem-to-responsive-pixel": "^5.1.3",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^3.21.5",
"rollup": "^3.21.8",
"rollup-plugin-visualizer": "^5.9.0",
"simple-functional-loader": "^1.2.1",
"style-loader": "^3.3.2",
"style-loader2": "npm:[email protected]",
"tailwind-children": "^0.5.0",
"tailwindcss": "^3.3.2",
"ts-jest": "^29.1.0",
Expand All @@ -199,23 +196,22 @@
"typescript": "^4.9.5",
"typescript-transform-paths": "^3.4.6",
"vinyl": "^3.0.0",
"vite": "^4.3.5",
"vite": "^4.3.6",
"vitest": "^0.31.0",
"weapp-tailwindcss-children": "^0.1.0",
"webpack": "^5.82.0"
"webpack": "^5.82.1"
},
"dependencies": {
"@babel/generator": "^7.21.4",
"@babel/parser": "^7.21.4",
"@babel/traverse": "^7.21.4",
"@babel/types": "^7.21.4",
"@csstools/postcss-is-pseudo-class": "^3.2.0",
"loader-utils": "^2.0.2",
"micromatch": "^4.0.5",
"postcss": "8.4.23",
"postcss-selector-parser": "^6.0.12",
"semver": "^7.5.0",
"tailwindcss-patch": "^1.1.1",
"webpack-sources": "^3.2.3"
"postcss-selector-parser": "^6.0.13",
"semver": "^7.5.1",
"tailwindcss-mangle-shared": "^1.2.1",
"tailwindcss-patch": "^1.2.1"
}
}
}
Loading