Skip to content

Commit da01c01

Browse files
committed
chore: reduce commands output
1 parent 132d73f commit da01c01

11 files changed

Lines changed: 118 additions & 23 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: yarn install --immutable --immutable-cache --check-cache
2828
- name: Build the project
29-
run: yarn build
29+
run: yarn build:output
3030
- name: Lint Project
3131
run: yarn lint
3232
- name: Check formatting
@@ -57,7 +57,7 @@ jobs:
5757
- name: Install playwright dependencies for e2e
5858
run: yarn workspace @allurereport/e2e playwright install-deps
5959
- name: Build project
60-
run: yarn build
60+
run: yarn build:output
6161
- name: Test Project
6262
run: yarn allure run --config=./allurerc.gate.mjs --environment=${{ matrix.os }} --dump=allure-results-${{ matrix.os }} -- yarn test
6363
- name: Upload test results
@@ -110,7 +110,7 @@ jobs:
110110
- name: Install dependencies
111111
run: yarn install --immutable --immutable-cache --check-cache
112112
- name: Build project
113-
run: yarn build
113+
run: yarn build:output
114114
- name: Generate report
115115
env:
116116
ALLURE_PERF_METRICS: "1"

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish
22

33
on:
44
release:
5-
types: [ published ]
5+
types: [published]
66

