diff --git a/.github/workflows/vale.yaml b/.github/workflows/vale.yaml index 460f30b04..bbc3858a1 100644 --- a/.github/workflows/vale.yaml +++ b/.github/workflows/vale.yaml @@ -13,7 +13,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v41.0.1 + uses: tj-actions/changed-files@v41.1.1 with: files: | **/*.{md,mdx} diff --git a/docusaurus.config.js b/docusaurus.config.js index 77b697fbf..4a49c3193 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,3 +1,4 @@ +const { join } = require('path'); const { config } = require('./apify-docs-theme'); const { externalLinkProcessor } = require('./tools/utils/externalLink'); const { collectSlugs } = require('./tools/utils/collectSlugs'); @@ -30,21 +31,21 @@ module.exports = { { label: 'Courses', to: `/academy`, - activeBaseRegex: [ + activeBaseRegex: `${[ 'academy$', - ...collectSlugs(`${__dirname}/sources/academy/webscraping`), - ...collectSlugs(`${__dirname}/sources/academy/platform`), - ].join('|'), + ...collectSlugs(join(__dirname, 'sources', 'academy', 'webscraping')), + ...collectSlugs(join(__dirname, 'sources', 'academy', 'platform')), + ].join('$|')}$`, }, { label: 'Tutorials', to: `/academy/tutorials`, - activeBaseRegex: collectSlugs(`${__dirname}/sources/academy/tutorials`).join('|'), + activeBaseRegex: `${collectSlugs(join(__dirname, 'sources', 'academy', 'tutorials')).join('$|')}$`, }, { label: 'Glossary', to: `/academy/glossary`, - activeBaseRegex: collectSlugs(`${__dirname}/sources/academy/glossary`).join('|'), + activeBaseRegex: `${collectSlugs(join(__dirname, 'sources', 'academy', 'glossary')).join('$|')}$`, }, ], }, diff --git a/package-lock.json b/package-lock.json index 5205bfbfd..ec90ca119 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "react-dom": "^17.0.2", "react-github-btn": "^1.4.0", "search-insights": "2.13.0", - "styled-components": "6.1.6", + "styled-components": "6.1.8", "unist-util-visit": "^5.0.0" }, "devDependencies": { @@ -40,6 +40,7 @@ "@types/react": "^18.2.8", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", + "cross-env": "^7.0.3", "eslint": "^8.46.0", "eslint-plugin-json": "^3.1.0", "eslint-plugin-markdown": "^3.0.1", @@ -49,6 +50,7 @@ "globby": "^14.0.0", "markdownlint": "^0.32.0", "markdownlint-cli": "^0.38.0", + "patch-package": "^8.0.0", "path-browserify": "^1.0.1", "rimraf": "^5.0.1", "typescript": "^5.1.3" @@ -56,7 +58,7 @@ }, "apify-docs-theme": { "name": "@apify/docs-theme", - "version": "1.0.99", + "version": "1.0.101", "license": "ISC", "dependencies": { "@apify/docs-search-modal": "^1.0.25", @@ -4683,6 +4685,11 @@ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==" }, + "node_modules/@emotion/unitless": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.0.tgz", + "integrity": "sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -5932,6 +5939,11 @@ "csstype": "^3.0.2" } }, + "node_modules/@types/stylis": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.0.tgz", + "integrity": "sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw==" + }, "node_modules/@types/trusted-types": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.6.tgz", @@ -6319,6 +6331,12 @@ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -8072,6 +8090,24 @@ "node": ">=0.8" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", @@ -10620,6 +10656,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -12807,6 +12852,24 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "node_modules/json-stable-stringify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.0.tgz", + "integrity": "sha512-zfA+5SuwYN2VWqN1/5HZaDzQKLJHaBVMZIIM+wuYjdptkaQsqzDdqjqf+lZZJUuJq1aanHiY8LhH8LmH+qBYJA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -12841,6 +12904,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -12878,6 +12950,15 @@ "node": ">=0.10.0" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -15054,6 +15135,15 @@ "node": ">= 0.8.0" } }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ow": { "version": "0.28.2", "resolved": "https://registry.npmjs.org/ow/-/ow-0.28.2.tgz", @@ -15263,6 +15353,117 @@ "tslib": "^2.0.3" } }, + "node_modules/patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/patch-package/node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/patch-package/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -19999,9 +20200,9 @@ } }, "node_modules/styled-components": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.6.tgz", - "integrity": "sha512-DgTLULSC29xpabJ24bbn1+hulU6vvGFQf4RPwBOJrm8WJFnN42yXpo5voBt3jDSJBa5tBd1L6PqswJjQ0wRKdg==", + "version": "6.1.8", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.8.tgz", + "integrity": "sha512-PQ6Dn+QxlWyEGCKDS71NGsXoVLKfE1c3vApkvDYS5KAK+V8fNWGhbSUEo9Gg2iaID2tjLXegEW3bZDUGpofRWw==", "dependencies": { "@emotion/is-prop-valid": "1.2.1", "@emotion/unitless": "0.8.0", @@ -20025,16 +20226,6 @@ "react-dom": ">= 16.8.0" } }, - "node_modules/styled-components/node_modules/@emotion/unitless": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.0.tgz", - "integrity": "sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==" - }, - "node_modules/styled-components/node_modules/@types/stylis": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.0.tgz", - "integrity": "sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw==" - }, "node_modules/styled-components/node_modules/tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", @@ -20325,6 +20516,18 @@ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", diff --git a/package.json b/package.json index d53fd3930..05995a07f 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ }, "homepage": "https://github.com/apify/apify-docs#readme", "scripts": { - "start": "rimraf .docusaurus && LOCALHOST=1 docusaurus start", - "start:dev": "rimraf .docusaurus && DEV=1 docusaurus start", + "start": "rimraf .docusaurus && cross-env LOCALHOST=1 CRAWLEE_DOCS_FAST=1 docusaurus start", + "start:dev": "rimraf .docusaurus && cross-env DEV=1 CRAWLEE_DOCS_FAST=1 docusaurus start", "build": "rimraf .docusaurus && docusaurus build", "publish-gh-pages": "docusaurus-publish", "write-translations": "docusaurus write-translations", @@ -26,7 +26,7 @@ "swizzle": "docusaurus swizzle", "deploy": "rimraf .docusaurus && docusaurus deploy", "docusaurus": "docusaurus", - "postinstall": "npx patch-package", + "postinstall": "patch-package", "lint": "npm run lint:md && npm run lint:code", "lint:fix": "npm run lint:md:fix && npm run lint:code:fix", "lint:md": "markdownlint '**/*.md'", @@ -40,6 +40,7 @@ "@types/react": "^18.2.8", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", + "cross-env": "^7.0.3", "eslint": "^8.46.0", "eslint-plugin-json": "^3.1.0", "eslint-plugin-markdown": "^3.0.1", @@ -49,6 +50,7 @@ "globby": "^14.0.0", "markdownlint": "^0.32.0", "markdownlint-cli": "^0.38.0", + "patch-package": "^8.0.0", "path-browserify": "^1.0.1", "rimraf": "^5.0.1", "typescript": "^5.1.3" @@ -72,7 +74,7 @@ "react-dom": "^17.0.2", "react-github-btn": "^1.4.0", "search-insights": "2.13.0", - "styled-components": "6.1.6", + "styled-components": "6.1.8", "unist-util-visit": "^5.0.0" }, "workspaces": [ diff --git a/sources/academy/webscraping/switching_to_typescript/installation.md b/sources/academy/webscraping/switching_to_typescript/installation.md index c4212398e..ecbd5b620 100644 --- a/sources/academy/webscraping/switching_to_typescript/installation.md +++ b/sources/academy/webscraping/switching_to_typescript/installation.md @@ -156,4 +156,4 @@ Outputted is `2099`, exactly what we expected. Awesome! ## Next up {#next} -In the [next lesson], we'll be discussing how to use some of the core types that TypeScript offers. +In the [next lesson](./using_types.md)!, we'll be discussing how to use some of the core types that TypeScript offers. diff --git a/sources/platform/api_v2/api_v2_reference.apib b/sources/platform/api_v2/api_v2_reference.apib index a337256e1..a7165eddb 100644 --- a/sources/platform/api_v2/api_v2_reference.apib +++ b/sources/platform/api_v2/api_v2_reference.apib @@ -5124,6 +5124,7 @@ a summary of your limits, and your current usage. - description: `My public actor!` (string, nullable) - pictureUrl: `https://...` (string, nullable) - userPictureUrl: `https://...` (string, nullable) +- url: `https://...` (string, nullable) - stats (object, required) - totalBuilds: 9 (number, required) - totalRuns: 16 (number, required) diff --git a/tools/utils/collectSlugs.js b/tools/utils/collectSlugs.js index 272fe0d3c..e1d7eff0a 100644 --- a/tools/utils/collectSlugs.js +++ b/tools/utils/collectSlugs.js @@ -1,8 +1,33 @@ -const { execSync } = require('child_process'); +const { opendirSync, readFileSync } = require('fs'); +const { join } = require('path'); function collectSlugs(pathname) { - const a = execSync(`find ${pathname} -type f -name "*.md" -exec grep slug: {} \\;`, { encoding: 'utf-8' }); - return a.split('\n').filter((x) => x.startsWith('slug: ')).map((x) => x.replace('slug: ', '')); + const dir = opendirSync(pathname); + const res = []; + + let direntry; + + // eslint-disable-next-line no-cond-assign + while ((direntry = dir.readSync()) !== null) { + if (direntry.isFile() && direntry.name.endsWith('.md')) { + const mdContent = readFileSync(join(pathname, direntry.name), { encoding: 'utf-8' }); + + const slugMatch = mdContent.match(/^slug: (.*)$/m); + if (slugMatch) { + res.push(slugMatch[1]); + } + } + + if (direntry.isDirectory()) { + const dirPath = join(pathname, direntry.name); + const dirRes = collectSlugs(dirPath); + res.push(...dirRes); + } + } + + dir.closeSync(); + + return res; } module.exports = {