From b542aabc0ecc68a619b818861cf33b1f89f2b1e9 Mon Sep 17 00:00:00 2001 From: ota Date: Wed, 13 May 2020 14:55:13 +0900 Subject: [PATCH 1/8] Add update-resources script --- lib/utils/deprecated-html-elements.json | 8 +- lib/utils/html-elements.json | 162 +++++++++--------- lib/utils/svg-elements.json | 6 - .../lib/rules/no-reserved-component-names.js | 4 - tools/lib/http.js | 6 + tools/update-resources.js | 120 +++++++++++++ tools/update-vue3-export-names.js | 33 +--- tools/update.js | 1 + 8 files changed, 209 insertions(+), 131 deletions(-) create mode 100644 tools/lib/http.js create mode 100644 tools/update-resources.js diff --git a/lib/utils/deprecated-html-elements.json b/lib/utils/deprecated-html-elements.json index 1d9d67968..63a3f7162 100644 --- a/lib/utils/deprecated-html-elements.json +++ b/lib/utils/deprecated-html-elements.json @@ -6,14 +6,10 @@ "big", "blink", "center", - "command", - "content", "dir", - "element", "font", "frame", "frameset", - "image", "isindex", "keygen", "listing", @@ -24,8 +20,10 @@ "nobr", "noembed", "noframes", + "param", "plaintext", - "shadow", + "rb", + "rtc", "spacer", "strike", "tt", diff --git a/lib/utils/html-elements.json b/lib/utils/html-elements.json index 6911e3482..7647725fc 100644 --- a/lib/utils/html-elements.json +++ b/lib/utils/html-elements.json @@ -1,120 +1,114 @@ [ - "html", - "body", - "base", - "head", - "link", - "meta", - "style", - "title", + "a", + "abbr", "address", + "area", "article", "aside", + "audio", + "b", + "base", + "bdi", + "bdo", + "blockquote", + "body", + "br", + "button", + "canvas", + "caption", + "cite", + "code", + "col", + "colgroup", + "data", + "datalist", + "dd", + "del", + "details", + "dfn", + "dialog", + "div", + "dl", + "dt", + "em", + "embed", + "fieldset", + "figcaption", + "figure", "footer", - "header", + "form", "h1", "h2", "h3", "h4", "h5", "h6", + "head", + "header", "hgroup", - "nav", - "section", - "div", - "dd", - "dl", - "dt", - "figcaption", - "figure", "hr", + "html", + "i", + "iframe", "img", + "input", + "ins", + "kbd", + "label", + "legend", "li", + "link", "main", + "map", + "mark", + "menu", + "meta", + "meter", + "nav", + "noscript", + "object", "ol", + "optgroup", + "option", + "output", "p", + "picture", "pre", - "ul", - "a", - "b", - "abbr", - "bdi", - "bdo", - "br", - "cite", - "code", - "data", - "dfn", - "em", - "i", - "kbd", - "mark", + "progress", "q", "rp", "rt", - "rtc", "ruby", "s", "samp", + "script", + "search", + "section", + "select", + "slot", "small", + "source", "span", "strong", + "style", "sub", + "summary", "sup", - "time", - "u", - "var", - "wbr", - "area", - "audio", - "map", - "track", - "video", - "embed", - "object", - "param", - "source", - "canvas", - "script", - "noscript", - "del", - "ins", - "caption", - "col", - "colgroup", "table", - "thead", "tbody", - "tfoot", "td", + "template", + "textarea", + "tfoot", "th", + "thead", + "time", + "title", "tr", - "button", - "datalist", - "fieldset", - "form", - "input", - "label", - "legend", - "meter", - "optgroup", - "option", - "output", - "progress", - "select", - "textarea", - "details", - "dialog", - "menu", - "menuitem", - "summary", - "content", - "element", - "shadow", - "template", - "slot", - "blockquote", - "iframe", - "noframes", - "picture" + "track", + "u", + "ul", + "var", + "video", + "wbr" ] diff --git a/lib/utils/svg-elements.json b/lib/utils/svg-elements.json index 7e5ba6052..f214aad24 100644 --- a/lib/utils/svg-elements.json +++ b/lib/utils/svg-elements.json @@ -3,13 +3,10 @@ "animate", "animateMotion", "animateTransform", - "audio", - "canvas", "circle", "clipPath", "defs", "desc", - "discard", "ellipse", "feBlend", "feColorMatrix", @@ -39,7 +36,6 @@ "filter", "foreignObject", "g", - "iframe", "image", "line", "linearGradient", @@ -64,8 +60,6 @@ "textPath", "title", "tspan", - "unknown", "use", - "video", "view" ] diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js index 231e1f98d..35568047e 100644 --- a/tests/lib/rules/no-reserved-component-names.js +++ b/tests/lib/rules/no-reserved-component-names.js @@ -278,8 +278,6 @@ const invalidElements = [ 'Defs', 'desc', 'Desc', - 'discard', - 'Discard', 'ellipse', 'Ellipse', 'feBlend', @@ -351,8 +349,6 @@ const invalidElements = [ 'textPath', 'tspan', 'Tspan', - 'unknown', - 'Unknown', 'use', 'Use', 'view', diff --git a/tools/lib/http.js b/tools/lib/http.js new file mode 100644 index 000000000..27ff970f4 --- /dev/null +++ b/tools/lib/http.js @@ -0,0 +1,6 @@ +module.exports = { + httpGet +} +function httpGet(url) { + return fetch(url).then((res) => res.text()) +} diff --git a/tools/update-resources.js b/tools/update-resources.js new file mode 100644 index 000000000..2b62268d3 --- /dev/null +++ b/tools/update-resources.js @@ -0,0 +1,120 @@ +'use strict' + +const fs = require('fs') +const tsParser = require('@typescript-eslint/parser') +const { httpGet } = require('./lib/http') + +/** + * @typedef {import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration} TSInterfaceDeclaration + */ + +main() + +async function main() { + const libDomDTsText = await httpGet( + 'https://unpkg.com/typescript/lib/lib.dom.d.ts' + ) + const rootNode = tsParser.parse(libDomDTsText, { + loc: true, + range: true + }) + updateDeprecatedHTMLElements() + updateHTMLElements() + updateSVGElements() + + // ------------------------------------------------------------------------------ + // Update deprecated-html-elements.json + // ------------------------------------------------------------------------------ + function updateDeprecatedHTMLElements() { + const DEPRECATED_HTML_ELEMENTS_PATH = require.resolve( + '../lib/utils/deprecated-html-elements.json' + ) + const elements = new Set() + /** @type {TSInterfaceDeclaration} */ + const interfaceDeclaration = rootNode.body.find( + (body) => + body.type === 'TSInterfaceDeclaration' && + body.id.name === 'HTMLElementDeprecatedTagNameMap' + ) + + for (const name of extractPropNames(interfaceDeclaration)) { + elements.add(name) + } + + fs.writeFileSync( + DEPRECATED_HTML_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } + + // ------------------------------------------------------------------------------ + // Update html-elements.json + // ------------------------------------------------------------------------------ + function updateHTMLElements() { + const HTML_ELEMENTS_PATH = require.resolve( + '../lib/utils/html-elements.json' + ) + const elements = new Set() + const deprecatedHtmlElements = new Set( + require('../lib/utils/deprecated-html-elements.json') + ) + /** @type {TSInterfaceDeclaration} */ + const interfaceDeclaration = rootNode.body.find( + (body) => + body.type === 'TSInterfaceDeclaration' && + body.id.name === 'HTMLElementTagNameMap' + ) + + for (const name of extractPropNames(interfaceDeclaration)) { + if (deprecatedHtmlElements.has(name)) { + continue + } + elements.add(name) + } + + fs.writeFileSync( + HTML_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } + + // ------------------------------------------------------------------------------ + // Update svg-elements.json + // ------------------------------------------------------------------------------ + function updateSVGElements() { + const SVG_ELEMENTS_PATH = require.resolve('../lib/utils/svg-elements.json') + const elements = new Set() + /** @type {TSInterfaceDeclaration} */ + const interfaceDeclaration = rootNode.body.find( + (body) => + body.type === 'TSInterfaceDeclaration' && + body.id.name === 'SVGElementTagNameMap' + ) + + for (const name of extractPropNames(interfaceDeclaration)) { + elements.add(name) + } + + fs.writeFileSync( + SVG_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } +} + +/** + * @param {TSInterfaceDeclaration} node + */ +function* extractPropNames(node) { + for (const m of node.body.body) { + if ( + (m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') && + (m.key.type === 'Identifier' || m.key.type === 'Literal') + ) { + yield m.key.type === 'Identifier' ? m.key.name : `${m.key.value}` + } + } +} diff --git a/tools/update-vue3-export-names.js b/tools/update-vue3-export-names.js index 37e07e03d..0dabecb3a 100644 --- a/tools/update-vue3-export-names.js +++ b/tools/update-vue3-export-names.js @@ -6,9 +6,8 @@ const fs = require('fs') const path = require('path') -const https = require('https') -const { URL } = require('url') const tsParser = require('@typescript-eslint/parser') +const { httpGet } = require('./lib/http') main() @@ -144,33 +143,3 @@ async function resolveTypeContents(m) { } return await httpGet(`https://unpkg.com/${m}/${typesPath}`) } - -function httpGet(url) { - return new Promise((resolve, reject) => { - let result = '' - https - .get(url, (res) => { - if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400) { - // redirect - let redirectUrl = res.headers.location - if (!redirectUrl.startsWith('http')) { - const baseUrl = new URL(url) - baseUrl.pathname = redirectUrl - redirectUrl = String(baseUrl) - } - res.destroy() - resolve(httpGet(redirectUrl)) - return - } - res.setEncoding('utf8') - res.on('data', (chunk) => { - result += String(chunk) - }) - res.on('end', () => { - resolve(result) - }) - res.on('error', reject) - }) - .on('error', reject) - }) -} diff --git a/tools/update.js b/tools/update.js index de792d507..396f7b558 100644 --- a/tools/update.js +++ b/tools/update.js @@ -11,6 +11,7 @@ require('./update-lib-flat-configs') require('./update-lib-index') require('./update-docs') require('./update-docs-rules-index') +require('./update-resources') if (process.env.IN_VERSION_SCRIPT) { require('./update-vue3-export-names') From 348d0aa64e86fe5643fe3420a21a2548621948fb Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Sun, 14 May 2023 14:37:53 +0900 Subject: [PATCH 2/8] fix --- tests/lib/rules/no-reserved-component-names.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js index 35568047e..809d35103 100644 --- a/tests/lib/rules/no-reserved-component-names.js +++ b/tests/lib/rules/no-reserved-component-names.js @@ -247,12 +247,6 @@ const invalidElements = [ 'menuitem', 'summary', 'Summary', - 'content', - 'Content', - 'element', - 'Element', - 'shadow', - 'Shadow', 'template', 'Template', 'slot', @@ -369,8 +363,6 @@ const invalidElements = [ 'Blink', 'center', 'Center', - 'command', - 'Command', 'dir', 'Dir', 'font', From bde92f7b1dd71b8dfe3b11bf25ef992a97d78eef Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 17 May 2023 09:39:38 +0900 Subject: [PATCH 3/8] change data acquisition source --- lib/utils/html-elements.json | 2 + package.json | 1 + .../lib/rules/no-reserved-component-names.js | 2 + tools/update-resources.js | 79 ++++++++----------- tools/update.js | 2 +- 5 files changed, 38 insertions(+), 48 deletions(-) diff --git a/lib/utils/html-elements.json b/lib/utils/html-elements.json index 7647725fc..829b6f841 100644 --- a/lib/utils/html-elements.json +++ b/lib/utils/html-elements.json @@ -32,6 +32,7 @@ "dt", "em", "embed", + "fencedframe", "fieldset", "figcaption", "figure", @@ -73,6 +74,7 @@ "output", "p", "picture", + "portal", "pre", "progress", "q", diff --git a/package.json b/package.json index 18d136ea5..56930f638 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "eslint-plugin-vue": "file:.", "espree": "^9.6.1", "events": "^3.3.0", + "jsdom": "^22.0.0", "markdownlint-cli": "^0.42.0", "mocha": "^10.7.3", "nyc": "^17.1.0", diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js index 809d35103..a9f727908 100644 --- a/tests/lib/rules/no-reserved-component-names.js +++ b/tests/lib/rules/no-reserved-component-names.js @@ -272,6 +272,8 @@ const invalidElements = [ 'Defs', 'desc', 'Desc', + 'discard', + 'Discard', 'ellipse', 'Ellipse', 'feBlend', diff --git a/tools/update-resources.js b/tools/update-resources.js index 2b62268d3..fcbdacbb0 100644 --- a/tools/update-resources.js +++ b/tools/update-resources.js @@ -1,23 +1,18 @@ 'use strict' const fs = require('fs') -const tsParser = require('@typescript-eslint/parser') +const jsdom = require('jsdom') const { httpGet } = require('./lib/http') -/** - * @typedef {import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration} TSInterfaceDeclaration - */ - main() async function main() { - const libDomDTsText = await httpGet( - 'https://unpkg.com/typescript/lib/lib.dom.d.ts' - ) - const rootNode = tsParser.parse(libDomDTsText, { - loc: true, - range: true - }) + const [bcdJson, obsoleteHtml] = await Promise.all([ + httpGet('https://unpkg.com/@mdn/browser-compat-data/data.json'), + httpGet('https://html.spec.whatwg.org/multipage/obsolete.html') + ]) + const bcd = JSON.parse(bcdJson) + updateDeprecatedHTMLElements() updateHTMLElements() updateSVGElements() @@ -30,15 +25,17 @@ async function main() { '../lib/utils/deprecated-html-elements.json' ) const elements = new Set() - /** @type {TSInterfaceDeclaration} */ - const interfaceDeclaration = rootNode.body.find( - (body) => - body.type === 'TSInterfaceDeclaration' && - body.id.name === 'HTMLElementDeprecatedTagNameMap' + + const domDl = jsdom.JSDOM.fragment(obsoleteHtml).querySelector( + '[id="non-conforming-features"] ~ dl' ) + for (const code of domDl.querySelectorAll('dt code')) { + const name = code.textContent.trim() + if (name) elements.add(name) + } - for (const name of extractPropNames(interfaceDeclaration)) { - elements.add(name) + if (elements.size === 0) { + throw new Error('No deprecated HTML elements found') } fs.writeFileSync( @@ -59,20 +56,21 @@ async function main() { const deprecatedHtmlElements = new Set( require('../lib/utils/deprecated-html-elements.json') ) - /** @type {TSInterfaceDeclaration} */ - const interfaceDeclaration = rootNode.body.find( - (body) => - body.type === 'TSInterfaceDeclaration' && - body.id.name === 'HTMLElementTagNameMap' - ) - for (const name of extractPropNames(interfaceDeclaration)) { + for (const [name, element] of Object.entries(bcd.html.elements)) { if (deprecatedHtmlElements.has(name)) { continue } + if (element.__compat.status.deprecated) { + continue + } elements.add(name) } + if (elements.size === 0) { + throw new Error('No HTML elements found') + } + fs.writeFileSync( HTML_ELEMENTS_PATH, `${JSON.stringify([...elements].sort(), null, 2)}\n`, @@ -86,17 +84,18 @@ async function main() { function updateSVGElements() { const SVG_ELEMENTS_PATH = require.resolve('../lib/utils/svg-elements.json') const elements = new Set() - /** @type {TSInterfaceDeclaration} */ - const interfaceDeclaration = rootNode.body.find( - (body) => - body.type === 'TSInterfaceDeclaration' && - body.id.name === 'SVGElementTagNameMap' - ) - for (const name of extractPropNames(interfaceDeclaration)) { + for (const [name, element] of Object.entries(bcd.svg.elements)) { + if (element.__compat.status.deprecated) { + continue + } elements.add(name) } + if (elements.size === 0) { + throw new Error('No SVG elements found') + } + fs.writeFileSync( SVG_ELEMENTS_PATH, `${JSON.stringify([...elements].sort(), null, 2)}\n`, @@ -104,17 +103,3 @@ async function main() { ) } } - -/** - * @param {TSInterfaceDeclaration} node - */ -function* extractPropNames(node) { - for (const m of node.body.body) { - if ( - (m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') && - (m.key.type === 'Identifier' || m.key.type === 'Literal') - ) { - yield m.key.type === 'Identifier' ? m.key.name : `${m.key.value}` - } - } -} diff --git a/tools/update.js b/tools/update.js index 396f7b558..941930a0e 100644 --- a/tools/update.js +++ b/tools/update.js @@ -11,8 +11,8 @@ require('./update-lib-flat-configs') require('./update-lib-index') require('./update-docs') require('./update-docs-rules-index') -require('./update-resources') if (process.env.IN_VERSION_SCRIPT) { require('./update-vue3-export-names') + require('./update-resources') } From 6f52353ed177a8c626b1f11dde333d05e7ffd1d7 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 25 May 2023 09:10:10 +0900 Subject: [PATCH 4/8] add workflow that checks for resource updates and remove auto updating resources --- .../workflows/check-for-resources-update.yml | 23 ++++ package.json | 1 + tools/update-html-resources.js | 105 ++++++++++++++++++ tools/update-resources.js | 105 +----------------- tools/update.js | 5 - 5 files changed, 131 insertions(+), 108 deletions(-) create mode 100644 .github/workflows/check-for-resources-update.yml create mode 100644 tools/update-html-resources.js diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml new file mode 100644 index 000000000..b8ccece6d --- /dev/null +++ b/.github/workflows/check-for-resources-update.yml @@ -0,0 +1,23 @@ +name: Check for utils resources update +on: + schedule: + - cron: 0 0 * * 0 + +jobs: + check-for-resources-update: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install Packages + run: npm install + - name: Update + run: npm run update-resources + - name: Check changes + run: | + git add --all && \ + git diff-index --cached HEAD --stat --exit-code diff --git a/package.json b/package.json index 56930f638..b56cdb90d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "preversion": "npm test && git add .", "version": "env-cmd -e version npm run update && npm run lint -- --fix && git add .", "update": "node ./tools/update.js", + "update-resources": "node ./tools/update-resources.js", "docs:watch": "vitepress dev docs", "predocs:build": "npm run update", "docs:build": "vitepress build docs" diff --git a/tools/update-html-resources.js b/tools/update-html-resources.js new file mode 100644 index 000000000..fcbdacbb0 --- /dev/null +++ b/tools/update-html-resources.js @@ -0,0 +1,105 @@ +'use strict' + +const fs = require('fs') +const jsdom = require('jsdom') +const { httpGet } = require('./lib/http') + +main() + +async function main() { + const [bcdJson, obsoleteHtml] = await Promise.all([ + httpGet('https://unpkg.com/@mdn/browser-compat-data/data.json'), + httpGet('https://html.spec.whatwg.org/multipage/obsolete.html') + ]) + const bcd = JSON.parse(bcdJson) + + updateDeprecatedHTMLElements() + updateHTMLElements() + updateSVGElements() + + // ------------------------------------------------------------------------------ + // Update deprecated-html-elements.json + // ------------------------------------------------------------------------------ + function updateDeprecatedHTMLElements() { + const DEPRECATED_HTML_ELEMENTS_PATH = require.resolve( + '../lib/utils/deprecated-html-elements.json' + ) + const elements = new Set() + + const domDl = jsdom.JSDOM.fragment(obsoleteHtml).querySelector( + '[id="non-conforming-features"] ~ dl' + ) + for (const code of domDl.querySelectorAll('dt code')) { + const name = code.textContent.trim() + if (name) elements.add(name) + } + + if (elements.size === 0) { + throw new Error('No deprecated HTML elements found') + } + + fs.writeFileSync( + DEPRECATED_HTML_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } + + // ------------------------------------------------------------------------------ + // Update html-elements.json + // ------------------------------------------------------------------------------ + function updateHTMLElements() { + const HTML_ELEMENTS_PATH = require.resolve( + '../lib/utils/html-elements.json' + ) + const elements = new Set() + const deprecatedHtmlElements = new Set( + require('../lib/utils/deprecated-html-elements.json') + ) + + for (const [name, element] of Object.entries(bcd.html.elements)) { + if (deprecatedHtmlElements.has(name)) { + continue + } + if (element.__compat.status.deprecated) { + continue + } + elements.add(name) + } + + if (elements.size === 0) { + throw new Error('No HTML elements found') + } + + fs.writeFileSync( + HTML_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } + + // ------------------------------------------------------------------------------ + // Update svg-elements.json + // ------------------------------------------------------------------------------ + function updateSVGElements() { + const SVG_ELEMENTS_PATH = require.resolve('../lib/utils/svg-elements.json') + const elements = new Set() + + for (const [name, element] of Object.entries(bcd.svg.elements)) { + if (element.__compat.status.deprecated) { + continue + } + elements.add(name) + } + + if (elements.size === 0) { + throw new Error('No SVG elements found') + } + + fs.writeFileSync( + SVG_ELEMENTS_PATH, + `${JSON.stringify([...elements].sort(), null, 2)}\n`, + 'utf8' + ) + } +} diff --git a/tools/update-resources.js b/tools/update-resources.js index fcbdacbb0..a157c61ef 100644 --- a/tools/update-resources.js +++ b/tools/update-resources.js @@ -1,105 +1,4 @@ 'use strict' -const fs = require('fs') -const jsdom = require('jsdom') -const { httpGet } = require('./lib/http') - -main() - -async function main() { - const [bcdJson, obsoleteHtml] = await Promise.all([ - httpGet('https://unpkg.com/@mdn/browser-compat-data/data.json'), - httpGet('https://html.spec.whatwg.org/multipage/obsolete.html') - ]) - const bcd = JSON.parse(bcdJson) - - updateDeprecatedHTMLElements() - updateHTMLElements() - updateSVGElements() - - // ------------------------------------------------------------------------------ - // Update deprecated-html-elements.json - // ------------------------------------------------------------------------------ - function updateDeprecatedHTMLElements() { - const DEPRECATED_HTML_ELEMENTS_PATH = require.resolve( - '../lib/utils/deprecated-html-elements.json' - ) - const elements = new Set() - - const domDl = jsdom.JSDOM.fragment(obsoleteHtml).querySelector( - '[id="non-conforming-features"] ~ dl' - ) - for (const code of domDl.querySelectorAll('dt code')) { - const name = code.textContent.trim() - if (name) elements.add(name) - } - - if (elements.size === 0) { - throw new Error('No deprecated HTML elements found') - } - - fs.writeFileSync( - DEPRECATED_HTML_ELEMENTS_PATH, - `${JSON.stringify([...elements].sort(), null, 2)}\n`, - 'utf8' - ) - } - - // ------------------------------------------------------------------------------ - // Update html-elements.json - // ------------------------------------------------------------------------------ - function updateHTMLElements() { - const HTML_ELEMENTS_PATH = require.resolve( - '../lib/utils/html-elements.json' - ) - const elements = new Set() - const deprecatedHtmlElements = new Set( - require('../lib/utils/deprecated-html-elements.json') - ) - - for (const [name, element] of Object.entries(bcd.html.elements)) { - if (deprecatedHtmlElements.has(name)) { - continue - } - if (element.__compat.status.deprecated) { - continue - } - elements.add(name) - } - - if (elements.size === 0) { - throw new Error('No HTML elements found') - } - - fs.writeFileSync( - HTML_ELEMENTS_PATH, - `${JSON.stringify([...elements].sort(), null, 2)}\n`, - 'utf8' - ) - } - - // ------------------------------------------------------------------------------ - // Update svg-elements.json - // ------------------------------------------------------------------------------ - function updateSVGElements() { - const SVG_ELEMENTS_PATH = require.resolve('../lib/utils/svg-elements.json') - const elements = new Set() - - for (const [name, element] of Object.entries(bcd.svg.elements)) { - if (element.__compat.status.deprecated) { - continue - } - elements.add(name) - } - - if (elements.size === 0) { - throw new Error('No SVG elements found') - } - - fs.writeFileSync( - SVG_ELEMENTS_PATH, - `${JSON.stringify([...elements].sort(), null, 2)}\n`, - 'utf8' - ) - } -} +require('./update-vue3-export-names') +require('./update-html-resources') diff --git a/tools/update.js b/tools/update.js index 941930a0e..64da1be1b 100644 --- a/tools/update.js +++ b/tools/update.js @@ -11,8 +11,3 @@ require('./update-lib-flat-configs') require('./update-lib-index') require('./update-docs') require('./update-docs-rules-index') - -if (process.env.IN_VERSION_SCRIPT) { - require('./update-vue3-export-names') - require('./update-resources') -} From 0e98ca1440783cbed68950a6e06673cc8e70257c Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Thu, 25 May 2023 09:12:53 +0900 Subject: [PATCH 5/8] fix test case --- tests/lib/rules/no-reserved-component-names.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js index a9f727908..809d35103 100644 --- a/tests/lib/rules/no-reserved-component-names.js +++ b/tests/lib/rules/no-reserved-component-names.js @@ -272,8 +272,6 @@ const invalidElements = [ 'Defs', 'desc', 'Desc', - 'discard', - 'Discard', 'ellipse', 'Ellipse', 'feBlend', From d28c87336d896c35aa5a005898fe9be74506d32c Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Tue, 30 May 2023 18:15:31 +0900 Subject: [PATCH 6/8] Update .github/workflows/check-for-resources-update.yml Co-authored-by: Flo Edelmann --- .github/workflows/check-for-resources-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml index b8ccece6d..9ffcadfa7 100644 --- a/.github/workflows/check-for-resources-update.yml +++ b/.github/workflows/check-for-resources-update.yml @@ -1,7 +1,7 @@ name: Check for utils resources update on: schedule: - - cron: 0 0 * * 0 + - cron: 0 0 * * 0 # At 00:00 on Sunday, see https://crontab.guru/#0_0_*_*_0 jobs: check-for-resources-update: From 72a12799576a3ce41619717102ec37d74f048f1c Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Sat, 30 Nov 2024 14:39:50 +0900 Subject: [PATCH 7/8] update git hub action --- .github/workflows/check-for-resources-update.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml index 9ffcadfa7..f95a8aa82 100644 --- a/.github/workflows/check-for-resources-update.yml +++ b/.github/workflows/check-for-resources-update.yml @@ -1,8 +1,13 @@ name: Check for utils resources update on: + workflow_dispatch: null schedule: - cron: 0 0 * * 0 # At 00:00 on Sunday, see https://crontab.guru/#0_0_*_*_0 +permissions: + contents: write + pull-requests: write + jobs: check-for-resources-update: runs-on: ubuntu-latest @@ -17,7 +22,9 @@ jobs: run: npm install - name: Update run: npm run update-resources - - name: Check changes - run: | - git add --all && \ - git diff-index --cached HEAD --stat --exit-code + - uses: peter-evans/create-pull-request@v7 + with: + commit-message: Updates resources with latest + branch: update-unicode-alias + branch-suffix: timestamp + title: Updates resources with latest From 3c709a19c3614a3f24476277299610bf67010619 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Mon, 2 Dec 2024 06:42:53 +0900 Subject: [PATCH 8/8] Update .github/workflows/check-for-resources-update.yml Co-authored-by: Flo Edelmann --- .github/workflows/check-for-resources-update.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml index f95a8aa82..a9b2460e8 100644 --- a/.github/workflows/check-for-resources-update.yml +++ b/.github/workflows/check-for-resources-update.yml @@ -24,7 +24,7 @@ jobs: run: npm run update-resources - uses: peter-evans/create-pull-request@v7 with: - commit-message: Updates resources with latest - branch: update-unicode-alias + commit-message: Updates resources + branch: update-resources branch-suffix: timestamp - title: Updates resources with latest + title: Updates resources