77
permissions:
88
contents: read
@@ -15,12 +15,12 @@ jobs:
1515
- uses: actions/setup-node@v6
1616
with:
1717
node-version: 20
18-
registry-url: 'https://registry.npmjs.org'
19-
cache: 'yarn'
18+
registry-url: "https://registry.npmjs.org"
19+
cache: "yarn"
2020
- name: yarn install, build
2121
run: |
2222
yarn install
23-
yarn build
23+
yarn build:output
2424
- run: yarn workspaces foreach -Avv --no-private npm publish --access public
2525
env:
2626
YARN_NPM_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@
1313
"scripts": {
1414
"archive": "yarn allure archive",
1515
"audit": "yarn npm audit --all --recursive",
16-
"build": "yarn workspaces foreach -Avvpt run build",
16+
"build": "node ./scripts/run-build.cjs",
17+
"build:output": "yarn workspaces foreach -Avvpt run build",
1718
"clean": "yarn workspaces foreach -Avvpt run clean",
1819
"format": "yarn format:write",
1920
"report": "yarn allure generate --config=./allurerc.mjs",
2021
"test": "yarn workspaces foreach -Avvp --exclude sandbox run test",
21-
"lint": "yarn workspaces foreach -Avvt run lint",
22+
"lint": "yarn workspaces foreach -At run lint --quiet",
23+
"lint:verbose": "yarn workspaces foreach -Avvt run lint",
2224
"lint:fix": "yarn workspaces foreach -Avvt run lint:fix",
2325
"lint:type": "yarn oxlint --type-aware --import-plugin packages --quiet",
24-
"verify": "yarn format:check && yarn lint && yarn lint:type --quiet",
25-
"format:check": "node ./scripts/run-oxfmt.cjs --check",
26+
"lint:type:verbose": "yarn oxlint --type-aware --import-plugin packages --quiet",
27+
"verify": "yarn format:check && yarn lint && yarn lint:type",
28+
"format:check": "node ./scripts/run-oxfmt.cjs --check --quiet",
29+
"format:check:verbose": "node ./scripts/run-oxfmt.cjs --check",
2630
"format:write": "node ./scripts/run-oxfmt.cjs --write"
2731
},
2832
"devDependencies": {

packages/web-awesome/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"dev:serve": "webpack serve --mode development",
2222
"build": "run-s clean 'build:prod:*'",
2323
"build:dev": "run-s clean 'build:dev:*'",
24-
"build:prod:single": "SINGLE_FILE_MODE=1 webpack --mode production",
25-
"build:prod:multi": "webpack --mode production",
24+
"build:prod:single": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 SINGLE_FILE_MODE=1 webpack --mode production --stats errors-only",
25+
"build:prod:multi": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 webpack --mode production --stats errors-only",
2626
"build:dev:single": "SINGLE_FILE_MODE=1 webpack --mode development",
2727
"build:dev:multi": "webpack --mode development",
2828
"lint": "oxlint --import-plugin src test features stories",

packages/web-classic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"dev:serve": "webpack serve --mode development",
2222
"build": "run-s clean 'build:prod:*'",
2323
"build:dev": "run-s clean 'build:dev:*'",
24-
"build:prod:single": "SINGLE_FILE_MODE=1 webpack --mode production",
25-
"build:prod:multi": "webpack --mode production",
24+
"build:prod:single": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 SINGLE_FILE_MODE=1 webpack --mode production --stats errors-only",
25+
"build:prod:multi": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 webpack --mode production --stats errors-only",
2626
"build:dev:single": "SINGLE_FILE_MODE=1 webpack --mode development",
2727
"build:dev:multi": "webpack --mode development",
2828
"lint": "oxlint --import-plugin src test features stories",

packages/web-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"./mixins.scss": "./dist/mixins.scss"
3333
},
3434
"scripts": {
35-
"build": "rimraf ./dist && rollup -c",
35+
"build": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 rimraf ./dist && BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 bash -c 'rollup -c --silent 2>&1 | grep -v \"Without .* option PostCSS\"; exit ${PIPESTATUS[0]}'",
3636
"build:watch": "rollup -c -w",
3737
"build:ds": "storybook build",
3838
"check:theme-apca": "node scripts/check-theme-apca.mjs",

packages/web-components/rollup.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,21 @@ export default defineConfig([
5959
}),
6060
babel({
6161
babelHelpers: "bundled",
62+
compact: true,
6263
extensions: [".js", ".jsx", ".ts", ".tsx"],
6364
exclude: ["**/*.test.tsx", "**/*.test.ts"],
6465
}),
6566
svg(),
6667
postcss({
6768
modules: true,
68-
extract: true,
69+
extract: "index.css",
6970
minimize: true,
71+
sourceMap: false,
7072
extensions: [".scss", ".css"],
7173
plugins: [postcssImport(), autoprefixer()],
7274
use: {
7375
sass: {
74-
silenceDeprecations: ["legacy-js-api"],
76+
silenceDeprecations: ["legacy-js-api", "import"],
7577
},
7678
},
7779
}),

packages/web-dashboard/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"dev:serve": "webpack serve --mode development",
2222
"build": "run-s clean 'build:prod:*'",
2323
"build:dev": "run-s clean 'build:dev:*'",
24-
"build:prod:single": "SINGLE_FILE_MODE=1 webpack --mode production",
25-
"build:prod:multi": "webpack --mode production",
24+
"build:prod:single": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 SINGLE_FILE_MODE=1 webpack --mode production --stats errors-only",
25+
"build:prod:multi": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 webpack --mode production --stats errors-only",
2626
"build:dev:single": "SINGLE_FILE_MODE=1 webpack --mode development",
2727
"build:dev:multi": "webpack --mode development",
2828
"lint": "oxlint --import-plugin src test features stories",

packages/web-summary/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"clean": "rimraf dist",
1818
"dev": "webpack serve --mode development",
1919
"build": "run-s clean 'build:prod'",
20-
"build:prod": "webpack --mode production",
20+
"build:prod": "BROWSERSLIST_IGNORE_OLD_DATA=1 NODE_NO_WARNINGS=1 webpack --mode production --stats errors-only",
2121
"build:dev": "webpack --mode development",
2222
"lint": "oxlint --import-plugin src test features stories",
2323
"lint:fix": "oxlint --import-plugin --fix src test features stories"

scripts/run-build.cjs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env node
2+
3+
const { spawn } = require("node:child_process");
4+
5+
const startedAt = process.hrtime.bigint();
6+
const command = ["yarn", "workspaces", "foreach", "-Apt", "run", "build"];
7+
8+
console.log("Build in progress...");
9+
10+
const child = spawn(command[0], command.slice(1), {
11+
cwd: process.cwd(),
12+
env: process.env,
13+
stdio: ["ignore", "pipe", "pipe"],
14+
});
15+
16+
let output = "";
17+
18+
child.stdout.setEncoding("utf8");
19+
child.stderr.setEncoding("utf8");
20+
child.stdout.on("data", (chunk) => {
21+
output += chunk;
22+
});
23+
child.stderr.on("data", (chunk) => {
24+
output += chunk;
25+
});
26+
27+
const fallbackDuration = () => {
28+
const durationMs = Number((process.hrtime.bigint() - startedAt) / 1_000_000n);
29+
const seconds = Math.floor(durationMs / 1000);
30+
const ms = durationMs % 1000;
31+
32+
return `Done in ${seconds}s ${ms}ms`;
33+
};
34+
35+
const finalDoneLine = () => {
36+
const lines = output
37+
.split(/\r?\n/)
38+
.map((line) => line.trim())
39+
.filter(Boolean);
40+
41+
return lines.findLast((line) => /^Done in \d/.test(line)) ?? fallbackDuration();
42+
};
43+
44+
child.on("close", (code, signal) => {
45+
const doneLine = finalDoneLine();
46+
47+
if (code === 0 && signal === null) {
48+
console.log(doneLine);
49+
return;
50+
}
51+
52+
console.error("Build failed.");
53+
54+
const failureOutput = output
55+
.split(/\r?\n/)
56+
.filter((line) => !/^Done in \d/.test(line.trim()))
57+
.join("\n")
58+
.trim();
59+
60+
if (failureOutput) {
61+
console.error(failureOutput);
62+
}
63+
64+
console.error("");
65+
console.error(doneLine);
66+
process.exit(typeof code === "number" ? code : 1);
67+
});
68+
69+
child.on("error", (error) => {
70+
console.error("Build failed.");
71+
console.error(error.message);
72+
console.error(fallbackDuration());
73+
process.exit(1);
74+
});

0 commit comments

Comments
 (0)