Skip to content

Commit 28865ad

Browse files
authored
fix #465 (#471)
1 parent 2396e74 commit 28865ad

File tree

45 files changed

+140
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+140
-86
lines changed

.github/bin/format-package-json.mjs

+27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
import { promises as fsp, constants } from 'fs';
22
import path from 'path';
33

4+
async function postcssPeerDependencyVersion() {
5+
// "postcss-tape" is our reference for PostCSS versions.
6+
// This package is our test suite.
7+
// If CI passes it means the plugin is compatible with the lower version in "postcss-tape".
8+
const packageJSONInfoForPostCSS_Tape = JSON.parse(await fsp.readFile('../../packages/postcss-tape/package.json', 'utf8'));
9+
10+
// "postcss-tape" package.json:
11+
//
12+
// "dependencies": {
13+
// "postcss": "~8.4",
14+
// "postcss-8.2": "npm:postcss@~8.2"
15+
// }
16+
//
17+
const lowerPostCSS_VersionKey = Object.keys(packageJSONInfoForPostCSS_Tape.dependencies).find((x) => {
18+
return x.startsWith('postcss-') && packageJSONInfoForPostCSS_Tape.dependencies[x].includes('npm:postcss@~');
19+
});
20+
21+
const lowerPostCSS_Version = packageJSONInfoForPostCSS_Tape.dependencies[lowerPostCSS_VersionKey];
22+
23+
// "npm:postcss@~8.2" -> "8.2"
24+
return lowerPostCSS_Version.split('~')[1];
25+
}
26+
427
const packageJSONInfo = JSON.parse(await fsp.readFile('./package.json', 'utf8'));
528
const packageJSONInfoCopy = JSON.stringify(packageJSONInfo, null, '\t');
629
const formatted = {};
@@ -98,6 +121,10 @@ const formatted = {};
98121
formatted.peerDependencies[dependencyKeys[i]] = packageJSONInfo.peerDependencies[dependencyKeys[i]];
99122
}
100123
delete packageJSONInfo.peerDependencies;
124+
125+
if (formatted.peerDependencies['postcss']) {
126+
formatted.peerDependencies['postcss'] = '^' + (await postcssPeerDependencyVersion());
127+
}
101128
}
102129

103130
if (Object.keys(packageJSONInfo.devDependencies ?? {}).length) {

UPDATING_POSTCSS.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,40 @@
22

33
see : `packages/postcss-tape/package.json`
44

5-
Set the `postcss` version to match the peer dependency of all plugins.<br>
6-
Set the `postcss-oldest-supported` depending on community needs. This can be the same as the `postcss` version.
5+
```js
6+
"dependencies": {
7+
// most recent version
8+
"postcss": "~8.4",
9+
// oldest supported
10+
"postcss-8.2": "npm:postcss@~8.2"
11+
},
12+
```
713

14+
## updating
15+
16+
- only update `postcss-tape`
17+
- run `npm run lint` from the root
18+
19+
This will update the peer dependency version for PostCSS in all packages and plugins.
20+
21+
## most recent version
22+
23+
- kept up to date
24+
- only used in CI to catch regressions
25+
26+
## oldest supported
27+
28+
- used as the peer dependency version in all plugins and packages
29+
- updated based on community needs
30+
- can be the same as the **most recent version** version
31+
32+
## semver flags
833

934
- Plugins use `^MAJOR.MINOR`.
1035
- PostCSS Tape uses `~MAJOR.MINOR`.
1136

37+
## notes
38+
1239
Avoid increasing these versions when possible.
1340

1441
Major version updates are also always a breaking change.

experimental/css-has-pseudo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"postcss-selector-parser": "^6.0.10"
4141
},
4242
"peerDependencies": {
43-
"postcss": "^8.3"
43+
"postcss": "^8.2"
4444
},
4545
"devDependencies": {
4646
"@mrhenry/core-web": "^0.7.2",

0 commit comments

Comments
 (0)