Skip to content

Commit f9df06a

Browse files
authored
chore: refacto flags struct + generateFlags (#9)
1 parent c27839a commit f9df06a

20 files changed

+60
-60
lines changed

FLAGS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Under the hood we use the npm package [is-minified-code](https://github.com/Mart
9393
Files can be found in the **Minified Files** list items of the left menu.
9494

9595

96-
![](https://i.imgur.com/e8BbBeb.png)</details> <details><summary>👀 hasMissingOrUnusedDependency</summary>
96+
![](https://i.imgur.com/e8BbBeb.png)</details><details><summary>👀 hasMissingOrUnusedDependency</summary>
9797

9898
The package has a missing dependency (in package.json) or a dependency that is not used in the code (this may happen if the AST Analysis fail!)
9999

@@ -171,7 +171,7 @@ For more information on deprecation please check the official [npm documentation
171171
Indicate that the package is **also used somewhere else in the dependency tree** but with a different version (like in the screenshot with **yallist**).
172172

173173

174-
![](https://camo.githubusercontent.com/933ca23e59bb1ed0159a7b444b783ce740224426/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f70726163746963616c6465762f696d6167652f66657463682f732d2d43477a4e5f4977362d2d2f635f6c696d6974253243665f6175746f253243666c5f70726f6772657373697665253243715f6175746f253243775f3838302f68747470733a2f2f692e696d6775722e636f6d2f3730796e6674542e706e67)</details> <details><summary>☁️ isGit</summary>
174+
![](https://camo.githubusercontent.com/933ca23e59bb1ed0159a7b444b783ce740224426/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f70726163746963616c6465762f696d6167652f66657463682f732d2d43477a4e5f4977362d2d2f635f6c696d6974253243665f6175746f253243666c5f70726f6772657373697665253243715f6175746f253243775f3838302f68747470733a2f2f692e696d6775722e636f6d2f3730796e6674542e706e67)</details><details><summary>☁️ isGit</summary>
175175

176176
The project has been detected as a GIT repository. Sometimes a dependency on the package.json link to a GIT repository, example:
177177

scripts/generateFlags.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const allFlagsContent = await Promise.all(
1818

1919
const turndownService = new TurndownService();
2020

21-
turndownService.addRule("summary", {
22-
filter: "summary",
21+
turndownService.addRule("h1", {
22+
filter: "h1",
2323
replacement: (content) => `<summary>${content}</summary>`
2424
});
2525

26-
turndownService.addRule("details", {
27-
filter: "details",
26+
turndownService.addRule("div", {
27+
filter: "div",
2828
replacement: (content) => `<details>${content}</details>`
2929
});
3030

src/flags/hasBannedFile.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>🌍 hasBannedFile</summary>
1+
<div>
2+
<h1>🌍 hasBannedFile</h1>
33
<p>
44
The project has at least one sensitive file (or a file with sensitive information in it).
55
</p>
@@ -12,5 +12,5 @@
1212
<li>.env</li>
1313
<li>files with extension like .key or .pem</li>
1414
</ul>
15-
</details>
15+
</div>
1616

src/flags/hasCustomResolver.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>💎 hasCustomResolver</summary>
1+
<div>
2+
<h1>💎 hasCustomResolver</h1>
33
<p>
44
The package has custom dependencies resolver such as <span>+git</span> or
55
<span>+ssh</span> or a local file with <span>file:</span>. In this kind of case it is better to check the package.json.
@@ -13,4 +13,4 @@
1313
Documentation:
1414
<a href="https://docs.npmjs.com/cli/install" rel="nofollow">npm-install</a>
1515
</p>
16-
</details>
16+
</div>

src/flags/hasExternalCapacity.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>🌍 hasExternalCapacity</summary>
1+
<div>
2+
<h1>🌍 hasExternalCapacity</h1>
33
<p>
44
The package use a Node.js core package that allow to access the network.
55
These core package are:
@@ -14,5 +14,5 @@
1414
<p class="note">
1515
⚠️ This flag only work if the AST analysis as successfully retrieved all dependencies as expected.
1616
</p>
17-
</details>
17+
</div>
1818

src/flags/hasIndirectDependencies.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>🌲 hasIndirectDependencies</summary>
1+
<div>
2+
<h1>🌲 hasIndirectDependencies</h1>
33
<p>
44
The package has indirect (or also called transitive) dependencies. This
55
means that the child dependencies of the package also have dependencies.
@@ -50,4 +50,4 @@
5050
>
5151
</li>
5252
</ul>
53-
</details>
53+
</div>

src/flags/hasManyPublishers.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<details>
2-
<summary>👥 hasManyPublishers</summary>
1+
<div>
2+
<h1>👥 hasManyPublishers</h1>
33
<p>
44
The package has been published on npm by multiple unique users. There is no
55
big deal here, just mean the package is maintained by a group of people.
66
</p>
7-
</details>
7+
</div>
88

src/flags/hasMinifiedCode.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>🔬 hasMinifiedCode</summary>
1+
<div>
2+
<h1>🔬 hasMinifiedCode</h1>
33
<p>
44
Has one or many files that has been detected as minified JavaScript code. We
55
use a package that will tell us if the code is minified (in case the file as
@@ -25,4 +25,4 @@
2525
<p>Files can be found in the <b>Minified Files</b> list items of the left menu.</p>
2626
<br />
2727
<img src="https://i.imgur.com/e8BbBeb.png">
28-
</details>
28+
</div>
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<details>
2-
<summary>👀 hasMissingOrUnusedDependency</summary>
1+
<div>
2+
<h1>👀 hasMissingOrUnusedDependency</h1>
33
<p>
44
The package has a missing dependency (in package.json) or a dependency that is not used in the code (this may happen if the AST Analysis fail!)
55
</p>
6-
</details>
6+
</div>

src/flags/hasMultipleLicenses.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>📚 hasMultipleLicenses</summary>
1+
<div>
2+
<h1>📚 hasMultipleLicenses</h1>
33
<p>
44
We have detected different licenses in <b>package.json</b> and
55
other licenses files (<b>LICENSE</b>,
@@ -16,4 +16,4 @@
1616
<p>
1717
Under the hood we use <a href="https://github.com/cutenode/conformance#readme">conformance</a> to parse licenses !
1818
</p>
19-
</details>
19+
</div>

src/flags/hasNativeCode.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>🐲 hasNativeCode</summary>
1+
<div>
2+
<h1>🐲 hasNativeCode</h1>
33
<p>
44
The package use native components (package, file, configuration) like <b>binding.gyp</b> or npm package for native addon like <b>node-addon-api</b>.
55
</p>
@@ -12,4 +12,4 @@
1212
<li>- One of the package dependency is known for building native addons.</li>
1313
<li>- The package.json file has the property "gypfile" set to&nbsp;<b>true</b>.</li>
1414
</ul>
15-
</details>
15+
</div>

src/flags/hasNoLicense.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>📜 hasNoLicense</summary>
1+
<div>
2+
<h1>📜 hasNoLicense</h1>
33
<p>
44
This flag mean that we have not detected any licenses in the npm Tarball (or
55
something went wrong in the detection). For detecting licenses we are reading
@@ -21,4 +21,4 @@
2121
<p class="note">
2222
⚠️ we are working to stabilize this flag !
2323
</p>
24-
</details>
24+
</div>

src/flags/hasScript.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>📦 hasScript</summary>
1+
<div>
2+
<h1>📦 hasScript</h1>
33
<p>
44
The package has pre and/or post script in the
55
<b>package.json</b> file. These script will be executed before or
@@ -23,4 +23,4 @@
2323
>
2424
</li>
2525
</ul>
26-
</details>
26+
</div>

src/flags/hasWarnings.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<details>
2-
<summary>⚠ hasWarnings</summary>
1+
<div>
2+
<h1>⚠ hasWarnings</h1>
33
<p>
44
This means that the <a href="https://www.gartner.com/en/information-technology/glossary/static-application-security-testing-sast" target="_blank">SAST</a> Scanner
55
has detected several problems by analyzing the <b>Abstract Syntax Tree (AST)</b> of a JavaScript source code.
66
All warnings are accurately documented <a href="https://github.com/fraxken/js-x-ray#warnings-legends-v20" target="_blank">here</a>.
77
</p>
8-
</details>
8+
</div>

src/flags/isDead.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<details>
2-
<summary>💀 isDead</summary>
1+
<div>
2+
<h1>💀 isDead</h1>
33
<p>
44
The dependency (package) has not received update <b>from at least one year</b> and has at least one dependency that need to be updated.
55
</p>
66
<br />
77
<p>
88
It probably means it's dangerous to use (or continue to) because the author doesn't seem to update the package anymore (even worst if you want him to implement a new version / security patch).
99
</p>
10-
</details>
10+
</div>

src/flags/isDeprecated.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>⛔️ isDeprecated</summary>
1+
<div>
2+
<h1>⛔️ isDeprecated</h1>
33
<p>
44
The given npm package has been deprecated by his author (it must be updated
55
or replaced with an equivalent if there is no new version available).
@@ -13,4 +13,4 @@
1313
>npm documentation</a
1414
>.
1515
</p>
16-
</details>
16+
</div>

src/flags/isDuplicated.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<details>
2-
<summary>🎭 isDuplicate</summary>
1+
<div>
2+
<h1>🎭 isDuplicate</h1>
33
<p>
44
Indicate that the package is <b>also used somewhere else in the dependency tree</b> but with a different version (like in the screenshot with <b>yallist</b>).
55
</p>
66
<br />
77
<img width="200" src="https://camo.githubusercontent.com/933ca23e59bb1ed0159a7b444b783ce740224426/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f70726163746963616c6465762f696d6167652f66657463682f732d2d43477a4e5f4977362d2d2f635f6c696d6974253243665f6175746f253243666c5f70726f6772657373697665253243715f6175746f253243775f3838302f68747470733a2f2f692e696d6775722e636f6d2f3730796e6674542e706e67" />
8-
</details>
8+
</div>

src/flags/isGit.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>☁️ isGit</summary>
1+
<div>
2+
<h1>☁️ isGit</h1>
33
<p>
44
The project has been detected as a GIT repository. Sometimes a dependency on
55
the package.json link to a GIT repository, example:
@@ -12,4 +12,4 @@
1212
<a href="https://github.com/npm/pacote#readme">pacote</a> to fetch and
1313
extract packages we are supporting this given pattern.
1414
</p>
15-
</details>
15+
</div>

src/flags/isOutdated.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<details>
2-
<summary>⌚️ isOutdated</summary>
1+
<div>
2+
<h1>⌚️ isOutdated</h1>
33
<p>
44
The <b>current</b> package version is not equal to the <b>latest</b> version of the package (Compared to the versions we retrieve from the npm registry).<br />
55
</p>
@@ -12,4 +12,4 @@
1212
<li>@beta</li>
1313
<li>@next</li>
1414
</ul>
15-
</details>
15+
</div>

src/flags/vulnerabilities.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<details>
2-
<summary>🚨 Vulnerabilities</summary>
1+
<div>
2+
<h1>🚨 Vulnerabilities</h1>
33
<p>
44
Vulnerabilities has been detected for the given package
55
<strong>version</strong>. We are fetching vulnerabilities from the official
66
<a href="https://github.com/nodejs/security-wg"
77
>Node.js Security-WG repository</a
88
>
99
</p>
10-
</details>
10+
</div>

0 commit comments

Comments
 (0)