Skip to content

Commit 30d20d0

Browse files
committed
feat!: postcss config build and script; remove gulp
BREAKING CHANGE: - Removes component-builder & component-builder-simple for script leveraging postcss - Imports added to index.css and themes/express.css
1 parent acebc16 commit 30d20d0

File tree

533 files changed

+4019
-9913
lines changed

Some content is hidden

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

533 files changed

+4019
-9913
lines changed

.github/actions/file-diff/index.js

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function run() {
5252
* and not just reporting on the overall size of the compiled assets
5353
* @type boolean
5454
*/
55-
const hasDiff = baseOutput.size > 0;
55+
const hasBase = baseOutput.size > 0;
5656
// --------------- End evaluation ---------------
5757

5858
/** Split the data by component package */
@@ -66,7 +66,7 @@ async function run() {
6666
);
6767

6868
/** Calculate the overall size of the base branch's assets */
69-
const overallBaseSize = hasDiff
69+
const overallBaseSize = hasBase
7070
? [...baseOutput.values()].reduce((acc, size) => acc + size, 0)
7171
: undefined;
7272

@@ -95,29 +95,35 @@ async function run() {
9595
* PR - base / base = change
9696
*/
9797
let changeSummary = "";
98-
if (baseOutput.size > 0 && hasDiff && hasChange) {
98+
if (baseOutput.size > 0 && hasBase && hasChange) {
9999
changeSummary = `**Total change (Δ)**: ${printChange(overallHeadSize, overallBaseSize)} (${printPercentChange(overallHeadSize, overallBaseSize)})`;
100-
} else if (baseOutput.size > 0 && hasDiff && !hasChange) {
100+
} else if (baseOutput.size > 0 && hasBase && !hasChange) {
101101
changeSummary = `No change in file sizes`;
102102
}
103103

104104
if (changeSummary !== "") {
105-
summary.push(...[
105+
summary.push(
106106
changeSummary,
107-
"<small><em>Table reports on changes to a package's main file. Other changes can be found in the collapsed \"Details\" below.</em></small>",
107+
"",
108+
"<small><em>Table reports on changes to a package's main file. Other changes can be found in the collapsed <a href=\"#details\">Details</a> section below.</em></small>",
108109
""
109-
]);
110+
);
110111
}
111112

112-
markdown.push(`<details>`, `<summary><b>Details</b></summary>`, "");
113+
markdown.push(
114+
"<a name=\"details\"></a>",
115+
`<details>`,
116+
`<summary><b>Details</b></summary>`,
117+
""
118+
);
113119

114120
sections.map(({ name, filePath, headMainSize, baseMainSize, hasChange, mainFile, fileMap }) => {
115121
if (!hasChange) return;
116122

117123
const data = [];
118124

119125
/** We only evaluate changes if there is a diff branch being used and this is the main file for the package */
120-
if (hasDiff) {
126+
if (hasBase) {
121127
/**
122128
* If: the component folder exists in the original branch but not the PR
123129
* Or: the pull request file size is 0 or empty but the original branch has a size
@@ -155,8 +161,8 @@ async function run() {
155161
const md = ["", `#### ${name}`, ""];
156162
md.push(
157163
...[
158-
["File", "Head", ...(hasDiff ? ["Base", "Δ"] : [])],
159-
[" - ", " - ", ...(hasDiff ? [" - ", " - "] : [])],
164+
["File", "Head", ...(hasBase ? ["Base", "Δ"] : [])],
165+
[" - ", " - ", ...(hasBase ? [" - ", " - "] : [])],
160166
].map((row) => `| ${row.join(" | ")} |`),
161167
...[...fileMap.entries()]
162168
.reduce(
@@ -170,10 +176,11 @@ async function run() {
170176
...table,
171177
[
172178
readableFilename === mainFile ? `**${readableFilename}**` : readableFilename,
173-
isRemoved(headByteSize, baseByteSize) ? "**removed**" : isNew(headByteSize, baseByteSize) ? "**new**" : bytesToSize(headByteSize),
174-
...(hasDiff ? [
179+
// If the file was removed, note it's absense with a dash; otherwise, note it's size
180+
isRemoved(headByteSize, baseByteSize) ? " - " : bytesToSize(headByteSize),
181+
...(hasBase ? [
175182
bytesToSize(baseByteSize),
176-
`${printChange(headByteSize, baseByteSize)}${difference(headByteSize, baseByteSize) !== 0 ? ` (${printPercentChange(headByteSize , baseByteSize)})` : ""}`,
183+
isRemoved(headByteSize, baseByteSize) ? "🚨 deleted, moved, or renamed" : isNew(headByteSize, baseByteSize) ? "🎉 **new**" : `${printChange(headByteSize, baseByteSize)}${difference(headByteSize, baseByteSize) !== 0 ? ` (${printPercentChange(headByteSize , baseByteSize)})` : ""}`,
177184
] : []),
178185
]
179186
];
@@ -192,8 +199,8 @@ async function run() {
192199
if (summaryTable.length > 0) {
193200
// Add the headings to the summary table if it contains data
194201
summaryTable = [
195-
["Package", "Size", ...(hasDiff ? ["Δ"] : [])],
196-
["-", "-", ...(hasDiff ? ["-"] : [])],
202+
["Package", "Size", ...(hasBase ? ["Δ"] : [])],
203+
["-", "-", ...(hasBase ? ["-"] : [])],
197204
...summaryTable,
198205
];
199206

@@ -237,15 +244,15 @@ async function run() {
237244
);
238245
core.setOutput("total-size", headMainSize);
239246

240-
if (hasDiff) {
247+
if (hasBase) {
241248
const baseMainSize = [...baseOutput.entries()].reduce(
242249
(acc, [_, size]) => acc + size,
243250
0
244251
);
245252

246253
core.setOutput(
247254
"has-changed",
248-
hasDiff && headMainSize !== baseMainSize ? "true" : "false"
255+
hasBase && headMainSize !== baseMainSize ? "true" : "false"
249256
);
250257
}
251258
} else {
@@ -379,11 +386,37 @@ const splitDataByPackage = function (dataMap, path, baseMap = new Map()) {
379386

380387
if (!fileMap.has(readableFilename)) {
381388
fileMap.set(readableFilename, {
382-
headByteSize: headByteSize,
389+
headByteSize,
383390
baseByteSize: baseMap.get(file),
384391
});
385-
} else {
386-
throw new Error(`The file ${file} was found twice in the dataset`);
392+
}
393+
394+
/** Update the component's table data */
395+
PACKAGES.set(packageName, fileMap);
396+
});
397+
398+
// Look for any base files not present in the head
399+
[...baseMap.entries()].forEach(([file, baseByteSize]) => {
400+
// Determine the name of the component
401+
const parts = file.split(sep);
402+
const componentIdx = parts.findIndex((part) => part === "dist") - 1;
403+
const packageName = parts[componentIdx];
404+
405+
if (!filePath) {
406+
filePath = `${file.replace(path, "")}/${parts.slice(componentIdx + 1, -1).join(sep)}`;
407+
}
408+
409+
const readableFilename = file.replace(/^.*\/dist\//, "");
410+
411+
const fileMap = PACKAGES.has(packageName)
412+
? PACKAGES.get(packageName)
413+
: new Map();
414+
415+
if (!fileMap.has(readableFilename)) {
416+
fileMap.set(readableFilename, {
417+
headByteSize: dataMap.get(file),
418+
baseByteSize,
419+
});
387420
}
388421

389422
/** Update the component's table data */

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ jobs:
118118
run: yarn nx reset
119119

120120
## --- BUILD --- ##
121-
- name: Build components
121+
- name: Build components & ui-icons
122122
shell: bash
123-
run: yarn build
123+
run: yarn ci
124124

125125
## --- UPLOAD (only ubuntu-latest at the moment) --- ##
126126
- name: Upload compiled assets & NX performance profile

.github/workflows/compare-results.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,31 @@ jobs:
9898
ui-icons/dist/**
9999
token: ${{ secrets.GITHUB_TOKEN }}
100100

101+
- name: Generate rich diff if changes detected
102+
id: rich-diff
103+
if: ${{ steps.compare.outputs.has-changed }}
104+
shell: bash
105+
run: yarn compare
106+
107+
- name: Upload changes
108+
if: ${{ steps.compare.outputs.has-changed }}
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: rich-diff
112+
path: |
113+
.diff-output/index.html
114+
.diff-output/diffs/*/*.html
115+
components/typography/dist/index.css
116+
components/table/dist/index.css
117+
components/badge/dist/index.css
118+
components/button/dist/index.css
119+
components/card/dist/index.css
120+
components/icon/dist/index.css
121+
components/sidenav/dist/index.css
122+
tokens/dist/index.css
123+
node_modules/diff2html/bundles/css/diff2html.min.css
124+
node_modules/diff2html/bundles/js/diff2html.min.js
125+
101126
fetch-build-artifacts:
102127
name: Fetch & validate build artifacts
103128
strategy:
@@ -172,7 +197,7 @@ jobs:
172197
- name: Build
173198
if: ${{ steps.download.outcome != 'success' }}
174199
shell: bash
175-
run: yarn build
200+
run: yarn ci
176201

177202
- name: Upload compiled assets
178203
if: ${{ steps.download.outcome != 'success' }}

.github/workflows/development.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
outputs:
8787
styles_added_files: ${{ steps.changed-files.outputs.styles_added_files }}
8888
styles_modified_files: ${{ steps.changed-files.outputs.styles_modified_files }}
89-
# eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }}
90-
# eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }}
89+
eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }}
90+
eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }}
9191
permissions:
9292
pull-requests: read
9393

@@ -101,23 +101,22 @@ jobs:
101101
- components/*/index.css
102102
- components/*/themes/spectrum.css
103103
- components/*/themes/express.css
104-
# eslint:
105-
# - components/*/package.json
106-
# - components/*/project.json
107-
# - components/*/stories/*.js
104+
eslint:
105+
- components/*/stories/*.js
108106
109107
# -------------------------------------------------------------
110108
# Lint pre-compiled assets for consistency
111109
# -------------------------------------------------------------
112110
lint:
113111
name: Lint
112+
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip_lint') == false }}
114113
needs: [changed_files]
115114
uses: ./.github/workflows/lint.yml
116115
with:
117116
styles_added_files: ${{ needs.changed_files.outputs.styles_added_files }}
118117
styles_modified_files: ${{ needs.changed_files.outputs.styles_modified_files }}
119-
# eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }}
120-
# eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }}
118+
eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }}
119+
eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }}
121120
secrets: inherit
122121

123122
# -------------------------------------------------------------

.github/workflows/lint.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ on:
1212
styles_modified_files:
1313
type: string
1414
required: false
15-
# eslint_added_files:
16-
# type: string
17-
# required: false
18-
# eslint_modified_files:
19-
# type: string
20-
# required: false
15+
eslint_added_files:
16+
type: string
17+
required: false
18+
eslint_modified_files:
19+
type: string
20+
required: false
2121
workflow_call:
2222
inputs:
2323
styles_added_files:
@@ -26,12 +26,12 @@ on:
2626
styles_modified_files:
2727
type: string
2828
required: false
29-
# eslint_added_files:
30-
# type: string
31-
# required: false
32-
# eslint_modified_files:
33-
# type: string
34-
# required: false
29+
eslint_added_files:
30+
type: string
31+
required: false
32+
eslint_modified_files:
33+
type: string
34+
required: false
3535

3636
permissions:
3737
contents: read
@@ -80,18 +80,18 @@ jobs:
8080
fail_on_error: true
8181
level: error
8282
reporter: github-pr-check
83-
filter_mode: file
83+
filter_mode: diff_context
8484
# stylelint_input: "components/*/index.css components/*/themes/*.css"
8585
stylelint_input: "${{ inputs.styles_added_files }} ${{ inputs.styles_modified_files }}"
8686
stylelint_config: stylelint.config.js
8787

88-
# - name: Run eslint on packages and stories
89-
# uses: reviewdog/action-eslint@v1.20.0
90-
# if: ${{ inputs.eslint_added_files != '' || inputs.eslint_modified_files != '' }}
91-
# with:
92-
# fail_on_error: true
93-
# level: error
94-
# reporter: github-pr-check
95-
# filter_mode: file
96-
# # eslint_flags: "components/*/stories/*.js"
97-
# eslint_flags: "${{ inputs.eslint_added_files }} ${{ inputs.eslint_modified_files }}"
88+
- name: Run eslint on packages and stories
89+
uses: reviewdog/action-eslint@v1.20.0
90+
if: ${{ inputs.eslint_added_files != '' || inputs.eslint_modified_files != '' }}
91+
with:
92+
fail_on_error: true
93+
level: error
94+
reporter: github-pr-check
95+
filter_mode: diff_context
96+
# eslint_flags: "components/*/stories/*.js"
97+
eslint_flags: "${{ inputs.eslint_added_files }} ${{ inputs.eslint_modified_files }}"

.npmignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/src
2-
/docs
2+
/dist
33
/node_modules
44
/tasks
55
/temp
6-
/gulpfile.js
76
npm-debug.log
87
/.github
9-
/dist/docs/
108
/components
11-
/tools

0 commit comments

Comments
 (0)