Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): update docs config and tooling #21

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .storybook/YourTheme.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { create } from '@storybook/theming';

export default create({
base: 'dark',
brandTitle: 'AO Wallet Kit',
brandUrl: 'https://ao-wallet-kit_project-kardeshev.arweave.net',
brandImage: 'https://arweave.net/oDSg_8Qmy8nHOgtS_77cxFTq3oytZ7TBbu0ntGv3Xas',
brandTarget: '_self',

//
colorPrimary: '#1CA051',
colorSecondary: '#6CC790',

// UI
appBg: '#1f1f1f',
appContentBg: '#1f1f1f',
appPreviewBg: '#1f1f1f',
appBorderColor: '#585C6D',
appBorderRadius: 4,

// Text colors
textColor: '#1CA051',
textInverseColor: '#6CC790',

// Toolbar default and active colors
barTextColor: '#9E9E9E',
barSelectedColor: '#585C6D',
barHoverColor: '#585C6D',
barBg: '#1f1f1f',

// Form colors
inputBg: '#1f1f1f',
inputBorder: '#6CC790',
inputTextColor: '#6CC790',
inputBorderRadius: 2,
});
12 changes: 7 additions & 5 deletions .storybook/main.cjs → .storybook/main.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = {
stories: [
'../src/**/*.stories.@(js|jsx|ts|tsx|mdx)',
'../docs/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx|svelte)',
],
export default {
stories: [
"../docs/**/*.mdx",
"../docs/**/*.stories.@(js|jsx|mjs|ts|tsx|svelte)",
"../src/**/*.mdx",
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx|svelte)",
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
Expand Down
6 changes: 6 additions & 0 deletions .storybook/manager.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/manager-api';
import { themes } from '@storybook/theming';

addons.setConfig({
theme: themes.dark,
});
4 changes: 4 additions & 0 deletions .storybook/preview.cjs → .storybook/preview.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import YourTheme from "./YourTheme.mjs";
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
docs: {
theme: YourTheme,
},
controls: {
matchers: {
color: /(background|color)$/i,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"build": "vite build",
"storybook": "storybook dev -p 6006",
"build-storybook": "yarn build-docs && storybook build",
"build-docs": "typedoc",
"build-docs": "typedoc && node tools/fix-mdx-readme.mjs",
"publish-docs": "node tools/deploy-docs.mjs",
"serve-docs": "http-server storybook-static --port 8080",
"test": "echo \"Warning: no test specified\"",
Expand Down Expand Up @@ -122,12 +122,13 @@
"lint-staged": "^15.2.10",
"markdown-toc-gen": "^1.0.1",
"node-stdlib-browser": "^1.2.1",
"permaweb-deploy": "1.1.5",
"permaweb-deploy": "^1.1.8",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup-plugin-preserve-directives": "^0.2.0",
"semantic-release": "^21.0.7",
"starknet": "^6.11.0",
"storybook": "^7.0.22",
"typedoc": "0.25.0",
"typescript": "^4.9.3",
Expand Down
1 change: 1 addition & 0 deletions tools/deploy-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async function main() {
DEPLOY_KEY: b64EncodedWallet,
DEPLOY_ANT_PROCESS_ID: 'wJVTnZTedI9FIY4r2cB9C4CpAJKImvhu0WjOh0AecjQ',
DEPLOY_DIR: path.join(__dirname, '..', 'storybook-static'),
GITHUB_SHA: process.env.GITHUB_SHA ?? 'local',
},
},
);
Expand Down
31 changes: 31 additions & 0 deletions tools/fix-mdx-readme.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import fs from 'node:fs';
import path from 'node:path';

const __dirname = path.dirname(new URL(import.meta.url).pathname);

/**
* Function to remove content between <!-- toc --> and <!-- tocstop -->
* @param {string} filePath - The path to the file to be modified.
*/
function removeTOC(filePath) {
try {
// Read the file content
const content = fs.readFileSync(filePath, 'utf8');

// Use a regex to remove the content between <!-- toc --> and <!-- tocstop -->
const updatedContent = content.replace(
/<!-- toc -->[\s\S]*?<!-- tocstop -->/g,
'',
);

// Write the updated content back to the file
fs.writeFileSync(filePath, updatedContent, 'utf8');
console.log(`TOC removed from ${filePath}`);
} catch (error) {
console.error(`Error processing the file: ${error.message}`);
}
}

// Example usage
const filePath = path.join(__dirname, '../docs/README.mdx');
removeTOC(filePath);
Loading
Loading