Skip to content

Commit a5a2fed

Browse files
authored
Migrate postcss-lab-function (#13)
* postcss-lab-function * manually backport changes * cleanup * cleanup * cleanup * cleanup * add color unit tests * cleanup * Update plugins/postcss-lab-function/test/color/test.mjs
1 parent 270ddaa commit a5a2fed

34 files changed

+917
-413
lines changed

plugins/postcss-lab-function/.editorconfig

-15
This file was deleted.

plugins/postcss-lab-function/.gitattributes

-1
This file was deleted.

plugins/postcss-lab-function/.github/workflows/test.yml

-18
This file was deleted.
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
dist
21
node_modules
2+
dist
33
package-lock.json
44
yarn.lock
55
*.log*
66
*.result.css
7-
.*
7+
*.result.css.map
88
!.editorconfig
9-
!.gitattributes
109
!.gitignore
1110
!.rollup.js
1211
!.tape.js
12+
!.travis.yml
1313
!.github

plugins/postcss-lab-function/.rollup.js

-26
This file was deleted.

plugins/postcss-lab-function/.tape.js

+9
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,14 @@ module.exports = {
99
options: {
1010
preserve: true
1111
}
12+
},
13+
'variables': {
14+
message: 'supports variables',
15+
},
16+
'variables:preserve-true': {
17+
message: 'supports variables with { preserve: true } usage',
18+
options: {
19+
preserve: true
20+
}
1221
}
1322
}

plugins/postcss-lab-function/CONTRIBUTING.md

-65
This file was deleted.

plugins/postcss-lab-function/INSTALL.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,6 @@ grunt.initConfig({
159159
[PostCSS]: https://github.com/postcss/postcss
160160
[PostCSS CLI]: https://github.com/postcss/postcss-cli
161161
[PostCSS Loader]: https://github.com/postcss/postcss-loader
162-
[PostCSS Lab Function]: https://github.com/csstools/postcss-lab-function
162+
[PostCSS Lab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-function
163163
[React App Rewire PostCSS]: https://github.com/csstools/react-app-rewire-postcss
164164
[React App Rewired]: https://github.com/timarney/react-app-rewired

plugins/postcss-lab-function/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-lab-function.svg" height="20">][npm-url]
44
[<img alt="CSS Standard Status" src="https://cssdb.org/badge/lab-function.svg" height="20">][css-url]
5-
[<img alt="Build Status" src="https://github.com/csstools/postcss-lab-function/workflows/test/badge.svg" height="20">][cli-url]
5+
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
66
[<img alt="support chat" src="https://img.shields.io/badge/support-chat-blue.svg" height="20">][git-url]
77

88

@@ -75,7 +75,7 @@ postcssLabFunction({ preserve: true })
7575
}
7676
```
7777

78-
[cli-url]: https://github.com/csstools/postcss-lab-function/actions/workflows/test.yml?query=workflow/test
78+
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
7979
[css-url]: https://cssdb.org/#lab-function
8080
[git-url]: https://gitter.im/postcss/postcss
8181
[npm-url]: https://www.npmjs.com/package/postcss-lab-function
@@ -85,4 +85,4 @@ postcssLabFunction({ preserve: true })
8585
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
8686
[PostCSS]: https://github.com/postcss/postcss
8787
[PostCSS Loader]: https://github.com/postcss/postcss-loader
88-
[PostCSS Lab Function]: https://github.com/csstools/postcss-lab-function
88+
[PostCSS Lab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-function

plugins/postcss-lab-function/package.json

+31-46
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,42 @@
44
"description": "Use lab() and lch() color functions in CSS",
55
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
66
"license": "CC0-1.0",
7-
"repository": "csstools/postcss-lab-function",
8-
"homepage": "https://github.com/csstools/postcss-lab-function#readme",
9-
"bugs": "https://github.com/csstools/postcss-lab-function/issues",
10-
"main": "dist/index.cjs.js",
11-
"module": "dist/index.esm.mjs",
7+
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-function#readme",
8+
"bugs": "https://github.com/csstools/postcss-plugins/issues",
9+
"main": "dist/index.cjs",
10+
"module": "dist/index.mjs",
11+
"types": "./dist/index.d.ts",
1212
"files": [
13+
"CHANGELOG.md",
14+
"INSTALL.md",
15+
"LICENSE.md",
16+
"README.md",
1317
"dist"
1418
],
19+
"bin": {
20+
"postcss-lab-function": "dist/cli.mjs"
21+
},
1522
"scripts": {
16-
"build": "npx rollup -c .rollup.js",
17-
"build:watch": "npx rollup -c .rollup.js --watch",
18-
"lint": "npx eslint --cache src",
19-
"lint:fix": "npx eslint --cache --fix",
20-
"pretest": "npm install && npm run build",
21-
"test": "npm run lint && npm run tape",
22-
"tape": "npx postcss-tape",
23-
"prepublishOnly": "npm test"
23+
"prepublishOnly": "npm run build --if-present && npm run test --if-present",
24+
"lint": "eslint src/**/*.ts",
25+
"test": "node ./test/color/test.mjs && postcss-tape",
26+
"build": "rollup -c ../../rollup/default.ts.js",
27+
"stryker": "stryker run --logLevel error",
28+
"generate-color-corpus": "python3 ./test/color/generate.py"
2429
},
2530
"engines": {
26-
"node": ">=12"
31+
"node": "^12 || ^14 || >=16"
2732
},
2833
"dependencies": {
29-
"@csstools/convert-colors": "2.0.0",
30-
"postcss-values-parser": "6.0.1"
31-
},
32-
"peerDependencies": {
33-
"postcss": "^8.3"
34+
"postcss-values-parser": "^6.0.1"
3435
},
3536
"devDependencies": {
36-
"@babel/core": "^7.16.0",
37-
"@babel/preset-env": "^7.16.4",
38-
"@rollup/plugin-babel": "^5.3.0",
39-
"eslint": "^8.2.0",
40-
"postcss": "^8.3.11",
41-
"postcss-tape": "^6.0.1",
42-
"rollup": "^2.60.0"
37+
"@csstools/base-cli": "^0.1.0",
38+
"postcss": "^8.3.6",
39+
"postcss-tape": "^6.0.1"
4340
},
44-
"babel": {
45-
"presets": [
46-
[
47-
"@babel/env",
48-
{
49-
"targets": "maintained node versions"
50-
}
51-
]
52-
]
53-
},
54-
"eslintConfig": {
55-
"env": {
56-
"es6": true,
57-
"node": true
58-
},
59-
"extends": "eslint:recommended",
60-
"parserOptions": {
61-
"sourceType": "module"
62-
}
41+
"peerDependencies": {
42+
"postcss": "^8.3"
6343
},
6444
"keywords": [
6545
"postcss",
@@ -78,5 +58,10 @@
7858
"syntax",
7959
"space",
8060
"comma"
81-
]
61+
],
62+
"repository": {
63+
"type": "git",
64+
"url": "https://github.com/csstools/postcss-plugins.git",
65+
"directory": "plugins/postcss-lab-function"
66+
}
8267
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import plugin from './index';
2+
import { cli, helpTextLogger } from '@csstools/base-cli';
3+
4+
cli(
5+
plugin,
6+
['preserve'],
7+
helpTextLogger(
8+
'postcss-lab-function-cli',
9+
'PostCSS Lab function',
10+
'Convert lab() to rgb()',
11+
{
12+
preserve: true,
13+
},
14+
),
15+
);

0 commit comments

Comments
 (0)