diff --git a/.gitignore b/.gitignore index 6888cb6..da86b31 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ .docusaurus .cache-loader /docs/js-sdk/api +/docs/c2patool +/docs/rust-sdk /docs/**/readme.md # Misc @@ -21,4 +23,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -.dccache \ No newline at end of file +.dccache diff --git a/README.md b/README.md index 2bd62fe..c6c185e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,14 @@ $ npm start This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. +### Running fetch script + +The `/scripts/fetch-readme.js` script pulls markdown files from other repos (e.g. `c2patool`). To rerun this script for local build, enter this command: + +``` +npm run docs:fetch-readme +``` + ## Build ``` @@ -37,7 +45,7 @@ should be created automatically so that the preview can be shared before merging ### Forcing a site rebuild -To rebuild the site when one of the SDK/tool repos hasn't been versioned, simply make any change to the `main` branch of this repo. This is a workaround until a manual site rebuild capability is added. +To rebuild the site when one of the SDK/tool repos hasn't been versioned, simply make any change to the `main` branch of this repo. This is a workaround until a manual site rebuild capability is added. ## License diff --git a/scripts/fetch-readme.js b/scripts/fetch-readme.js index 180f54a..9161248 100644 --- a/scripts/fetch-readme.js +++ b/scripts/fetch-readme.js @@ -29,6 +29,21 @@ const readmes = [ repo: 'contentauth/c2patool', path: 'README.md', }, + { + dest: resolve(__dirname, '../docs/c2patool/manifest.md'), + repo: 'contentauth/c2patool', + path: 'docs/manifest.md', + }, + { + dest: resolve(__dirname, '../docs/c2patool/x_509.md'), + repo: 'contentauth/c2patool', + path: 'docs/x_509.md', + }, + { + dest: resolve(__dirname, '../docs/c2patool/release-notes.md'), + repo: 'contentauth/c2patool', + path: 'docs/release-notes.md', + }, { dest: resolve(__dirname, '../docs/c2pa-service-example/readme.md'), repo: 'contentauth/c2pa-service-example', @@ -47,9 +62,13 @@ function resolveMarkdownLinks(linkBase, content) { } async function download() { - for await (const { repo, path, dest } of readmes) { - const src = `${RAW_GITHUB_HOST}/${repo}/main/${path}`; - const linkBase = `${GITHUB_HOST}/${repo}/blob/main/${path}`; + for await (const { repo, path, dest, branch = 'main' } of readmes) { + /* + * Pass {branch} var to pull docs from other than main branch. + */ + + const src = `${RAW_GITHUB_HOST}/${repo}/${branch}/${path}`; + const linkBase = `${GITHUB_HOST}/${repo}/blob/${branch}/${path}`; const res = await fetch(src); const markdown = await res.text(); const resolvedMarkdown = resolveMarkdownLinks(linkBase, markdown); diff --git a/sidebars.js b/sidebars.js index 3431675..edc8d7a 100644 --- a/sidebars.js +++ b/sidebars.js @@ -26,6 +26,18 @@ const sidebars = { type: 'doc', id: 'c2patool/readme', }, + { + type: 'doc', + id: 'c2patool/manifest', + }, + { + type: 'doc', + id: 'c2patool/x_509', + }, + { + type: 'doc', + id: 'c2patool/release-notes', + }, { type: 'doc', id: 'c2pa-service-example/readme',