Skip to content

Commit 18f37ee

Browse files
committed
refactor: ♻️ move all file to tsx and remove module.css when it was possible
1 parent 2c9a184 commit 18f37ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1176
-1133
lines changed

biome.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
44
"files": {
55
"ignoreUnknown": false,
6-
"includes": ["crowdsec-docs/**/*.ts", "crowdsec-docs/**/*.tsx", "!**/node_modules/**", "!crowdsec-docs/plugins/**"]
6+
"includes": [
7+
"crowdsec-docs/**/*.ts",
8+
"crowdsec-docs/**/*.tsx",
9+
"crowdsec-docs/**/*.css",
10+
"!**/node_modules/**",
11+
"!crowdsec-docs/plugins/**",
12+
"!crowdsec-docs/build/**"
13+
]
714
},
815
"formatter": {
916
"enabled": true,
@@ -32,7 +39,7 @@
3239
"jsxQuoteStyle": "double",
3340
"quoteProperties": "asNeeded",
3441
"trailingCommas": "es5",
35-
"semicolons": "asNeeded",
42+
"semicolons": "always",
3643
"arrowParentheses": "always",
3744
"bracketSameLine": false,
3845
"quoteStyle": "double",
@@ -41,6 +48,15 @@
4148
}
4249
},
4350
"html": { "formatter": { "selfCloseVoidElements": "always" } },
51+
"css": {
52+
"formatter": {
53+
"enabled": true,
54+
"indentStyle": "tab",
55+
"indentWidth": 4,
56+
"lineEnding": "lf",
57+
"lineWidth": 140
58+
}
59+
},
4460
"assist": {
4561
"enabled": true,
4662
"actions": { "source": { "organizeImports": "on" } }

crowdsec-docs/components.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
"tailwind": {
44
"config": "tailwind.config.js",
55
"css": "src/css/custom.css",
6-
"baseColor": "neutral",
7-
"prefix": "tw-",
8-
"cssVariables": false
6+
"baseColor": "gray",
7+
"prefix": "",
8+
"cssVariables": true
99
},
1010
"rsc": true,
1111
"aliases": {
12-
"utils": "@/src/utils",
13-
"components": "@/src/components",
14-
"ui": "@/src/ui",
15-
"hooks": "@/src/hooks",
16-
"lib": "@/src/lib"
12+
"utils": "@site/src/utils",
13+
"components": "@site/src/components",
14+
"ui": "@site/src/ui",
15+
"hooks": "@site/src/hooks",
16+
"lib": "@site/src/lib"
1717
},
18-
"style": "default"
18+
"style": "default",
19+
"iconLibrary": "lucide"
1920
}
2021

crowdsec-docs/docs/getting_started/intro.md renamed to crowdsec-docs/docs/getting_started/intro.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ sidebar_position: 1
66

77
# Security Engine
88

9-
:::info
10-
You may see Security Engine referred to as "agent" in the documentation/videos and "machines" within cscli commands.
11-
:::
12-
139
The Security Engine is a core component of CrowdSec. It is the component that will analyze logs and will expose an API endpoint for the remediation components to get the decisions made by the engine.
1410

1511
## Supported Platforms

crowdsec-docs/docusaurus.config.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type * as Preset from "@docusaurus/preset-classic"
2-
import type { NavbarItem } from "@docusaurus/theme-common"
3-
import type { Config } from "@docusaurus/types"
4-
import { themes } from "prism-react-renderer"
1+
import type * as Preset from "@docusaurus/preset-classic";
2+
import type { NavbarItem } from "@docusaurus/theme-common";
3+
import type { Config } from "@docusaurus/types";
4+
import { themes } from "prism-react-renderer";
55

6-
import tailwindPlugin from "./plugins/tailwind-config"
7-
import { ctiApiSidebar, guidesSideBar, remediationSideBar } from "./sidebarsUnversioned"
6+
import tailwindPlugin from "./plugins/tailwind-config";
7+
import { ctiApiSidebar, guidesSideBar, remediationSideBar } from "./sidebarsUnversioned";
88

99
const generateCurrentAndNextRedirects = (s) => [
1010
{
@@ -15,44 +15,44 @@ const generateCurrentAndNextRedirects = (s) => [
1515
from: `/docs/next/${s}`,
1616
to: `/u/${s}`,
1717
},
18-
]
18+
];
1919

2020
function handleSidebarItems(items) {
21-
const arr = []
21+
const arr = [];
2222
for (const item of items) {
2323
if (typeof item === "string") {
24-
arr.push(...generateCurrentAndNextRedirects(item))
24+
arr.push(...generateCurrentAndNextRedirects(item));
2525
} else if (typeof item === "object") {
26-
arr.push(...backportRedirect(item))
26+
arr.push(...backportRedirect(item));
2727
}
2828
}
29-
return arr
29+
return arr;
3030
}
3131

3232
const backportRedirect = (s) => {
33-
const arr = []
33+
const arr = [];
3434
if (typeof s === "string") {
35-
arr.push(...generateCurrentAndNextRedirects(s))
36-
return arr
35+
arr.push(...generateCurrentAndNextRedirects(s));
36+
return arr;
3737
}
38-
const { id, link, items } = s
38+
const { id, link, items } = s;
3939
if (id) {
40-
arr.push(...generateCurrentAndNextRedirects(id))
40+
arr.push(...generateCurrentAndNextRedirects(id));
4141
}
4242
if (link?.id) {
43-
arr.push(...generateCurrentAndNextRedirects(link.id))
43+
arr.push(...generateCurrentAndNextRedirects(link.id));
4444
}
4545
if (items) {
46-
arr.push(...handleSidebarItems(items))
46+
arr.push(...handleSidebarItems(items));
4747
}
48-
return arr
49-
}
48+
return arr;
49+
};
5050

