Skip to content

Commit 9efff0d

Browse files
committed
feat: 新增 tailwind block class & 改用 pnpm
1 parent f9ca7a0 commit 9efff0d

File tree

5 files changed

+55
-27
lines changed

5 files changed

+55
-27
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ https://github.com/j7-dev/wp-react-plugin/assets/9213776/efb5b3ae-b8d0-408c-8e66
2626
cd to `wp-content/plugins/` in your WordPress project
2727
and `npx create-wp-react-plugin <your-plugin-name>`, that's all the steps
2828
29-
🚩 we use yarn by default for now
29+
🚩 we use pnpm by default for now
3030
3131
2. CRUD utility function<br>
3232
Default with `getPost` Example, check [functions](https://github.com/j7-dev/wp-react-plugin/tree/master/js/src/api/resources) and [custom hooks](https://github.com/j7-dev/wp-react-plugin/tree/master/js/src/hooks)
@@ -45,7 +45,7 @@ https://github.com/j7-dev/wp-react-plugin/assets/9213776/efb5b3ae-b8d0-408c-8e66
4545
By defining the `$required_plugins`, we can easily manage plugin dependencies.
4646
4747
7. 1-click release
48-
Simply type `yarn release` and the command will execute a series of command in `release/.release-it.cjs`, like `yarn build`, `composer install` etc..., and finally publish a release on github
48+
Simply type `pnpm release` and the command will execute a series of command in `release/.release-it.cjs`, like `pnpm build`, `composer install` etc..., and finally publish a release on github
4949
see more configuration in [release-it](https://www.npmjs.com/package/release-it)
5050
5151
---
@@ -94,7 +94,7 @@ Libraries we used
9494

9595
```bash
9696
cd wp-content/plugins/<your-plugin-name>
97-
yarn dev
97+
pnpm dev
9898
```
9999

100100
Sure we have HMR when you change the front-end content
@@ -105,7 +105,7 @@ Sure we have HMR when you change the front-end content
105105

106106
```bash
107107
cd wp-content/plugins/<your-plugin-name>
108-
yarn release:build-only
108+
pnpm release:build-only
109109
```
110110

111111
This command will build the release version of your plugin without publish to Github in `release` directory, you can see a `zip` file and a directory with `<your-plugin-name>`
@@ -119,7 +119,7 @@ We can move to next step after checking everything works well.
119119

120120
```bash
121121
cd wp-content/plugins/<your-plugin-name>
122-
yarn release # this will git tag a patch version, you can choose `yarn release:minor` or `yarn release:major`
122+
pnpm release # this will git tag a patch version, you can choose `pnpm release:minor` or `pnpm release:major`
123123
```
124124

125125
This command will build the release version and publish the plugin `zip` file to Github.

bin/create.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function main() {
1010
const commands = [
1111
`git clone https://github.com/j7-dev/wp-react-plugin.git ${projectName}`,
1212
`cd ${projectName}`,
13-
'yarn',
13+
'pnpm',
1414
`node ./replace-string.cjs ${projectName}`,
1515
'composer install --no-interaction',
1616
execRemove('.git'),

package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "4.0.12",
44
"type": "module",
55
"scripts": {
6-
"bootstrap": "yarn && composer install --no-interaction",
6+
"bootstrap": "pnpm && composer install --no-interaction",
77
"dev": "vite",
88
"prebuild": "echo 'todo: remove console'",
99
"build": "vite build && node release/mv-manifest.cjs",
@@ -21,17 +21,18 @@
2121
"sync:version": "wp-update-project-version -s package.json -p plugin.php",
2222
"replace-string": "node ./replace-string.cjs",
2323
"i18n": "wp i18n make-pot . languages/wp_react_plugin.pot",
24-
"i18n:commit": "yarn i18n && git add . && git commit --amend --no-edit"
24+
"i18n:commit": "pnpm i18n && git add . && git commit --amend --no-edit"
2525
},
2626
"dependencies": {
27+
"@release-it/bumper": "^7.0.5",
2728
"@tanstack/react-query": "4.36.1",
28-
"axios": "^1.6.8",
29+
"axios": "^1.13.2",
2930
"react": "^18.2.0",
3031
"react-dom": "^18.2.0"
3132
},
3233
"devDependencies": {
3334
"@ant-design/cssinjs": "^1.19.1",
34-
"@kucrut/vite-for-wp": "^0.8.0",
35+
"@kucrut/vite-for-wp": "^0.12.0",
3536
"@rollup/plugin-alias": "^5.1.0",
3637
"@soderlind/wp-project-version-sync": "^2.0.2",
3738
"@tanstack/react-query-devtools": "^5.28.10",
@@ -43,11 +44,11 @@
4344
"@typescript-eslint/parser": "^7.4.0",
4445
"@vitejs/plugin-react": "^4.2.1",
4546
"@wordpress/eslint-plugin": "^17.11.0",
46-
"adm-zip": "^0.5.12",
47+
"adm-zip": "^0.5.16",
4748
"archiver": "^7.0.1",
48-
"autoprefixer": "^10.4.19",
49+
"autoprefixer": "^10.4.22",
4950
"change-case-all": "^2.1.0",
50-
"env-cmd": "^10.1.0",
51+
"env-cmd": "^11.0.0",
5152
"eslint": "^8.57.0",
5253
"eslint-config-airbnb": "^19.0.4",
5354
"eslint-config-prettier": "^9.1.0",
@@ -57,14 +58,15 @@
5758
"eslint-plugin-prettier": "^5.1.3",
5859
"eslint-plugin-promise": "^6.1.1",
5960
"eslint-plugin-react": "^7.34.1",
60-
"postcss": "^8.4.38",
61-
"postcss-import": "^16.1.0",
62-
"postcss-nesting": "^12.1.0",
63-
"prettier": "^3.2.5",
61+
"postcss": "^8.5.6",
62+
"postcss-import": "^16.1.1",
63+
"postcss-nesting": "^13.0.2",
64+
"prettier": "^3.7.4",
6465
"prettier-eslint": "^16.3.0",
6566
"prettier-eslint-cli": "^8.0.1",
6667
"prettier-plugin-multiline-arrays": "^3.0.4",
67-
"release-it": "^17.1.1",
68+
"release-it": "^19.0.3",
69+
"release-it-pnpm": "^4.6.6",
6870
"replace-in-file": "^7.1.0",
6971
"sass": "^1.72.0",
7072
"tailwindcss": "^3.4.3",
@@ -73,8 +75,7 @@
7375
"vite": "^5.2.7",
7476
"vite-plugin-live-reload": "^3.0.3",
7577
"vite-tsconfig-paths": "^4.3.2",
76-
"yargs": "^17.7.2",
77-
"yarn-upgrade-all": "^0.7.2"
78+
"yargs": "^17.7.2"
7879
},
7980
"bin": "./bin/create.cjs"
8081
}

release/.release-it.cjs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,37 @@ const release = !args.includes('--build-only') // Build release only or build re
1919

2020
module.exports = {
2121
releasedPluginName,
22+
"plugins": {
23+
"release-it-pnpm": {
24+
"disableRelease": !release,
25+
publishCommand: 'exit 0', // 發佈到 npm 上的命令
26+
},
27+
"@release-it/bumper": {
28+
"in": "package.json",
29+
"out": "package.json",
30+
},
31+
},
2232
git: {
2333
commit: release,
2434
commitMessage: 'chore: release v${version}',
2535
tag: release,
2636
tagName: 'v${version}',
2737
commitArgs: ['-n'],
2838
push: release,
39+
requireCleanWorkingDir: release,
2940
},
3041
hooks: {
31-
// 'before:init': [], // run before initialization
42+
'before:init': [
43+
'pnpm build && echo ✅ build success',
44+
], // run before initialization
3245
// 'after:[my-plugin]:bump': './bin/my-script.sh', // run after bumping version of my-plugin
3346
'after:bump': [
34-
'yarn build && echo ✅ build success',
3547
release
36-
? 'yarn sync:version && echo ✅ sync version success'
48+
? 'pnpm sync:version && echo ✅ sync version success'
3749
: 'echo 🚫 skip sync version',
38-
'yarn create:release && echo ✅ create release files success',
50+
'pnpm create:release && echo ✅ create release files success',
3951
`cd release/${releasedPluginName}/${releasedPluginName} && composer install --no-dev && cd ../.. && echo ✅ composer install success`,
40-
'yarn zip && echo ✅ create zip success',
52+
'pnpm zip && echo ✅ create zip success',
4153
], // run after bumping version
4254
// 'after:git:release': 'echo After git push, before github release', // run after git push, before github release
4355
'after:release': [

tailwind.config.cjs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
plugins: [
3535
function ({ addUtilities }) {
3636
const newUtilities = {
37-
'.rtl': {
37+
'.right-to-left': {
3838
direction: 'rtl',
3939
},
4040

@@ -53,11 +53,26 @@ module.exports = {
5353
},
5454
'.tw-inline': {
5555
display: 'inline'
56+
},
57+
'.tw-blur': {
58+
'--tw-blur': 'blur(8px)',
59+
filter: "var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)",
5660
}
5761
}
5862
addUtilities(newUtilities, ['responsive', 'hover'])
5963
},
6064
],
6165
safelist: [],
62-
blocklist: ['fixed', 'columns-1', 'columns-2', 'hidden', 'inline'],
66+
blocklist: [
67+
'hidden',
68+
'columns-1',
69+
'columns-2',
70+
'fixed',
71+
'block',
72+
'inline',
73+
'blur',
74+
'size-full',
75+
'container',
76+
'rtl',
77+
],
6378
}

0 commit comments

Comments
 (0)