Skip to content

Commit 833f9cc

Browse files
committed
Convert Docusaurus config to TypeScript and update documentation structure
- Convert docusaurus.config.js to TypeScript with type safety - Convert sidebars.js to TypeScript configuration - Add ESLint configuration with TypeScript support - Update package.json with additional scripts and dependencies - Update Node.js requirement to version 24 in netlify.toml - Add proper TypeScript development environment - Add setupTests.ts for testing configuration
1 parent 4cd899b commit 833f9cc

File tree

8 files changed

+265
-154
lines changed

8 files changed

+265
-154
lines changed

docusaurus.config.js

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

docusaurus.config.ts

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
import { themes as prismThemes } from 'prism-react-renderer';
2+
import type { Config } from '@docusaurus/types';
3+
import type * as Preset from '@docusaurus/preset-classic';
4+
5+
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
6+
7+
const config: Config = {
8+
title: 'Console Table Printer',
9+
tagline: 'A tool to print colorful table on your console',
10+
favicon: 'img/favicon.ico',
11+
12+
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
13+
future: {
14+
v4: true, // Improve compatibility with the upcoming Docusaurus v4
15+
},
16+
17+
// Set the production url of your site here
18+
url: 'https://console-table.netlify.app',
19+
// Set the /<baseUrl>/ pathname under which your site is served
20+
// For GitHub pages deployment, it is often '/<projectName>/'
21+
baseUrl: '/',
22+
23+
// GitHub pages deployment config.
24+
// If you aren't using GitHub pages, you don't need these.
25+
organizationName: 'console-table-printer', // Usually your GitHub org/user name.
26+
projectName: 'console-table-docu', // Usually your repo name.
27+
28+
onBrokenLinks: 'throw',
29+
onBrokenMarkdownLinks: 'warn',
30+
31+
// Even if you don't use internationalization, you can use this field to set
32+
// useful metadata like html lang. For example, if your site is Chinese, you
33+
// may want to replace "en" with "zh-Hans".
34+
i18n: {
35+
defaultLocale: 'en',
36+
locales: ['en'],
37+
},
38+
39+
presets: [
40+
[
41+
'classic',
42+
{
43+
docs: {
44+
sidebarPath: './sidebars.ts',
45+
sidebarCollapsible: false,
46+
showLastUpdateAuthor: true,
47+
showLastUpdateTime: true,
48+
remarkPlugins: [
49+
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
50+
],
51+
// this enabled the edit button for documentation
52+
editUrl: 'https://github.com/console-table-printer/console-table-docu/blob/master/',
53+
},
54+
theme: {
55+
customCss: './src/css/custom.css',
56+
},
57+
} satisfies Preset.Options,
58+
],
59+
],
60+
61+
themeConfig: {
62+
// Replace with your project's social card
63+
image: 'img/logo.svg',
64+
announcementBar: {
65+
id: 'support',
66+
content:
67+
'⭐️ If you like Console Table Printer, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/console-table-printer/console-table-printer">GitHub</a>! ⭐️',
68+
},
69+
navbar: {
70+
title: 'Console Table Printer',
71+
logo: {
72+
alt: 'Console Table Printer',
73+
src: 'img/logo.ico',
74+
},
75+
items: [
76+
{
77+
href: 'https://github.com/console-table-printer/console-table-printer',
78+
label: 'GitHub',
79+
position: 'right',
80+
},
81+
{
82+
href: 'https://www.npmjs.com/package/console-table-printer',
83+
label: 'npmjs',
84+
position: 'right',
85+
},
86+
],
87+
},
88+
footer: {
89+
style: 'dark',
90+
links: [
91+
{
92+
title: 'Learn',
93+
items: [
94+
{
95+
label: 'Quick Start',
96+
to: 'docs',
97+
},
98+
{
99+
label: 'Getting Started With CLI',
100+
to: 'docs/doc-cli-install-quick-start',
101+
},
102+
],
103+
},
104+
{
105+
title: 'Decorate',
106+
items: [
107+
{
108+
label: 'Color',
109+
to: 'docs/doc-color',
110+
},
111+
{
112+
label: 'Border',
113+
to: 'docs/doc-border-design',
114+
},
115+
{
116+
label: 'Alignment',
117+
to: 'docs/doc-alignment',
118+
},
119+
],
120+
},
121+
{
122+
title: 'More',
123+
items: [
124+
{
125+
label: 'GitHub',
126+
href: 'https://github.com/console-table-printer/console-table-printer',
127+
},
128+
{
129+
label: 'Npmjs',
130+
href: 'https://www.npmjs.com/package/console-table-printer',
131+
},
132+
],
133+
},
134+
],
135+
copyright: `Copyright © ${new Date().getFullYear()} Nahiyan Kamal under MIT License. Built with Docusaurus.`,
136+
},
137+
prism: {
138+
theme: prismThemes.github,
139+
darkTheme: prismThemes.dracula,
140+
},
141+
} satisfies Preset.ThemeConfig,
142+
};
143+
144+
export default config;

eslint.config.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const js = require('@eslint/js');
2+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
3+
const tsParser = require('@typescript-eslint/parser');
4+
const prettierPlugin = require('eslint-plugin-prettier');
5+
6+
module.exports = [
7+
js.configs.recommended,
8+
{
9+
files: ['**/*.{js,jsx,ts,tsx}'],
10+
languageOptions: {
11+
parser: tsParser,
12+
parserOptions: {
13+
ecmaVersion: 2021,
14+
sourceType: 'module',
15+
ecmaFeatures: {
16+
jsx: true,
17+
},
18+
},
19+
globals: {
20+
window: 'readonly',
21+
document: 'readonly',
22+
console: 'readonly',
23+
process: 'readonly',
24+
Buffer: 'readonly',
25+
__dirname: 'readonly',
26+
__filename: 'readonly',
27+
global: 'readonly',
28+
module: 'readonly',
29+
require: 'readonly',
30+
exports: 'readonly',
31+
jest: 'readonly',
32+
expect: 'readonly',
33+
test: 'readonly',
34+
describe: 'readonly',
35+
it: 'readonly',
36+
beforeEach: 'readonly',
37+
afterEach: 'readonly',
38+
},
39+
},
40+
plugins: {
41+
'@typescript-eslint': tsPlugin,
42+
prettier: prettierPlugin,
43+
},
44+
rules: {
45+
...tsPlugin.configs.recommended.rules,
46+
'prettier/prettier': 'error',
47+
'@typescript-eslint/no-unused-vars': 'error',
48+
'@typescript-eslint/no-explicit-any': 'warn',
49+
'@typescript-eslint/no-require-imports': 'off',
50+
'no-undef': 'off', // TypeScript handles this
51+
},
52+
},
53+
{
54+
ignores: ['build/', 'node_modules/', '.docusaurus/', 'coverage/'],
55+
},
56+
];

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# HTML files and assets generated by the build. If a base directory has
66
# been specified, include it in the publish directory path.
77
publish = "build/"
8-
environment = { NODE_VERSION = "22.16.0" }
8+
environment = { NODE_VERSION = "24" }
99

1010
# Default build command.
1111
command = "yarn build"

0 commit comments

Comments
 (0)