Skip to content

Commit 82eca2e

Browse files
authored
housekeeping after migration (#431)
* houskeeping after migration * fix * add check for file permissions * fix * fix * fix
1 parent 5e687c8 commit 82eca2e

File tree

64 files changed

+1084
-291
lines changed

Some content is hidden

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

64 files changed

+1084
-291
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
if [ "$(uname)" == "Darwin" ]; then
5+
# Darwin cmd
6+
find . -type f -perm +0111 | node .github/bin/detect-executable-files/to-github-annotations.js
7+
else
8+
# Linux cmd
9+
find . -type f -perm /u=x,g=x,o=x | node .github/bin/detect-executable-files/to-github-annotations.js
10+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
const fs = require('fs');
2+
const data = fs.readFileSync(0, 'utf-8');
3+
let fileNames = data.split(/\r?\n/);
4+
5+
const allowList = [];
6+
7+
fileNames = fileNames.filter((f) => {
8+
if (0 === f.length) {
9+
return false; // trailing newline
10+
}
11+
12+
if (f.includes('node_modules')) {
13+
return false; // node_modules folders are not distributed
14+
}
15+
16+
if (f.startsWith('./.git/')) {
17+
return false; // git stuffs
18+
}
19+
20+
if (f.startsWith('./.github/')) {
21+
return false; // these are not distributed
22+
}
23+
24+
if (f.endsWith('dist/cli.cjs')) {
25+
return false; // this is expected to be executable
26+
}
27+
28+
return !allowList.includes(f);
29+
});
30+
31+
if (!fileNames || !fileNames.length) {
32+
process.exit(0);
33+
}
34+
35+
if (!process.env.GITHUB_ACTIONS) {
36+
console.log(`Unexpected executables:`);
37+
fileNames.forEach((f) => {
38+
console.log(`chmod a-x ${f}`);
39+
});
40+
process.exit(1);
41+
}
42+
43+
fileNames.forEach((f) => {
44+
const annotation = formatGitHubActionAnnotation(
45+
`This file is unexpectedly executable`,
46+
'error',
47+
{
48+
file: f,
49+
line: 1,
50+
col: 1,
51+
}
52+
);
53+
54+
console.log(annotation);
55+
});
56+
57+
process.exit(1);
58+
59+
function formatGitHubActionAnnotation(message, level = 'error', options = {}) {
60+
let output = '::' + level;
61+
62+
const outputOptions = Object.keys(options)
63+
.map((key) => {
64+
return `${key}=${escape(String(options[key]))}`;
65+
})
66+
.join(',');
67+
68+
if (outputOptions) {
69+
output += ` ${outputOptions}`;
70+
}
71+
72+
return `${output}::${escapeData(message || '')}`;
73+
}
74+
75+
function escapeData(s) {
76+
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
77+
}
78+
79+
function escape(s) {
80+
return s
81+
.replace(/\r/g, '%0D')
82+
.replace(/\n/g, '%0A')
83+
.replace(/]/g, '%5D')
84+
.replace(/;/g, '%3B');
85+
}

.github/workflows/test-in-browser.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
node-version: 16
2020

2121
- run: npm ci
22-
- run: npm run build --workspaces --if-present
23-
- run: npm run --silent test:browser --workspaces --if-present
22+
- run: npm run build --if-present
23+
- run: npm run test:browser --if-present
2424

.github/workflows/test.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ jobs:
3939
# - with exact dependencies from package-lock.json
4040
# - without requiring postinstall scripts from dependencies to run
4141
- run: npm ci --ignore-scripts
42-
- run: npm run build --workspaces --if-present
43-
- run: npm run lint --workspaces --if-present
42+
- run: npm run build
43+
- run: npm run lint
4444
if: matrix.is_base_node_version && matrix.is_base_os_version
4545

4646
# PostCSS Tape tests
47-
- run: npm run test --workspaces --if-present
47+
- run: npm run test
4848
env:
4949
ENABLE_ANNOTATIONS_FOR_NODE: ${{ matrix.is_base_node_version }}
5050
ENABLE_ANNOTATIONS_FOR_OS: ${{ matrix.is_base_os_version }}
5151

5252
# CLI Tests
5353
# running "npm install" places the cli in node_modules/bin
5454
- run: npm install --ignore-scripts
55-
- run: npm run --silent test:cli --workspace="@csstools/postcss-base-plugin"
55+
- run: npm run test:cli --workspace="@csstools/postcss-base-plugin"
5656

5757
# Run e2e tests
5858
test_e2e:
@@ -64,17 +64,17 @@ jobs:
6464
node-version: 16
6565

6666
- run: npm ci --ignore-scripts
67-
- run: npm run build --workspaces --if-present
67+
- run: npm run build
6868

