-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic readme.md generator for easier manager
- Loading branch information
1 parent
93d3806
commit 81f84a9
Showing
15 changed files
with
224 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ jobs: | |
npm ci | ||
- name: Check Build Commit | ||
run: | | ||
node . | ||
npm run check-for-update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Bedrock Documentation Generator | ||
|
||
## Overview | ||
This repository generates documentation for different versions of Bedrock. The generated docs are stored in the `./docs` directory. Before fetching any data, ensure that the data is generated in the specific branch by checking the `exist.json` file in the root directory. This file includes the build version, engine version, and flags indicating the types of generated data. | ||
|
||
## Checking Generated Data | ||
The `exist.json` file is crucial for determining if the necessary data has been generated for a specific branch. This file must be fetched first to verify the existence of the repository and the availability of the required data. It contains: | ||
- **version**: The version of the documentation (e.g., x.x.x or x.x.x.x). | ||
- **build-version**: The version of BDS used to generate the documentation. | ||
- **flags**: An array indicating the types of content generated. This array may include additional data generated by some flags that are not specified here. | ||
|
||
Example of `exist.json`: | ||
```json | ||
{ | ||
"version": "", | ||
"build-version": "", | ||
"flags": [] | ||
} | ||
``` | ||
|
||
## Supported Branches | ||
You can target specific versions via the following branches: | ||
- **Latest Stable**: `stable` | ||
- **Latest Preview**: `preview` | ||
- **Specific Stable**: `stable-x.x.x` (e.g., `stable-1.20.10`) | ||
|
||
## Flags | ||
Flags in the `exist.json` file indicate the types of content generated for that branch. Before fetching any files, check for the appropriate flag to ensure the data exists. Read specific flags in sections about [Current Generator Flags](#current-flags). | ||
|
||
## Targeting Files | ||
To fetch the documentation files, use the following URL format: | ||
``` | ||
https://raw.githubusercontent.com/Bedrock-APIs/bds-docs/{branch}/docs/script_modules/@minecraft/{module_name}_{module_version}.json | ||
``` | ||
Replace `{branch}` with the appropriate branch name (`stable`, `preview`, or `stable-x.x.x`), and `{module_name}` and `{module_version}` with the specific module name and version. | ||
|
||
## Examples | ||
### Preview Version | ||
```js | ||
`https://raw.githubusercontent.com/Bedrock-APIs/bds-docs/preview/docs/script_modules/@minecraft/server_1.7.0-beta.json`; | ||
``` | ||
|
||
### Stable Version | ||
```js | ||
`https://raw.githubusercontent.com/Bedrock-APIs/bds-docs/stable/docs/script_modules/@minecraft/server_1.2.0.json`; | ||
``` | ||
|
||
### Specific Stable Version | ||
```js | ||
const engine_version = "1.20.10"; | ||
`https://raw.githubusercontent.com/Bedrock-APIs/bds-docs/stable-${engine_version}/docs/script_modules/@minecraft/server_1.2.0.json`; | ||
``` | ||
|
||
## Contribution | ||
We welcome contributions from the community! Here are the steps to get started: | ||
1. **Fork the Repository**: You can't properly debug the repo without a full fork. | ||
2. **Allow Actions on Your Fork**: Ensure that GitHub Actions are enabled on your fork to run tests and other automated processes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//@ts-nocheck | ||
import { read, writeFileSync } from "node:fs"; | ||
import { GENERATORS_FLAGS } from "../src/flags/index.js"; | ||
import { dirname, resolve } from "node:path"; | ||
import { readFile } from "node:fs/promises"; | ||
|
||
export const MAIN_DATA = await readFile(resolve(import.meta.dirname, "./__MAIN.md")); | ||
let flagsInfo = ""; | ||
const newline = "\n\r"; | ||
|
||
for (const generator of GENERATORS_FLAGS) { | ||
let flagText = `### \`FLAG:${generator.flagId}\` Documentation${newline}`; | ||
flagText += `> ${(generator.description??( | ||
console.log("No generator metadata description for: " + generator.flagId), | ||
"NO DESCRIPTION" | ||
))}`.replaceAll(/(\r\n|\r|\n)(\s+|)/g, newline + "> "); | ||
flagsInfo += flagText + newline; | ||
} | ||
let readme = `${MAIN_DATA} | ||
## Current Flags | ||
When you download files before that, you should check what content is available using the flag, | ||
these flags determine what is currently available, if the given flag is not there then the given | ||
information under this flag would not be generated or supported. always check that the given flag is available. | ||
${GENERATORS_FLAGS.map(e=>` - \`${e.flagId}\``).join(newline)} | ||
${flagsInfo} | ||
`; | ||
export const GENERAL_README = readme; | ||
if(import.meta.filename == process.argv[1]) writeFileSync("./README.md", readme); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
import { BLOCKS_DATA } from "./data/blocks.js"; | ||
import { METADATA } from "./metadata.js"; | ||
import { SCRIPT_MODULES_MAPPING } from "./module_maping.js"; | ||
import { SCRIPT_DECLARATIONS } from "./script_decleration.js"; | ||
|
||
/** | ||
* @type {{ | ||
* flagId: string, method(inputDir: string):Promise<boolean> | ||
* }[]} | ||
* @type {Promise<{default: { | ||
* flagId: string, method(inputDir: string):Promise<boolean>, | ||
* description?: string | ||
* }}>[]} | ||
*/ | ||
export const GENERATOR_FLAGS = [ | ||
{ | ||
flagId: METADATA.name, | ||
method: METADATA | ||
}, | ||
{ | ||
flagId: SCRIPT_MODULES_MAPPING.name, | ||
method: SCRIPT_MODULES_MAPPING | ||
}, | ||
{ | ||
flagId: SCRIPT_DECLARATIONS.name, | ||
method: SCRIPT_DECLARATIONS | ||
}, | ||
{ | ||
flagId: BLOCKS_DATA.name, | ||
method: BLOCKS_DATA | ||
} | ||
]; | ||
export const GENERATORS = [ | ||
import("./metadata.js"), | ||
import("./module_maping.js"), | ||
import("./script_decleration.js"), | ||
import("./data/blocks.js") | ||
]; | ||
/** | ||
* @type {{ | ||
* flagId: string, method(inputDir: string):Promise<boolean>, | ||
* description?: string | ||
* }[]} | ||
*/ | ||
export const GENERATORS_FLAGS = (await Promise.all(GENERATORS)).map(e=>e.default); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.