Skip to content

Commit 57e03b7

Browse files
authored
chore: update eslint, adopt prettier and rsbuild (#671)
- update of eslint config - replacement of webpack with rsbuild for the browser bundle (with support for `node:` imports that we now have in the shared repo) - adopts prettier and reformats everything, including the docs and workflows - coverage is broken because of the changes in browser bundle, didnt find a way to make it fly, but i guess its fine for the client and we can just disable those? Closes #607
1 parent b187d5f commit 57e03b7

File tree

136 files changed

+186743
-193051
lines changed

Some content is hidden

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

136 files changed

+186743
-193051
lines changed
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
2-
const { execSync } = require('child_process');
3-
const fs = require('fs');
4-
const path = require('path');
2+
const { execSync } = require('node:child_process');
3+
const fs = require('node:fs');
4+
const path = require('node:path');
55

66
const PKG_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
77

@@ -18,17 +18,19 @@ pkgJson.version = nextVersion;
1818
fs.writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);
1919

2020
function getNextVersion(version) {
21-
const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8'});
21+
const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });
2222
const versions = JSON.parse(versionString);
2323

24-
if (versions.some(v => v === VERSION)) {
25-
console.error(`before-deploy: A release with version ${VERSION} already exists. Please increment version accordingly.`);
24+
if (versions.some((v) => v === VERSION)) {
25+
console.error(
26+
`before-deploy: A release with version ${VERSION} already exists. Please increment version accordingly.`,
27+
);
2628
process.exit(1);
2729
}
2830

2931
const prereleaseNumbers = versions
30-
.filter(v => (v.startsWith(VERSION) && v.includes('-')))
31-
.map(v => Number(v.match(/\.(\d+)$/)[1]));
32+
.filter((v) => v.startsWith(VERSION) && v.includes('-'))
33+
.map((v) => Number(v.match(/\.(\d+)$/)[1]));
3234
const lastPrereleaseNumber = Math.max(-1, ...prereleaseNumbers);
33-
return `${version}-beta.${lastPrereleaseNumber + 1}`
35+
return `${version}-beta.${lastPrereleaseNumber + 1}`;
3436
}

.github/workflows/check.yaml

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
branches:
1111
- master
1212
tags-ignore:
13-
- "**" # Ignore all tags to prevent duplicate builds when tags are pushed.
13+
- '**' # Ignore all tags to prevent duplicate builds when tags are pushed.
1414

1515
jobs:
1616
build_and_test:
@@ -21,67 +21,69 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
node-version: [ 16, 18, 20, 22 ]
24+
node-version: [16, 18, 20, 22]
2525

2626
steps:
27-
- name: Cancel Workflow Action
28-
uses: styfle/[email protected]
29-
with:
30-
access_token: ${{ github.token }}
27+
- name: Cancel Workflow Action
28+
uses: styfle/[email protected]
29+
with:
30+
access_token: ${{ github.token }}
3131

32-
- name: Checkout repository
33-
uses: actions/checkout@v4
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
3434

35-
- name: Use Node.js ${{ matrix.node-version }}
36-
uses: actions/setup-node@v4
37-
with:
38-
node-version: ${{ matrix.node-version }}
39-
cache: 'npm'
40-
cache-dependency-path: 'package-lock.json'
35+
- name: Use Node.js ${{ matrix.node-version }}
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
cache: 'npm'
40+
cache-dependency-path: 'package-lock.json'
4141

42-
- name: Install Dependencies
43-
run: npm ci
42+
- name: Install Dependencies
43+
run: npm ci
4444

45-
- name: Run Tests
46-
run: npm test
45+
- name: Run Tests
46+
run: npm test
4747

4848
lint:
4949
name: Lint
5050
runs-on: ubuntu-latest
5151

5252
steps:
53-
- uses: actions/checkout@v4
54-
- name: Use Node.js 22
55-
uses: actions/setup-node@v4
56-
with:
57-
node-version: 22
58-
cache: 'npm'
59-
cache-dependency-path: 'package-lock.json'
60-
- name: Install Dependencies
61-
run: npm ci
62-
- run: npm run lint
53+
- uses: actions/checkout@v4
54+
- name: Use Node.js 22
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 22
58+
cache: 'npm'
59+
cache-dependency-path: 'package-lock.json'
60+
- name: Install Dependencies
61+
run: npm ci
62+
- run: npm run lint
63+
- name: Prettier
64+
run: npm run format:check
6365

