diff --git a/.eleventy.js b/.eleventy.js deleted file mode 100644 index 0a148affcc..0000000000 --- a/.eleventy.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = (eleventyConfig) => { - eleventyConfig.addPassthroughCopy('pages/styles/protocol.css'); - eleventyConfig.addPassthroughCopy('pages/images/'); - eleventyConfig.addPassthroughCopy('search_index/'); - eleventyConfig.addPassthroughCopy('.nojekyll'); - eleventyConfig.addPassthroughCopy('pages/service-worker.js'); - - return { - pathPrefix: '/devtools-protocol/', - dir: { - input: 'pages', - output: 'devtools-protocol', - data: '_data', - }, - }; -}; \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index cd2b23b2ef..739163bff1 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,5 +8,4 @@ ### What is the expected result? - ### What happens instead of that? diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20450fc64b..8a1b982f75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,33 +2,29 @@ name: 😎 on: pull_request: push: - branches: + branches: - master -jobs: - lighthouse_ci: +permissions: + contents: read +jobs: + build_test: runs-on: ubuntu-latest + permissions: + contents: read steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: git clone - uses: actions/checkout@v1 - - - name: setup node.js - uses: actions/setup-node@c6fd00c + - name: Set up Node.js + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: - node-version: 10.x + node-version-file: '.nvmrc' + cache: npm - - name: build - run: npm i && npm run build + - run: npm ci + - run: npm run build - - name: install lhci - run: npm install @lhci/cli@latest - - - name: run lhci - run: | - npx lhci autorun \ - --collect.url=http://localhost:8696/devtools-protocol/ \ - --collect.url=http://localhost:8696/devtools-protocol/tot/Page/ \ - --upload.token=${{ secrets.LHCI_SERVER_TOKEN }} \ - --upload.serverBaseUrl=https://lhci-canary.herokuapp.com/ + - name: preflight + run: npm run preflight diff --git a/.gitignore b/.gitignore index 23bf06aa7f..635f8c07d0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ devtools-protocol/ .jekyll-metadata node_modules/ +.DS_Store diff --git a/.lighthouserc.js b/.lighthouserc.js deleted file mode 100644 index 4d2a099516..0000000000 --- a/.lighthouserc.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -module.exports = { - ci: { - collect: { - numberOfRuns: 3, // ignored due to https://github.com/treosh/lighthouse-ci-action/issues/48 - startServerCommand: "npm run serve", - startServerReadyPattern: "Served by", - }, - assert: { - preset: "lighthouse:no-pwa", - "assertions": { - // TODO(paulirish): fix these - "color-contrast": "warn", - "unsized-images": "warn", - "cumulative-layout-shift": "warn", - "render-blocking-resources": "warn", - "uses-long-cache-ttl": "warn", - "tap-targets": "warn", - "dom-size": "warn" - } - } - }, -}; diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..feba135270 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +package-lock=true +registry=https://registry.npmjs.org/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24 diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000000..cee34fc1a6 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "ignorePatterns": ["data/**", "devtools-protocol/**", "node_modules/**"] +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000000..dc03ff28b2 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,24 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript", "unicorn", "oxc"], + "categories": { + "correctness": "error" + }, + "env": { + "node": true, + "browser": true, + "builtin": true + }, + + "ignorePatterns": ["data/**", "devtools-protocol/**", "node_modules/**"], + "rules": { + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^.*$" + } + ] + } +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..beddc4ffd4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "search.exclude": { + "devtools-protocol/**": true + } +} diff --git a/create-search-index.js b/create-search-index.js deleted file mode 100644 index caac650cda..0000000000 --- a/create-search-index.js +++ /dev/null @@ -1,143 +0,0 @@ -'use strict'; - -/** - * Utility command that creates the search index for pages/_data/?.json. - */ - -const fs = require('fs'); -const VERSIONS_FILE = 'pages/_data/versions.json'; - -const versionsText = fs.readFileSync(VERSIONS_FILE); -const versions = JSON.parse(versionsText); - -versions.forEach(generateSearchIndex); - -function generateSearchIndex(version) { - const protocolText = fs.readFileSync(`pages/_data/${version.slug}.json`); - const protocol = JSON.parse(protocolText); - - // Set up Keyword bank - // Split up search keywords into primary and secondary matches. - // Primary kewords - event, domain, command names; plus type ids. - // Secondary keywords - command parameter names, event parameter names, type - // properties. - // Reasoning: Primary keyword matches will appear at the top of the search - // result list, while secondary matches, which are likely to have duplicates, - // will appear at the bottom. - - var PageRefType = { - DOMAIN: '0', - EVENT: '1', - PARAM: '2', - TYPE_ID: '3', - COMMAND: '4' - }; - // Optional root path to be prepended to page reference URLs. - var SITE_ROOT = ''; - var MAX_DESCRIPTION_LENGTH = 200; - - function getShortDescription(description) { - return description && description.length > MAX_DESCRIPTION_LENGTH ? - description.substr(0, MAX_DESCRIPTION_LENGTH) + '...' : description; - } - - // Represents a page reference. - var PageReference = { - init: function(domain, type, description) { - this.domain = domain; - this.type = type; - this.description = description - }, - createPageReference: function(title, type, description) { - var ref = Object.create(PageReference); - ref.init(title, type, getShortDescription(description)); - return ref; - }, - setHrefs: function(href, domainHref) { - this.domainHref = domainHref; - if (href) { - this.href = href; - } - } - }; - - // Represents a keyword match, which may have many page references. - var KeyRecord = { - init: function(keyword) { - this.keyword = keyword; - this.pageReferences = []; - }, - addReference: function(pageRef) { - this.pageReferences.push(pageRef); - }, - createKeyRecord: function(keyword, opt_pageRef) { - var keyRecord = Object.create(KeyRecord); - keyRecord.init(keyword); - if (opt_pageRef) { - keyRecord.addReference(opt_pageRef); - } - return keyRecord; - } - }; - - // Used to store our key records. - var keywordMap = { - // Lazily creates a KeyRecord. - addReferenceForKey: function(keyword, pageRef) { - const key = keyword.toLowerCase(); - var record = this[key]; - if (record) { - record.addReference(pageRef); - } else { - this[key] = KeyRecord.createKeyRecord(keyword, pageRef); - } - } - }; - - (protocol.domains).forEach(function (domain, idx) { - var domainName = domain.domain; - var domainPath = SITE_ROOT + version.slug + '/' + domainName + '/'; - // Reminder: You may have multiple pages per keyword. - // Store domain name as a page reference under itself as a keyword. - var ref = PageReference.createPageReference( - domainName, PageRefType.DOMAIN, domain.description); - ref.setHrefs('', domainPath); - keywordMap.addReferenceForKey(domainName, ref); - - if (domain.commands) { - domain.commands.forEach(function(command) { - var commandName = command.name; - var commandNameHref = '#method-' + commandName; - var ref = PageReference.createPageReference( - domainName, PageRefType.COMMAND, command.description); - ref.setHrefs(commandNameHref, domainPath); - keywordMap.addReferenceForKey(`${domainName}.${commandName}`, ref); - }); - } - if (domain.events) { - domain.events.forEach(function(event) { - var eventName = event.name; - var eventNameHref = '#event-' + eventName; - var ref = PageReference.createPageReference( - domainName, PageRefType.EVENT, event.description); - ref.setHrefs(eventNameHref, domainPath); - keywordMap.addReferenceForKey(`${domainName}.${eventName}`, ref); - }); - } - if (domain.types) { - domain.types.forEach(function(type) { - var typeName = type.id; - var typeNameHref = '#type-' + typeName; - var ref = PageReference.createPageReference( - domainName, PageRefType.TYPE_ID, type.description); - ref.setHrefs(typeNameHref, domainPath); - keywordMap.addReferenceForKey(`${domainName}.${typeName}`, ref); - }); - } - // TODO(ericguzman): Index other keyword types. - }); - - const fileName = `search_index/${version.slug}.json`; - const content = JSON.stringify(keywordMap); - fs.writeFileSync(fileName, content); -} diff --git a/pages/_data/tot.json b/data/tot.json similarity index 66% rename from pages/_data/tot.json rename to data/tot.json index 28834ee90e..5f6598b157 100644 --- a/pages/_data/tot.json +++ b/data/tot.json @@ -54,6 +54,7 @@ "description": "Enum of possible native property sources (as a subtype of a particular AXValueSourceType).", "type": "string", "enum": [ + "description", "figcaption", "label", "labelfor", @@ -101,7 +102,7 @@ }, { "name": "nativeSource", - "description": "The native markup source for this value, e.g. a