6969
# Webpack compatibility
7070
- run: |
7171
cd e2e/webpack/bundle-through
7272
npm install
7373
npm run build
74-
npm run --silent test
74+
npm run test
7575
7676
# Deno compatibility
7777
- uses: denoland/setup-deno@v1
7878
with:
7979
deno-version: v1.x.x
80-
- run: npm run --silent test:deno --workspaces --if-present
80+
- run: npm run test:deno --workspaces --if-present

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
"clean": "bash ./.github/bin/clean.sh",
3636
"get-me-going": "npm run clean && npm ci && npm run build && npm run test",
3737
"docs": "npm run docs --workspaces --if-present",
38-
"lint": "npm run lint --workspaces --if-present && npm run lint:rollup-config",
38+
"lint": "npm run lint --workspaces --if-present && npm run lint:rollup-config && npm run lint:executable-files",
39+
"lint:executable-files": "bash .github/bin/detect-executable-files/detect-executable-files.sh",
3940
"lint:rollup-config": "eslint ./rollup --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
4041
"new-plugin": "node ./.github/bin/new-plugin.mjs",
4142
"prepare-repo-for-releases": "npm run clean && npm ci && npm run docs && npm run lint && npm run build && npm run test && bash ./.github/bin/fail-on-changes.sh",
42-
"test": "npm run test --workspaces --if-present"
43+
"test": "npm run test --workspaces --if-present",
44+
"test:browser": "npm run test:browser --workspaces --if-present"
4345
},
4446
"volta": {
4547
"node": "16.13.1",

packages/generate-test-cases/src/index.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ import { generate } from './generate.mjs';
7878
],
7979
),
8080

81+
generate(
82+
'value',
83+
path.join('../../plugins', 'postcss-color-rebeccapurple'),
84+
[
85+
'rebeccapurple',
86+
],
87+
),
88+
8189
generate(
8290
'declaration',
8391
path.join('../../plugins', 'postcss-place'),

packages/generate-test-cases/src/value.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ export function generateValueTestCases(value) {
55
values.push(`var(1, ${value})`);
66
values.push(`var(${value}, 1)`);
77
values.push(`var(${value}, ${value})`);
8+
values.push(`pre${value}`);
9+
values.push(`pre ${value}`);
10+
values.push(`pre,${value}`);
11+
values.push(`${value}post`);
12+
values.push(`${value} post`);
13+
values.push(`${value},post`);
814

915
let result = values.map((x, index) => {
1016
return `.order-${index} {

plugins/postcss-base-plugin/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"dist"
4343
],
4444
"peerDependencies": {
45-
"postcss": "^8.3"
45+
"postcss": "^8.4"
4646
},
4747
"scripts": {
4848
"build": "rollup -c ../../rollup/default.js",

plugins/postcss-color-functional-notation/test/generated-value-cases.css

+48
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@
1414
order: var(rgba(178 34 34 / 1), rgba(178 34 34 / 1));
1515
}
1616

17+
.order-4 {
18+
order: prergba(178 34 34 / 1);
19+
}
20+
21+
.order-5 {
22+
order: pre rgba(178 34 34 / 1);
23+
}
24+
25+
.order-6 {
26+
order: pre,rgba(178 34 34 / 1);
27+
}
28+
29+
.order-7 {
30+
order: rgba(178 34 34 / 1)post;
31+
}
32+
33+
.order-8 {
34+
order: rgba(178 34 34 / 1) post;
35+
}
36+
37+
.order-9 {
38+
order: rgba(178 34 34 / 1),post;
39+
}
40+
1741
/* rgba(178 34 34 / 1) */
1842

1943
:root {
@@ -46,6 +70,30 @@
4670
order: var(hsl(120 100% 50% / 1), hsl(120 100% 50% / 1));
4771
}
4872

73+
.order-4 {
74+
order: prehsl(120 100% 50% / 1);
75+
}
76+
77+
.order-5 {
78+
order: pre hsl(120 100% 50% / 1);
79+
}
80+
81+
.order-6 {
82+
order: pre,hsl(120 100% 50% / 1);
83+
}
84+
85+
.order-7 {
86+
order: hsl(120 100% 50% / 1)post;
87+
}
88+
89+
.order-8 {
90+
order: hsl(120 100% 50% / 1) post;
91+
}
92+
93+
.order-9 {
94+
order: hsl(120 100% 50% / 1),post;
95+
}
96+
4997
/* hsl(120 100% 50% / 1) */
5098

5199
:root {

plugins/postcss-color-functional-notation/test/generated-value-cases.expect.css

+48
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@
1414
order: var(rgba(178, 34, 34, 1), rgba(178, 34, 34, 1));
1515
}
1616

17+
.order-4 {
18+
order: prergba(178 34 34 / 1);
19+
}
20+
21+
.order-5 {
22+
order: pre rgba(178, 34, 34, 1);
23+
}
24+
25+
.order-6 {
26+
order: pre,rgba(178, 34, 34, 1);
27+
}
28+
29+
.order-7 {
30+
order: rgba(178, 34, 34, 1)post;
31+
}
32+
33+
.order-8 {
34+
order: rgba(178, 34, 34, 1) post;
35+
}
36+
37+
.order-9 {
38+
order: rgba(178, 34, 34, 1),post;
39+
}
40+
1741
/* rgba(178 34 34 / 1) */
1842

1943
:root {
@@ -46,6 +70,30 @@
4670
order: var(hsla(120, 100%, 50%, 1), hsla(120, 100%, 50%, 1));
4771
}
4872

73+
.order-4 {
74+
order: prehsl(120 100% 50% / 1);
75+
}
76+
77+
.order-5 {
78+
order: pre hsla(120, 100%, 50%, 1);
79+
}
80+
81+
.order-6 {
82+
order: pre,hsla(120, 100%, 50%, 1);
83+
}
84+
85+
.order-7 {
86+
order: hsla(120, 100%, 50%, 1)post;
87+
}
88+
89+
.order-8 {
90+
order: hsla(120, 100%, 50%, 1) post;
91+
}
92+
93+
.order-9 {
94+
order: hsla(120, 100%, 50%, 1),post;
95+
}
96+
4997
/* hsl(120 100% 50% / 1) */
5098

5199
:root {

0 commit comments

Comments
 (0)