Skip to content

Commit a21833a

Browse files
committed
clean code.
1 parent 48b4411 commit a21833a

File tree

6 files changed

+38
-276
lines changed

6 files changed

+38
-276
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ __pycache__/
281281
generated/
282282
lib/
283283
inputfiles/browser.webidl.json
284-
.vscode
284+
.vscode/*
285+
!.vscode/launch.template.json
285286
package-lock.json
286287
yarn.lock

.vscode/launch.template.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Current TS File",
6+
"type": "node",
7+
"request": "launch",
8+
"args": [
9+
"${relativeFile}"
10+
],
11+
"runtimeArgs": [
12+
"--nolazy",
13+
"-r",
14+
"ts-node/register"
15+
],
16+
"sourceMaps": true,
17+
"cwd": "${workspaceRoot}",
18+
"protocol": "inspector",
19+
"console": "integratedTerminal",
20+
"internalConsoleOptions": "neverOpen",
21+
"env": {
22+
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.json"
23+
}
24+
}
25+
]
26+
}

manualAnalytics/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
All files in this folder aimes to be used by USER rather than CODE.
33

44
Users could have a quick view of some data.
5+
56
mdnDeprecatedApis.ts -- all api names marked as deprecated in `https://developer.mozilla.org/en-US/docs/Web/API`
6-
idlSourceAppearDeprecateText.ts -- check web pages in `inputfiles/idlSources.json`, to see whether there is text "deprecate".
7+
idlSourceAppearDeprecateText.ts -- check web pages in `inputfiles/idlSources.json`, to see whether there is text "deprecate" in the whole page.

manualAnalytics/idlSourceAppearDeprecateText.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@ async function fetchIDLs() {
1818
}
1919
await fetchIDL(source);
2020
})).then(
21-
()=>{
22-
console.log();
23-
console.log(deprecatedSet);
21+
() => {
22+
fs.writeFileSync(path.join(__dirname, 'idlSourcePossiable.json'), JSON.stringify(Array.from(deprecatedSet)));
2423
}
2524
);
2625
}
26+
// ['https://www.w3.org/TR/css-color-3/', 'https://www.w3.org/TR/credential-management-1/', 'https://www.w3.org/TR/css-text-decor-3/', 'https://w3c.github.io/media-playback-quality/', 'https://www.w3.org/TR/css-text-3/', 'https://drafts.csswg.org/css-images-3/', 'https://www.w3.org/TR/secure-contexts/', 'https://www.w3.org/TR/SVG2/types.html', 'https://html.spec.whatwg.org/multipage/obsolete.html', 'https://notifications.spec.whatwg.org/', 'https://www.w3.org/TR/SVG2/text.html', 'https://fetch.spec.whatwg.org/', 'https://html.spec.whatwg.org/multipage/webappapis.html', 'https://dom.spec.whatwg.org/', 'https://drafts.fxtf.org/css-masking-1/', 'https://www.w3.org/TR/filter-effects-1/', 'https://drafts.csswg.org/cssom/', 'https://w3c.github.io/webrtc-pc/', 'https://webaudio.github.io/web-audio-api/', 'https://heycam.github.io/webidl/', 'https://www.w3.org/TR/SVG2/pservers.html', 'https://www.w3.org/TR/uievents/']
2727

2828
const tmpLocalFolder = path.join(__dirname, "localIdlSource");
2929
const deprecatedSet = new Set<string>();
3030

31-
// ['https://www.w3.org/TR/css-color-3/', 'https://www.w3.org/TR/credential-management-1/', 'https://www.w3.org/TR/css-text-decor-3/', 'https://w3c.github.io/media-playback-quality/', 'https://www.w3.org/TR/css-text-3/', 'https://drafts.csswg.org/css-images-3/', 'https://www.w3.org/TR/secure-contexts/', 'https://www.w3.org/TR/SVG2/types.html', 'https://html.spec.whatwg.org/multipage/obsolete.html', 'https://notifications.spec.whatwg.org/', 'https://www.w3.org/TR/SVG2/text.html', 'https://fetch.spec.whatwg.org/', 'https://html.spec.whatwg.org/multipage/webappapis.html', 'https://dom.spec.whatwg.org/', 'https://drafts.fxtf.org/css-masking-1/', 'https://www.w3.org/TR/filter-effects-1/', 'https://drafts.csswg.org/cssom/', 'https://w3c.github.io/webrtc-pc/', 'https://webaudio.github.io/web-audio-api/', 'https://heycam.github.io/webidl/', 'https://www.w3.org/TR/SVG2/pservers.html', 'https://www.w3.org/TR/uievents/']
32-
3331
async function fetchIDL(source: IDLSource) {
3432

3533
if (!fs.existsSync(tmpLocalFolder)) {
@@ -50,7 +48,7 @@ async function fetchIDL(source: IDLSource) {
5048
webPageContent = await response.text();
5149
fs.writeFileSync(localFile, webPageContent);
5250
}
53-
if(webPageContent.toLowerCase().includes("deprecated")){
51+
if (webPageContent.toLowerCase().includes("deprecated")) {
5452
deprecatedSet.add(source.url);
5553
}
5654
// const dom = JSDOM.fragment(

manualAnalytics/mdnDeprecatedApis.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const mdnDeprecatedObsoleteApisReasonFile = path.join(outputFolder, "mdnDeprecat
1010

1111
const mdnApiWeb = "https://developer.mozilla.org/en-US/docs/Web/API"
1212

13-
async function fetchInterfaceDescriptions() {
13+
async function getDeprecatedObsoleteApiNames() {
1414
const fragment = await fetchDom(mdnApiWeb);
1515
const InterfacesSelector = '#wikiArticle > div:nth-child(8)';
1616

@@ -47,8 +47,8 @@ async function fetchInterfaceDescriptions() {
4747
fs.writeFileSync(mdnDeprecatedObsoleteApisFile, JSON.stringify({ deprecatedAPIs, obsoleteAPIs }));
4848
}
4949

50-
async function fetchDeprecatedApiReasons() {
51-
await fetchInterfaceDescriptions();
50+
async function getDeprecatedObsoleteApiReasons() {
51+
await getDeprecatedObsoleteApiNames();
5252
const data = require(mdnDeprecatedObsoleteApisFile);
5353
const deprecatedAPIArray: string[] = data.deprecatedAPIs;
5454
const obsoleteAPIArray: string[] = data.obsoleteAPIs;
@@ -103,4 +103,4 @@ async function fetchDom(url: string) {
103103
return JSDOM.fragment(responseString);
104104
}
105105

106-
fetchDeprecatedApiReasons();
106+
getDeprecatedObsoleteApiReasons();

src/tmp.ts

Lines changed: 0 additions & 264 deletions
This file was deleted.

0 commit comments

Comments
 (0)