Skip to content

Commit 4449dae

Browse files
committed
Move to new dev practices
1 parent 6a5891a commit 4449dae

File tree

11 files changed

+1594
-6042
lines changed

11 files changed

+1594
-6042
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
permissions:
7+
contents: write
8+
jobs:
9+
release:
10+
name: Release On Tag
11+
if: startsWith(github.ref, 'refs/tags/')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
- name: Extract the changelog
17+
id: changelog
18+
run: |
19+
TAG_NAME=${GITHUB_REF/refs\/tags\//}
20+
READ_SECTION=false
21+
CHANGELOG=""
22+
while IFS= read -r line; do
23+
if [[ "$line" =~ ^#+\ +(.*) ]]; then
24+
if [[ "${BASH_REMATCH[1]}" == "$TAG_NAME" ]]; then
25+
READ_SECTION=true
26+
elif [[ "$READ_SECTION" == true ]]; then
27+
break
28+
fi
29+
elif [[ "$READ_SECTION" == true ]]; then
30+
CHANGELOG+="$line"$'\n'
31+
fi
32+
done < "CHANGELOG.md"
33+
CHANGELOG=$(echo "$CHANGELOG" | awk '/./ {$1=$1;print}')
34+
echo "changelog_content<<EOF" >> $GITHUB_OUTPUT
35+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
36+
echo "EOF" >> $GITHUB_OUTPUT
37+
- name: Create the release
38+
if: steps.changelog.outputs.changelog_content != ''
39+
uses: softprops/action-gh-release@v2
40+
with:
41+
name: ${{ github.ref_name }}
42+
body: '${{ steps.changelog.outputs.changelog_content }}'
43+
draft: false
44+
prerelease: false

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
permissions:
8+
contents: read
9+
jobs:
10+
full:
11+
name: Node.js Latest Full
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 23
24+
cache: pnpm
25+
- name: Install dependencies
26+
run: pnpm install --ignore-scripts
27+
- name: Run tests
28+
run: pnpm test
29+
short:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
node-version:
34+
- 22
35+
- 20
36+
name: Node.js ${{ matrix.node-version }} Quick
37+
steps:
38+
- name: Checkout the repository
39+
uses: actions/checkout@v4
40+
- name: Install pnpm
41+
uses: pnpm/action-setup@v4
42+
with:
43+
version: 10
44+
- name: Install Node.js ${{ matrix.node-version }}
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: ${{ matrix.node-version }}
48+
cache: pnpm
49+
- name: Install dependencies
50+
run: pnpm install --ignore-scripts
51+
- name: Run unit tests
52+
run: pnpm unit

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules/
2-
yarn-error.log
32

43
coverage/

.npmignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
yarn-error.log
2-
yarn.lock
3-
41
*.test.js
52
coverage/
6-
.github/

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import loguxConfig from '@logux/eslint-config'
2+
3+
export default [...loguxConfig]

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ function process (decl, { AtRule, Rule }) {
1818
clonedRule.append({
1919
important: decl.important,
2020
prop: decl.prop,
21-
value: '-webkit-fill-available',
22-
source: decl.source
21+
source: decl.source,
22+
value: '-webkit-fill-available'
2323
})
2424
}
2525

2626
module.exports = () => {
2727
return {
28-
postcssPlugin: 'postcss-100vh-fix',
2928
Declaration: {
30-
'min-height': process,
29+
'height': process,
3130
'max-height': process,
32-
'height': process
33-
}
31+
'min-height': process
32+
},
33+
postcssPlugin: 'postcss-100vh-fix'
3434
}
3535
}
3636
module.exports.postcss = true

index.test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
let { equal } = require('node:assert')
2+
let { test } = require('node:test')
13
let postcss = require('postcss')
24

35
let plugin = require('./')
46

57
function run (input, output) {
68
let result = postcss([plugin]).process(input, { from: undefined })
7-
expect(result.css).toEqual(output)
8-
expect(result.warnings()).toHaveLength(0)
9+
equal(result.css, output)
10+
equal(result.warnings(), 0)
911
}
1012

11-
it('adds -webkit-fill-available', () => {
13+
test('adds -webkit-fill-available', () => {
1214
run(
1315
'@media (max-width: 600px) { body { height: 100vh } }',
1416
'@media (max-width: 600px) { body { height: 100vh } ' +
@@ -17,7 +19,7 @@ it('adds -webkit-fill-available', () => {
1719
)
1820
})
1921

20-
it('supports min-height', () => {
22+
test('supports min-height', () => {
2123
run(
2224
'.min { min-height: 100vh }',
2325
'.min { min-height: 100vh }\n' +
@@ -26,7 +28,7 @@ it('supports min-height', () => {
2628
)
2729
})
2830

29-
it('supports max-height', () => {
31+
test('supports max-height', () => {
3032
run(
3133
'.max { max-height: 100vh }',
3234
'.max { max-height: 100vh }\n' +
@@ -35,7 +37,7 @@ it('supports max-height', () => {
3537
)
3638
})
3739

38-
it('inherits !important flag', () => {
40+
test('inherits !important flag', () => {
3941
run(
4042
'.max { max-height: 100vh !important }',
4143
'.max { max-height: 100vh !important }\n' +
@@ -44,6 +46,6 @@ it('inherits !important flag', () => {
4446
)
4547
})
4648

47-
it('ignores non-100vh height', () => {
49+
test('ignores non-100vh height', () => {
4850
run('body { max-height: 100% }', 'body { max-height: 100% }')
4951
})

package.json

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
"-webkit-fill-available"
1414
],
1515
"scripts": {
16-
"test": "jest-ci --coverage && eslint-ci ."
16+
"test:unit": "node --test index.test.js",
17+
"test:lint": "eslint .",
18+
"test": "pnpm run /^test:/"
1719
},
1820
"author": "Andrey Sitnik <[email protected]>",
1921
"license": "MIT",
2022
"repository": "postcss/postcss-100vh-fix",
2123
"engines": {
22-
"node": ">=10.0"
24+
"node": ">=20.0"
2325
},
2426
"funding": {
2527
"type": "opencollective",
@@ -29,48 +31,9 @@
2931
"postcss": "^8.1.0"
3032
},
3133
"devDependencies": {
32-
"@logux/eslint-config": "^40.0.5",
33-
"clean-publish": "^1.1.8",
34-
"eslint": "^7.10.0",
35-
"eslint-ci": "^1.0.0",
36-
"eslint-config-standard": "^14.1.1",
37-
"eslint-plugin-import": "^2.22.0",
38-
"eslint-plugin-jest": "^24.0.2",
39-
"eslint-plugin-node": "^11.1.0",
40-
"eslint-plugin-prefer-let": "^1.1.0",
41-
"eslint-plugin-prettierx": "^0.14.0",
42-
"eslint-plugin-promise": "^4.2.1",
43-
"eslint-plugin-security": "^1.4.0",
44-
"eslint-plugin-standard": "^4.0.1",
45-
"eslint-plugin-unicorn": "^22.0.0",
46-
"husky": "^4.3.0",
47-
"jest": "^26.4.2",
48-
"jest-ci": "^0.1.1",
49-
"lint-staged": "^10.4.0",
50-
"postcss": "^8.1.0",
51-
"postcss-sharec-config": "^0.1.8"
52-
},
53-
"husky": {
54-
"hooks": {
55-
"pre-commit": "lint-staged"
56-
}
57-
},
58-
"lint-staged": {
59-
"*.js": "eslint --fix"
60-
},
61-
"eslintConfig": {
62-
"extends": "@logux/eslint-config"
63-
},
64-
"jest": {
65-
"testEnvironment": "node",
66-
"coverageThreshold": {
67-
"global": {
68-
"statements": 100
69-
}
70-
}
71-
},
72-
"sharec": {
73-
"config": "postcss-sharec-config",
74-
"version": "0.1.8"
34+
"@logux/eslint-config": "^55.0.1",
35+
"clean-publish": "^5.1.0",
36+
"eslint": "^9.22.0",
37+
"postcss": "^8.1.0"
7538
}
7639
}

0 commit comments

Comments
 (0)