6466
docs:
6567
name: Docs build
6668
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
6769
runs-on: ubuntu-latest
6870
steps:
69-
- name: Checkout Source code
70-
uses: actions/checkout@v4
71+
- name: Checkout Source code
72+
uses: actions/checkout@v4
7173

72-
- name: Use Node.js 22
73-
uses: actions/setup-node@v4
74-
with:
75-
node-version: 22
76-
cache: 'npm'
77-
cache-dependency-path: 'package-lock.json'
78-
- name: Install Dependencies
79-
run: npm ci
74+
- name: Use Node.js 22
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: 22
78+
cache: 'npm'
79+
cache-dependency-path: 'package-lock.json'
80+
- name: Install Dependencies
81+
run: npm ci
8082

81-
- name: Install & build & deploy docs
82-
run: |
83-
npm ci --force
84-
cd website
85-
npm ci --force
86-
npm run lint
87-
npm run build
83+
- name: Install & build & deploy docs
84+
run: |
85+
npm ci --force
86+
cd website
87+
npm ci --force
88+
npm run lint
89+
npm run build

.github/workflows/docs.yaml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,57 +18,57 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
21+
- uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
2424

25-
- name: Use Node.js 20
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: 20
29-
cache: npm
30-
cache-dependency-path: website/package-lock.json
25+
- name: Use Node.js 20
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: npm
30+
cache-dependency-path: website/package-lock.json
3131

32-
- name: Set git identity
33-
run: |
34-
git config user.name 'GitHub Actions'
35-
git config user.email 'github-actions[bot]@users.noreply.github.com'
32+
- name: Set git identity
33+
run: |
34+
git config user.name 'GitHub Actions'
35+
git config user.email 'github-actions[bot]@users.noreply.github.com'
3636
37-
- name: Install Node.js dependencies
38-
run: |
39-
npm install
40-
cd website
41-
npm install
42-
npm update @apify/docs-theme
37+
- name: Install Node.js dependencies
38+
run: |
39+
npm install
40+
cd website
41+
npm install
42+
npm update @apify/docs-theme
4343
4444
# We do this as early as possible to prevent conflicts if someone else would push something in the meantime
45-
- name: Commit the updated package.json and lockfile
46-
run: |
47-
git config user.name 'GitHub Actions'
48-
git config user.email 'github-actions[bot]@users.noreply.github.com'
49-
git add website/package.json
50-
git add website/package-lock.json
51-
git diff-index --quiet HEAD || git commit -m 'chore: Automatic theme updating workflow [skip ci]' || true
52-
git push
45+
- name: Commit the updated package.json and lockfile
46+
run: |
47+
git config user.name 'GitHub Actions'
48+
git config user.email 'github-actions[bot]@users.noreply.github.com'
49+
git add website/package.json
50+
git add website/package-lock.json
51+
git diff-index --quiet HEAD || git commit -m 'chore: Automatic theme updating workflow [skip ci]' || true
52+
git push
5353
54-
- name: Build Docusaurus docs
55-
run: npm run build
56-
working-directory: ./website
57-
env:
58-
SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_DOCS_PROJECT_KEY }}
54+
- name: Build Docusaurus docs
55+
run: npm run build
56+
working-directory: ./website
57+
env:
58+
SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_DOCS_PROJECT_KEY }}
5959

60-
- name: Set up GitHub Pages
61-
uses: actions/configure-pages@v5
60+
- name: Set up GitHub Pages
61+
uses: actions/configure-pages@v5
6262

63-
- name: Upload GitHub Pages artifact
64-
uses: actions/upload-pages-artifact@v3
65-
with:
66-
path: ./website/build
63+
- name: Upload GitHub Pages artifact
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: ./website/build
6767

68-
- name: Deploy artifact to GitHub Pages
69-
uses: actions/deploy-pages@v4
68+
- name: Deploy artifact to GitHub Pages
69+
uses: actions/deploy-pages@v4
7070

71-
- name: Invalidate CloudFront cache
72-
run: gh workflow run invalidate.yaml --repo apify/apify-docs-private
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
71+
- name: Invalidate CloudFront cache
72+
run: gh workflow run invalidate.yaml --repo apify/apify-docs-private
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)