51-
const currentYear = new Date().getFullYear()
51+
const currentYear = new Date().getFullYear();
5252

5353
const ACADEMY_URL = `https://academy.crowdsec.net/courses?${
5454
process.env.NODE_ENV === "production" ? "utm_source=docs&utm_medium=menu&utm_campaign=top-menu&utm_id=academydocs" : ""
55-
}`
55+
}`;
5656

5757
const NAVBAR_ITEMS: NavbarItem[] = [
5858
{
@@ -116,7 +116,7 @@ const NAVBAR_ITEMS: NavbarItem[] = [
116116
position: "right",
117117
className: "header-hub-link",
118118
},
119-
]
119+
];
120120

121121
const FOOTER_LINKS = [
122122
{
@@ -143,7 +143,7 @@ const FOOTER_LINKS = [
143143
},
144144
],
145145
},
146-
]
146+
];
147147

148148
const redirects = [
149149
...[
@@ -155,7 +155,7 @@ const redirects = [
155155
{ from: "/docs/next/troubleshooting", to: "/u/troubleshooting/intro" },
156156
{ from: "/docs/faq", to: "/u/troubleshooting/intro" },
157157
{ from: "/docs/next/faq", to: "/u/troubleshooting/intro" },
158-
]
158+
];
159159

160160
const config: Config = {
161161
future: {
@@ -250,7 +250,7 @@ const config: Config = {
250250
editUrl: "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/",
251251
},
252252
theme: {
253-
customCss: require.resolve("./src/css/custom.css"),
253+
customCss: "./src/css/custom.css",
254254
},
255255
} satisfies Preset.Options,
256256
],
@@ -270,6 +270,6 @@ const config: Config = {
270270
["@docusaurus/plugin-client-redirects", { redirects }],
271271
tailwindPlugin,
272272
],
273-
}
273+
};
274274

275-
export default config
275+
export default config;

crowdsec-docs/package-lock.json

Lines changed: 34 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crowdsec-docs/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@
3030
"@mui/icons-material": "^5.11.16",
3131
"@mui/material": "^5.13.4",
3232
"@mui/x-date-pickers": "^6.18.0",
33+
"@radix-ui/react-slot": "^1.2.3",
3334
"@radix-ui/react-popover": "^1.1.14",
3435
"@radix-ui/react-tooltip": "^1.1.2",
35-
"class-variance-authority": "^0.7.0",
36+
"animate-css": "^1.3.4",
37+
"class-variance-authority": "^0.7.1",
3638
"clsx": "^2.1.1",
3739
"docusaurus-plugin-zooming": "^1.0.0",
3840
"lucide-react": "^0.441.0",
3941
"material-react-table": "^2.0.2",
4042
"prism-react-renderer": "^2.4.0",
4143
"react": "^18.3.1",
4244
"react-dom": "^18.3.1",
43-
"tailwind-merge": "^2.5.2",
45+
"tailwind-merge": "^2.6.0",
4446
"tailwindcss-animate": "^1.0.7"
4547
},
4648
"devDependencies": {

crowdsec-docs/sidebars.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"
1+
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
22

3-
type SidebarConfig = SidebarsConfig[string]
3+
type SidebarConfig = SidebarsConfig[string];
44

55
const sidebarsConfig: SidebarConfig = {
66
// By default, Docusaurus generates a sidebar from the docs folder structure
@@ -767,6 +767,6 @@ const sidebarsConfig: SidebarConfig = {
767767
{ type: "doc", id: "appsec/benchmark", label: "Benchmark" },
768768
{ type: "doc", id: "appsec/troubleshooting" },
769769
],
770-
}
770+
};
771771

772-
export default sidebarsConfig
772+
export default sidebarsConfig;

crowdsec-docs/sidebarsUnversioned.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"
1+
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
22

3-
type SidebarConfig = SidebarsConfig[string]
3+
type SidebarConfig = SidebarsConfig[string];
44

55
const sidebarsUnversionedConfig: SidebarConfig = {
66
ctiApiSidebar: [
@@ -656,7 +656,7 @@ const sidebarsUnversionedConfig: SidebarConfig = {
656656
],
657657
}
658658

659-
export default sidebarsUnversionedConfig
659+
export default sidebarsUnversionedConfig;
660660

661661
export const {
662662
ctiApiSidebar,
@@ -667,4 +667,4 @@ export const {
667667
serviceApiSideBar,
668668
guidesSideBar,
669669
gettingStarted,
670-
} = sidebarsUnversionedConfig
670+
} = sidebarsUnversionedConfig;

crowdsec-docs/src/components/academy-promo.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from "react"
1+
import React from "react";
22

33
const AcademyPromo = ({ ...props }): React.JSX.Element => {
4-
const LINK = `https://academy.crowdsec.net/course/${props.course}${process.env.NODE_ENV === "production" ? props.utm : " "}`
4+
const LINK = `https://academy.crowdsec.net/course/${props.course}${process.env.NODE_ENV === "production" ? props.utm : " "}`;
55
return (
66
<div>
77
<hr />
8-
<section className="tw-w-4/5 tw-m-auto">
8+
<section className="w-4/5 m-auto">
99
{!!props.title && <h2>{props.title}</h2>}
1010
<div className="row">
1111
<div className="col">
@@ -27,7 +27,7 @@ const AcademyPromo = ({ ...props }): React.JSX.Element => {
2727
</section>
2828
<hr />
2929
</div>
30-
)
31-
}
30+
);
31+
};
3232

33-
export default AcademyPromo
33+
export default AcademyPromo;

0 commit comments

Comments
 (0)