@seyuna/postcss 0.0.1-dev.8 → 1.0.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +19 -134
- package/CHANGELOG.md +6 -0
- package/dist/at-rules/dark.js +4 -2
- package/dist/at-rules/light.js +4 -2
- package/dist/plugin.js +4 -0
- package/package.json +16 -5
- package/release.config.mjs +32 -0
- package/src/at-rules/dark.ts +6 -3
- package/src/at-rules/light.ts +6 -3
- package/src/plugin.ts +9 -1
|
@@ -1,156 +1,41 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
- dev
|
|
9
|
-
workflow_dispatch:
|
|
6
|
+
- main
|
|
7
|
+
- canary
|
|
10
8
|
|
|
11
9
|
permissions:
|
|
12
10
|
contents: write
|
|
11
|
+
issues: write
|
|
12
|
+
pull-requests: write
|
|
13
13
|
id-token: write
|
|
14
14
|
|
|
15
15
|
jobs:
|
|
16
|
-
|
|
17
|
-
name:
|
|
16
|
+
release:
|
|
17
|
+
name: Semantic Release
|
|
18
18
|
runs-on: ubuntu-latest
|
|
19
|
-
outputs:
|
|
20
|
-
version: ${{ steps.version.outputs.version }}
|
|
21
|
-
|
|
22
19
|
steps:
|
|
23
|
-
-
|
|
24
|
-
uses: actions/checkout@v4
|
|
25
|
-
|
|
26
|
-
- name: Read version from package.json
|
|
27
|
-
id: version
|
|
28
|
-
run: |
|
|
29
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
30
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
31
|
-
|
|
32
|
-
- name: Set up Node.js
|
|
33
|
-
uses: actions/setup-node@v4
|
|
34
|
-
with:
|
|
35
|
-
node-version: 20
|
|
36
|
-
registry-url: https://registry.npmjs.org
|
|
37
|
-
|
|
38
|
-
- name: Install dependencies
|
|
39
|
-
run: npm ci
|
|
40
|
-
|
|
41
|
-
- name: Build TypeScript
|
|
42
|
-
run: npm run build
|
|
43
|
-
|
|
44
|
-
- name: List dist contents before upload
|
|
45
|
-
run: ls -l dist
|
|
46
|
-
|
|
47
|
-
- name: Upload build artifact
|
|
48
|
-
uses: actions/upload-artifact@v4
|
|
20
|
+
- uses: actions/checkout@v4
|
|
49
21
|
with:
|
|
50
|
-
|
|
51
|
-
path: dist
|
|
22
|
+
fetch-depth: 0
|
|
52
23
|
|
|
53
|
-
|
|
54
|
-
name: Publish to npm
|
|
55
|
-
runs-on: ubuntu-latest
|
|
56
|
-
needs: build
|
|
57
|
-
|
|
58
|
-
steps:
|
|
59
|
-
- name: Checkout repository
|
|
60
|
-
uses: actions/checkout@v4
|
|
61
|
-
|
|
62
|
-
- name: Set up Node.js
|
|
24
|
+
- name: Setup Node.js with npm auth
|
|
63
25
|
uses: actions/setup-node@v4
|
|
64
26
|
with:
|
|
65
27
|
node-version: 20
|
|
66
|
-
registry-url: https://registry.npmjs.org
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
name: plugin-dist
|
|
72
|
-
path: dist
|
|
73
|
-
|
|
74
|
-
- name: Authenticate with npm
|
|
75
|
-
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
|
76
|
-
|
|
77
|
-
- name: Determine npm tag
|
|
78
|
-
id: tag
|
|
79
|
-
run: |
|
|
80
|
-
BRANCH="${GITHUB_REF##*/}"
|
|
81
|
-
if [ "$BRANCH" = "stable" ]; then
|
|
82
|
-
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
83
|
-
else
|
|
84
|
-
echo "tag=$BRANCH" >> $GITHUB_OUTPUT
|
|
85
|
-
fi
|
|
28
|
+
registry-url: https://registry.npmjs.org/
|
|
29
|
+
scope: "@seyuna"
|
|
30
|
+
always-auth: true
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
86
33
|
|
|
87
34
|
- name: Install dependencies
|
|
88
35
|
run: npm ci
|
|
89
36
|
|
|
90
|
-
- name:
|
|
91
|
-
id: version_check
|
|
92
|
-
run: |
|
|
93
|
-
PKG_NAME=$(node -p "require('./package.json').name")
|
|
94
|
-
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
95
|
-
if npm view "$PKG_NAME@$PKG_VERSION" > /dev/null 2>&1; then
|
|
96
|
-
echo "exists=true" >> $GITHUB_OUTPUT
|
|
97
|
-
else
|
|
98
|
-
echo "exists=false" >> $GITHUB_OUTPUT
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
- name: Publish package
|
|
102
|
-
if: steps.version_check.outputs.exists != 'true'
|
|
103
|
-
run: npm publish --access public --tag ${{ steps.tag.outputs.tag }}
|
|
104
|
-
|
|
105
|
-
release:
|
|
106
|
-
name: Create GitHub Release
|
|
107
|
-
runs-on: ubuntu-latest
|
|
108
|
-
needs: [build, publish]
|
|
109
|
-
|
|
110
|
-
steps:
|
|
111
|
-
- name: Checkout repository
|
|
112
|
-
uses: actions/checkout@v4
|
|
113
|
-
|
|
114
|
-
- name: Download build artifact
|
|
115
|
-
uses: actions/download-artifact@v4
|
|
116
|
-
with:
|
|
117
|
-
name: plugin-dist
|
|
118
|
-
path: dist
|
|
119
|
-
|
|
120
|
-
- name: Generate changelog
|
|
121
|
-
run: |
|
|
122
|
-
last_tag=$(git tag --sort=-creatordate | grep '^v' | grep -v "v${{ needs.build.outputs.version }}" | head -n 1)
|
|
123
|
-
|
|
124
|
-
if [ -z "$last_tag" ]; then
|
|
125
|
-
changelog=$(git log --merges --pretty=format:"* %s (%h)")
|
|
126
|
-
else
|
|
127
|
-
changelog=$(git log "$last_tag"..HEAD --merges --pretty=format:"* %s (%h)")
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
echo "Automated release for version v${{ needs.build.outputs.version }}"
|
|
132
|
-
echo ""
|
|
133
|
-
echo "## Changes"
|
|
134
|
-
echo ""
|
|
135
|
-
echo "$changelog"
|
|
136
|
-
} > RELEASE_NOTES.md
|
|
137
|
-
|
|
138
|
-
- name: Check if GitHub release exists
|
|
139
|
-
id: release_check
|
|
140
|
-
run: |
|
|
141
|
-
if gh release view "v${{ needs.build.outputs.version }}" >/dev/null 2>&1; then
|
|
142
|
-
echo "exists=true" >> $GITHUB_OUTPUT
|
|
143
|
-
else
|
|
144
|
-
echo "exists=false" >> $GITHUB_OUTPUT
|
|
145
|
-
fi
|
|
146
|
-
env:
|
|
147
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
148
|
-
|
|
149
|
-
- name: Create GitHub Release
|
|
150
|
-
if: steps.release_check.outputs.exists != 'true'
|
|
151
|
-
run: |
|
|
152
|
-
gh release create "v${{ needs.build.outputs.version }}" \
|
|
153
|
-
--title "v${{ needs.build.outputs.version }}" \
|
|
154
|
-
--notes-file RELEASE_NOTES.md
|
|
37
|
+
- name: Run Semantic Release
|
|
155
38
|
env:
|
|
156
|
-
|
|
39
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
41
|
+
run: npx semantic-release
|
package/CHANGELOG.md
ADDED
package/dist/at-rules/dark.js
CHANGED
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = dark;
|
|
4
4
|
const postcss_1 = require("postcss");
|
|
5
5
|
function dark(atRule) {
|
|
6
|
-
// Create a new nested rule: [data-mode="dark"] & { ... }
|
|
7
6
|
const nestedRule = new postcss_1.Rule({
|
|
8
7
|
selector: `[data-mode="dark"] &`,
|
|
9
|
-
|
|
8
|
+
});
|
|
9
|
+
// Clone all child nodes to prevent them from being detached
|
|
10
|
+
atRule.each((node) => {
|
|
11
|
+
nestedRule.append(node.clone());
|
|
10
12
|
});
|
|
11
13
|
// Replace @dark atRule with the new nested rule
|
|
12
14
|
atRule.replaceWith(nestedRule);
|
package/dist/at-rules/light.js
CHANGED
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = light;
|
|
4
4
|
const postcss_1 = require("postcss");
|
|
5
5
|
function light(atRule) {
|
|
6
|
-
// Create a new nested rule: [data-mode="light"] & { ... }
|
|
7
6
|
const nestedRule = new postcss_1.Rule({
|
|
8
7
|
selector: `[data-mode="light"] &`,
|
|
9
|
-
|
|
8
|
+
});
|
|
9
|
+
// Clone all child nodes to prevent them from being detached
|
|
10
|
+
atRule.each((node) => {
|
|
11
|
+
nestedRule.append(node.clone());
|
|
10
12
|
});
|
|
11
13
|
// Replace @light atRule with the new nested rule
|
|
12
14
|
atRule.replaceWith(nestedRule);
|
package/dist/plugin.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dynamicFunctionsPlugin = void 0;
|
|
4
4
|
const functions_1 = require("./functions");
|
|
5
|
+
const at_rules_1 = require("./at-rules");
|
|
5
6
|
const dynamicFunctionsPlugin = (opts = {}) => {
|
|
6
7
|
const fnMap = { ...functions_1.functions, ...opts.functions };
|
|
7
8
|
return {
|
|
@@ -19,6 +20,9 @@ const dynamicFunctionsPlugin = (opts = {}) => {
|
|
|
19
20
|
}
|
|
20
21
|
decl.value = value;
|
|
21
22
|
},
|
|
23
|
+
AtRule: {
|
|
24
|
+
...at_rules_1.atRuleHandlers,
|
|
25
|
+
},
|
|
22
26
|
};
|
|
23
27
|
};
|
|
24
28
|
exports.dynamicFunctionsPlugin = dynamicFunctionsPlugin;
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seyuna/postcss",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "1.0.0-canary.1",
|
|
4
4
|
"description": "Seyuna UI's postcss plugin",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
9
|
-
"prepare": "npm run build"
|
|
8
|
+
"build": "tsc"
|
|
10
9
|
},
|
|
11
10
|
"keywords": [
|
|
12
11
|
"postcss",
|
|
@@ -14,12 +13,24 @@
|
|
|
14
13
|
"seyuna"
|
|
15
14
|
],
|
|
16
15
|
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/seyuna-corp/seyuna-postcss.git"
|
|
19
|
+
},
|
|
17
20
|
"peerDependencies": {
|
|
18
21
|
"postcss": "^8.5.6"
|
|
19
22
|
},
|
|
20
23
|
"devDependencies": {
|
|
24
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
25
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
26
|
+
"@semantic-release/exec": "^7.1.0",
|
|
27
|
+
"@semantic-release/git": "^10.0.1",
|
|
28
|
+
"@semantic-release/github": "^11.0.3",
|
|
29
|
+
"@semantic-release/npm": "^12.0.2",
|
|
30
|
+
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
21
31
|
"@types/node": "^20.0.0",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
32
|
+
"postcss": "^8.5.6",
|
|
33
|
+
"semantic-release": "^24.2.7",
|
|
34
|
+
"typescript": "^5.0.0"
|
|
24
35
|
}
|
|
25
36
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('semantic-release').GlobalConfig}
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
branches: [{ name: "canary", prerelease: "canary" }, "main"],
|
|
6
|
+
plugins: [
|
|
7
|
+
"@semantic-release/commit-analyzer",
|
|
8
|
+
"@semantic-release/release-notes-generator",
|
|
9
|
+
["@semantic-release/changelog", { changelogFile: "CHANGELOG.md" }],
|
|
10
|
+
[
|
|
11
|
+
"@semantic-release/exec", // Runs build before publishing
|
|
12
|
+
{
|
|
13
|
+
prepareCmd: "npm run build",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
"@semantic-release/npm", // Publishes to npm
|
|
18
|
+
{
|
|
19
|
+
npmPublish: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"@semantic-release/git", // Commits updated files
|
|
24
|
+
{
|
|
25
|
+
assets: ["package.json", "package-lock.json", "CHANGELOG.md"],
|
|
26
|
+
message:
|
|
27
|
+
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
"@semantic-release/github", // Creates GitHub release
|
|
31
|
+
],
|
|
32
|
+
};
|
package/src/at-rules/dark.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Rule, type AtRule } from "postcss";
|
|
1
|
+
import { Rule, type AtRule, type ChildNode } from "postcss";
|
|
2
2
|
|
|
3
3
|
export default function dark(atRule: AtRule) {
|
|
4
|
-
// Create a new nested rule: [data-mode="dark"] & { ... }
|
|
5
4
|
const nestedRule = new Rule({
|
|
6
5
|
selector: `[data-mode="dark"] &`,
|
|
7
|
-
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// Clone all child nodes to prevent them from being detached
|
|
9
|
+
atRule.each((node: ChildNode) => {
|
|
10
|
+
nestedRule.append(node.clone());
|
|
8
11
|
});
|
|
9
12
|
|
|
10
13
|
// Replace @dark atRule with the new nested rule
|
package/src/at-rules/light.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Rule, type AtRule } from "postcss";
|
|
1
|
+
import { Rule, type AtRule, type ChildNode } from "postcss";
|
|
2
2
|
|
|
3
3
|
export default function light(atRule: AtRule) {
|
|
4
|
-
// Create a new nested rule: [data-mode="light"] & { ... }
|
|
5
4
|
const nestedRule = new Rule({
|
|
6
5
|
selector: `[data-mode="light"] &`,
|
|
7
|
-
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// Clone all child nodes to prevent them from being detached
|
|
9
|
+
atRule.each((node: ChildNode) => {
|
|
10
|
+
nestedRule.append(node.clone());
|
|
8
11
|
});
|
|
9
12
|
|
|
10
13
|
// Replace @light atRule with the new nested rule
|
package/src/plugin.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { PluginCreator } from "postcss";
|
|
2
2
|
import { functions } from "./functions";
|
|
3
|
+
import { atRuleHandlers } from "./at-rules";
|
|
3
4
|
|
|
4
5
|
export interface PluginOptions {
|
|
5
6
|
functions?: Record<string, (...args: string[]) => string>;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
export const dynamicFunctionsPlugin: PluginCreator<PluginOptions> = (
|
|
9
|
+
export const dynamicFunctionsPlugin: PluginCreator<PluginOptions> = (
|
|
10
|
+
opts = {}
|
|
11
|
+
) => {
|
|
9
12
|
const fnMap = { ...functions, ...opts.functions };
|
|
10
13
|
|
|
11
14
|
return {
|
|
12
15
|
postcssPlugin: "postcss-dynamic-functions",
|
|
16
|
+
|
|
13
17
|
Declaration(decl) {
|
|
14
18
|
let value = decl.value;
|
|
15
19
|
|
|
@@ -26,6 +30,10 @@ export const dynamicFunctionsPlugin: PluginCreator<PluginOptions> = (opts = {})
|
|
|
26
30
|
|
|
27
31
|
decl.value = value;
|
|
28
32
|
},
|
|
33
|
+
|
|
34
|
+
AtRule: {
|
|
35
|
+
...atRuleHandlers,
|
|
36
|
+
},
|
|
29
37
|
};
|
|
30
38
|
};
|
|
31
39
|
|