paltalabs / soroban-react

@soroban-react is a simple, powerful framework for building modern Soroban dApps using React.
https://soroban-react.paltalabs.io/
Apache License 2.0
30 stars 15 forks source link

[D4.2] Write documentation #2

Closed esteblock closed 11 months ago

esteblock commented 1 year ago

Write in the ./docs folder. Gitbook: https://soroban-react.gitbook.io/

esteblock commented 1 year ago
esteblock commented 1 year ago

Check https://stackoverflow.com/questions/15694267/how-to-easily-create-github-friendly-markdown-for-documented-javascript-function

mauroepce commented 1 year ago

Working on this branch: https://github.com/mauroepce/soroban-react/tree/soroban-documentation Tasks done:

  1. Project forked
  2. soroban-documentation branch created
  3. Dependencies installed to work on documentation:
  1. "doc" script created to looks for TypeScript files (*.ts) in all subfolders of packages, and generates documentation based on the comments in these files. The resulting documentation is saved in docs/DOCS.md
  2. I created a configuration file for JSDoc jsdoc.json
mauroepce commented 1 year ago

I was going to start to work on the documentation and I've encountered a problem in the index.tsx file in the package "chains" with references to FUTURENET and SANDBOX in SorobanClient.Networks. When trying to reference these networks I get the following errors:

Property 'FUTURENET' does not exist on type 'typeof Networks' Property 'SANDBOX' does not exist on type 'typeof Networks'

I've searched the documentation and repository of "soroban-client" but haven't found any mention of FUTURENET or SANDBOX that can help me solve this problem.

mauroepce commented 1 year ago

I opened an issue in the "soroban-client" repository to help me solve the FUTURENET and SANDBOX problem.

Here is the link to the issue: https://github.com/stellar/js-soroban-client/issues/104

I'll still continue with the documentation and then I'll do the code modifications.

mauroepce commented 1 year ago

I filled in the comments for the documentation of the index.tsx code inside the package chain. The only problem I'm having is that the script isn't recognizing comments inside .tsx files inside packages. Pending to be resolved. Screenshot 2023-06-28 at 21 10 36

mauroepce commented 1 year ago

Had a problem trying to run prettier on any tsx file. The warnings were as follows:

I solved doing the following in the .prettierrc config file:

Aditional:

mauroepce commented 1 year ago

There was an error in multiples files inside package's folder:

What was causing this:

Solved doing the following:

{
  "extends": "@tsconfig/recommended/tsconfig.json",
  "compilerOptions": {
    "module": "CommonJS",
    "declaration": true,
    "moduleResolution": "Node",
    "baseUrl": ".",
    "paths": {
      "@soroban-react/*": ["packages/*/src"]
    }
  },
  "exclude": ["**/*.spec.ts"]
}

This tells TypeScript to look in the "packages/*/src" directory when an import starts with "@soroban-react/", resolving the import error.

mauroepce commented 1 year ago

I was having too much problems with JSDoc to create the documentation. JSDoc was still having trouble understanding the TypeScript/JSX code it's trying to parse. I think it may be because:

Solution:

mauroepce commented 1 year ago

Documentation generation with TYPEDOC, ready

Script Summary:

Documentation Generation:

mauroepce commented 1 year ago

Updates to the README.md file on the root directory:

  1. Added instructions for generating documentation using Typedoc:
  1. Added a "prettier-format" script that automatically formats TypeScript (.ts) and TypeScript JSX (.tsx) files in the packages directory.
mauroepce commented 1 year ago

Today I was focused on being able to publish to gitbook the documentation generated by typedoc and combined with additional folders added to the docs folder.

updates:

Issues:

  1. the README.md in Tutorial and
  2. the .md files inside interfaces and modules ofTechnical-docs

Solution: I'm looking at using the .gitbook.yaml to create the structure or using a SUMMARY.md within the docs.

esteblock commented 11 months ago

Close because will update doc in a new issue