-
Notifications
You must be signed in to change notification settings - Fork 1
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
docs dev #8
base: develop
Are you sure you want to change the base?
docs dev #8
Conversation
Reviewer's Guide by SourceryThis pull request adds a large number of documentation files for a project called Titanrepo. The changes include new documentation pages covering various aspects of Titanrepo, such as installation, configuration, usage guides, API references, and core concepts. The PR also adds some documentation for a related project called Titanpack. User journey diagram for Titanrepo documentation navigationjourney
title User journey for navigating Titanrepo documentation
section Accessing Documentation
User: Go to Titanrepo documentation page
User: Search for specific topic
section Reading Documentation
User: Read installation guide
User: Read configuration guide
User: Read usage guides
User: Read API references
User: Read core concepts
section Applying Knowledge
User: Implement Titanrepo in project
User: Configure Titanrepo based on guides
User: Use Titanrepo features as per documentation
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @FortiShield - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider breaking large documentation updates into smaller, more focused pull requests for easier review and management.
- Think about separating Titanrepo and Titanpack documentation more clearly, possibly into different sections or PRs.
- Develop a strategy for maintaining and updating this large set of documentation as the project evolves, possibly including automated checks to keep docs in sync with the codebase.
Here's what I looked at during the review
- 🟡 General issues: 5 issues found
- 🟡 Security: 2 issues found
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -0,0 +1,389 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Consider adding performance considerations for Storybook in monorepos
While the Storybook guide is comprehensive, it would be beneficial to include a section on performance optimization when using Storybook in a monorepo context. Specifically, mention how to leverage Titanrepo's caching capabilities to speed up Storybook builds.
---
title: Storybook
description: Learn how to use Storybook in Titanrepo
performance:
- Leverage Titanrepo's caching for faster builds
- Optimize for monorepo context
---
@@ -0,0 +1,296 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): Include security considerations for environment variables in monorepos
Add a section discussing security best practices when using environment variables in a monorepo context, especially when multiple teams are working on different packages. This could include tips on variable scoping and access control.
@@ -0,0 +1,384 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Explain the efficiency of different glob patterns
In the 'clean-globs' codemod section, consider adding a brief explanation of the algorithmic complexity and performance implications of different glob patterns. This information can be crucial for optimizing build times in large repositories.
---
title: Profiling
description: Learn how to profile Titanpack and optimize glob patterns
performance:
- Understand glob pattern efficiency
- Optimize build times in large repositories
---
|
||
Inputs are hashed by Titanrepo, creating a "fingerprint" for the task run. When "fingerprints" match, running the task will hit the cache. | ||
|
||
Under the hood, Titanrepo creates two hashes: a global hash and a task hash. If either of the hashes change, the task will miss cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Explain the dual-hash approach in more detail
It would be beneficial to elaborate on why both a global hash and a task hash are used. Explain the advantages of this approach and how it contributes to more efficient and accurate caching.
Under the hood, Titanrepo creates two hashes: a global hash and a task hash. If either of the hashes change, the task will miss cache. | |
Under the hood, Titanrepo employs a dual-hash approach: a global hash and a task-specific hash. The global hash captures repository-wide changes, while the task hash focuses on task-specific inputs. This strategy ensures both broad and granular cache invalidation. If either hash changes, the task will miss the cache, providing a balance between cache efficiency and accuracy. This approach allows for precise cache hits when only task-specific elements change, while also ensuring cache invalidation for wider-reaching modifications. |
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
# To use Remote Caching, uncomment the next lines and follow the steps below. | ||
# env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): Add security best practices for environment variables
Consider adding a section on security best practices for handling sensitive environment variables like TITAN_TOKEN. This could include using GitHub Secrets, rotating tokens regularly, and limiting token permissions.
# env: | |
env: | |
TITAN_TOKEN: ${{ secrets.TITAN_TOKEN }} | |
TITAN_TEAM: ${{ secrets.TITAN_TEAM }} |
}; | ||
|
||
// Main function that triggers link validation across .mdx files | ||
async function validateAllInternalLinks(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider refactoring the validateAllInternalLinks function into smaller, focused functions.
To reduce complexity while maintaining functionality, consider the following refactoring:
- Break down the
validateAllInternalLinks
function:
async function validateAllInternalLinks(): Promise<void> {
try {
const allMdxFilePaths = await getAllMdxFilePaths([DOCS_PATH]);
documentMap = await createDocumentMap(allMdxFilePaths);
const allErrors = await processAllDocuments(allMdxFilePaths);
await handleErrors(allErrors);
} catch (error) {
handleGlobalError("Error validating internal links", error);
}
}
async function createDocumentMap(filePaths: string[]): Promise<Map<string, Document>> {
return new Map(await Promise.all(filePaths.map(prepareDocumentMapEntry)));
}
async function processAllDocuments(filePaths: string[]): Promise<Errors[]> {
return Promise.all(filePaths.map(processDocument));
}
async function processDocument(filePath: string): Promise<Errors> {
const doc = documentMap.get(normalizePath(filePath));
if (!doc) return createEmptyErrors();
const tree = await parseDocument(doc.body);
return traverseTreeAndValidateLinks(tree, doc);
}
- Use async/await consistently to flatten promise chains:
async function handleErrors(allErrors: Errors[]): Promise<void> {
const { errorsExist, errorRows } = collectErrors(allErrors);
if (errorsExist) {
const errorComment = createErrorComment(errorRows);
const commentUrl = await updateOrCreateComment(errorComment);
logErrorsToConsole(allErrors);
process.exit(1);
} else {
await removeExistingErrorComment();
}
await updateCheckStatus(errorsExist, commentUrl);
}
- Centralize error handling:
function handleGlobalError(message: string, error: unknown): void {
setFailed(`${message}: ${error}`);
}
function handleProcessingError(context: string, error: unknown): void {
console.error(`Error in ${context}:`, error);
// Optionally, you can choose to continue processing or throw the error
}
These changes will make the code more modular, easier to read, and maintain while keeping all functionality intact. The use of smaller, focused functions improves testability and reduces cognitive load when reading the code.
console.log("Skipping since this is not a pull request"); | ||
process.exit(0); | ||
} | ||
export const sha = pullRequest.head.sha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring
)
export const sha = pullRequest.head.sha; | |
export const {sha} = pullRequest.head; |
Explanation
Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide
const normalized = filePath | ||
.replace("repo-docs", "/repo/docs") | ||
.replace("pack-docs", "/pack/docs") | ||
.replace(".mdx", ""); | ||
|
||
return normalized; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Inline variable that is immediately returned (inline-immediately-returned-variable
)
const normalized = filePath | |
.replace("repo-docs", "/repo/docs") | |
.replace("pack-docs", "/pack/docs") | |
.replace(".mdx", ""); | |
return normalized; | |
return filePath | |
.replace("repo-docs", "/repo/docs") | |
.replace("pack-docs", "/pack/docs") | |
.replace(".mdx", ""); | |
Explanation
Something that we often see in people's code is assigning to a result variableand then immediately returning it.
Returning the result directly shortens the code and removes an unnecessary
variable, reducing the mental load of reading the function.
Where intermediate variables can be useful is if they then get used as a
parameter or a condition, and the name can act like a comment on what the
variable represents. In the case where you're returning it from a function, the
function name is there to tell you what the result is, so the variable name
is unnecessary.
try { | ||
visit(tree, (node: any) => { | ||
if (node.type === "element" && node.tagName === "a") { | ||
const href = node.properties.href; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring
)
const href = node.properties.href; | |
const {href} = node.properties; |
Explanation
Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide
if (node.type === "element" && node.tagName === "a") { | ||
const href = node.properties.href; | ||
|
||
if (!href) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces
)
if (!href) return; | |
if (!href) { |
Explanation
It is recommended to always use braces and create explicit statement blocks.Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).
Signed-off-by: fortishield <[email protected]>
User description
Notes for Reviewers
This PR fixes #
Signed commits
PR Type
Enhancement, Documentation, Configuration changes, Dependencies
Description
package.json
andpackage-lock.json
for project configuration and dependency management.Changes walkthrough 📝
3 files
validate-docs-links.ts
Add script for validating internal markdown links in documentation
docs/src/validate-docs-links.ts
github.ts
Integrate GitHub API for comment and status management
docs/src/github.ts
create-turbo-callout.tsx
Add CreateTitanCallout component for documentation guides
docs/repo-docs/guides/tools/create-turbo-callout.tsx
CreateTitanCallout
.Callout
andLink
components for rendering information.3 files
types.d.ts
Add TypeScript module declarations for remark-rehype and rehype-raw
docs/types.d.ts
remark-rehype
andrehype-raw
.meta.json
Add metadata for getting started documentation section
docs/repo-docs/getting-started/meta.json
package.json
Add package.json for project configuration and dependencies
docs/package.json
package.json
file with project configuration.21 files
run.mdx
Document `titan run` command with options and examples
docs/repo-docs/reference/run.mdx
titan run
command.configuration.mdx
Document configuration options for `titan.json`
docs/repo-docs/reference/configuration.mdx
titan.json
.configuring-tasks.mdx
Guide on configuring tasks in a repository
docs/repo-docs/crafting-your-repository/configuring-tasks.mdx
structuring-a-repository.mdx
Guide on structuring a repository for Titanrepo
docs/repo-docs/crafting-your-repository/structuring-a-repository.mdx
typescript.mdx
Guide on using TypeScript in a monorepo
docs/repo-docs/guides/tools/typescript.mdx
using-environment-variables.mdx
Guide on using environment variables in Titanrepo
docs/repo-docs/crafting-your-repository/using-environment-variables.mdx
package-configurations.mdx
Document package configurations for task flexibility
docs/repo-docs/reference/package-configurations.mdx
managing-dependencies.mdx
Add documentation on managing dependencies in monorepos
docs/repo-docs/crafting-your-repository/managing-dependencies.mdx
and pnpm.
packages.
creating-an-internal-package.mdx
Guide for Creating Internal Packages in a Monorepo
docs/repo-docs/crafting-your-repository/creating-an-internal-package.mdx
monorepo.
code.
packages.
turbo-codemod.mdx
Documentation for Codemods and Version Migrations in Titanrepo
docs/repo-docs/reference/turbo-codemod.mdx
generating-code.mdx
Guide on Code Generation with Titanrepo
docs/repo-docs/guides/generating-code.mdx
storybook.mdx
Integrating Storybook with Titanrepo: A Step-by-Step Guide
docs/repo-docs/guides/tools/storybook.mdx
caching.mdx
Comprehensive Guide to Caching in Titanrepo
docs/repo-docs/crafting-your-repository/caching.mdx
constructing-ci.mdx
Constructing Efficient CI Pipelines with Titanrepo
docs/repo-docs/crafting-your-repository/constructing-ci.mdx
github-actions.mdx
Using GitHub Actions with Titanrepo: A Practical Guide
docs/repo-docs/guides/ci-vendors/github-actions.mdx
running-tasks.mdx
Running and Managing Tasks with Titan CLI
docs/repo-docs/crafting-your-repository/running-tasks.mdx
docker.mdx
Deploying Applications with Docker in a Monorepo
docs/repo-docs/guides/tools/docker.mdx
publishing-libraries.mdx
Publishing Libraries from a Monorepo with Titanrepo
docs/repo-docs/guides/publishing-libraries.mdx
prisma.mdx
Integrating Prisma with Titanrepo: A Comprehensive Guide
docs/repo-docs/guides/tools/prisma.mdx
add-to-existing-repository.mdx
Integrating Titanrepo into Existing Repositories
docs/repo-docs/getting-started/add-to-existing-repository.mdx
workspaces.
why-titanpack.mdx
Why Titanpack: Exploring the Future of Web Bundling
docs/pack-docs/why-titanpack.mdx
computation.
1 files
package-lock.json
Introduce package-lock.json for dependency management
docs/package-lock.json
package-lock.json
file with detailed dependencyinformation.
integrity, and license.
84 files
internal-packages.mdx
...
docs/repo-docs/core-concepts/internal-packages.mdx
...
remote-caching.mdx
...
docs/repo-docs/core-concepts/remote-caching.mdx
...
eslint.mdx
...
docs/repo-docs/guides/tools/eslint.mdx
...
prune.mdx
...
docs/repo-docs/reference/prune.mdx
...
developing-applications.mdx
...
docs/repo-docs/crafting-your-repository/developing-applications.mdx
...
single-package-workspaces.mdx
...
docs/repo-docs/guides/single-package-workspaces.mdx
...
circleci.mdx
...
docs/repo-docs/guides/ci-vendors/circleci.mdx
...
installation.mdx
...
docs/repo-docs/getting-started/installation.mdx
...
jest.mdx
...
docs/repo-docs/guides/tools/jest.mdx
...
package-and-task-graph.mdx
...
docs/repo-docs/core-concepts/package-and-task-graph.mdx
...
system-environment-variables.mdx
...
docs/repo-docs/reference/system-environment-variables.mdx
...
upgrading.mdx
...
docs/repo-docs/crafting-your-repository/upgrading.mdx
...
gitlab-ci.mdx
...
docs/repo-docs/guides/ci-vendors/gitlab-ci.mdx
...
travis-ci.mdx
...
docs/repo-docs/guides/ci-vendors/travis-ci.mdx
...
multi-language.mdx
...
docs/repo-docs/guides/multi-language.mdx
...
skipping-tasks.mdx
...
docs/repo-docs/guides/skipping-tasks.mdx
...
index.mdx
...
docs/repo-docs/reference/index.mdx
...
vitest.mdx
...
docs/repo-docs/guides/tools/vitest.mdx
...
community.mdx
...
docs/repo-docs/community.mdx
...
index.mdx
...
docs/repo-docs/crafting-your-repository/index.mdx
...
css.mdx
...
docs/pack-docs/features/css.mdx
...
nuxt.mdx
...
docs/repo-docs/guides/frameworks/nuxt.mdx
...
sveltekit.mdx
...
docs/repo-docs/guides/frameworks/sveltekit.mdx
...
vite.mdx
...
docs/repo-docs/guides/frameworks/vite.mdx
...
nextjs.mdx
...
docs/repo-docs/guides/frameworks/nextjs.mdx
...
index.mdx
...
docs/repo-docs/index.mdx
...
support-policy.mdx
...
docs/repo-docs/getting-started/support-policy.mdx
...
handling-platforms.mdx
...
docs/repo-docs/guides/handling-platforms.mdx
...
index.mdx
...
docs/pack-docs/index.mdx
...
core-concepts.mdx
...
docs/pack-docs/core-concepts.mdx
...
generate.mdx
...
docs/repo-docs/reference/generate.mdx
...
telemetry.mdx
...
docs/repo-docs/telemetry.mdx
...
biome.mdx
...
docs/repo-docs/guides/tools/biome.mdx
...
acknowledgments.mdx
...
docs/repo-docs/acknowledgments.mdx
...
profiling.mdx
...
docs/pack-docs/advanced/profiling.mdx
...
create-turbo.mdx
...
docs/repo-docs/reference/create-turbo.mdx
...
globs.mdx
...
docs/repo-docs/reference/globs.mdx
...
roadmap.mdx
...
docs/pack-docs/roadmap.mdx
...
index.mdx
...
docs/pack-docs/features/index.mdx
...
watch.mdx
...
docs/repo-docs/reference/watch.mdx
...
index.mdx
...
docs/repo-docs/getting-started/index.mdx
...
frameworks.mdx
...
docs/pack-docs/features/frameworks.mdx
...
editor-integration.mdx
...
docs/repo-docs/getting-started/editor-integration.mdx
...
javascript.mdx
...
docs/pack-docs/features/javascript.mdx
...
index.mdx
...
docs/repo-docs/guides/index.mdx
...
missing-root-task-in-turbo-json.mdx
...
docs/repo-docs/messages/missing-root-task-in-turbo-json.mdx
...
typescript.mdx
...
docs/pack-docs/features/typescript.mdx
...
migrating-from-webpack.mdx
...
docs/pack-docs/migrating-from-webpack.mdx
...
package-types.mdx
...
docs/repo-docs/core-concepts/package-types.mdx
...
index.mdx
...
docs/repo-docs/guides/ci-vendors/index.mdx
...
scan.mdx
...
docs/repo-docs/reference/scan.mdx
...
turbo-ignore.mdx
...
docs/repo-docs/reference/turbo-ignore.mdx
...
ls.mdx
...
docs/repo-docs/reference/ls.mdx
...
eslint-config-turbo.mdx
...
docs/repo-docs/reference/eslint-config-turbo.mdx
...
static-assets.mdx
...
docs/pack-docs/features/static-assets.mdx
...
unnecessary-package-task-syntax.mdx
...
docs/repo-docs/messages/unnecessary-package-task-syntax.mdx
...
imports.mdx
...
docs/pack-docs/features/imports.mdx
...
index.mdx
...
docs/repo-docs/guides/tools/index.mdx
...
invalid-env-prefix.mdx
...
docs/repo-docs/messages/invalid-env-prefix.mdx
...
dev-server.mdx
...
docs/pack-docs/features/dev-server.mdx
...
package-task-in-single-package-workspace.mdx
...
docs/repo-docs/messages/package-task-in-single-package-workspace.mdx
...
index.mdx
...
docs/repo-docs/core-concepts/index.mdx
...
login.mdx
...
docs/repo-docs/reference/login.mdx
...
turbo-gen.mdx
...
docs/repo-docs/reference/turbo-gen.mdx
...
telemetry.mdx
...
docs/repo-docs/reference/telemetry.mdx
...
vercel.mdx
...
docs/repo-docs/guides/ci-vendors/vercel.mdx
...
index.mdx
...
docs/repo-docs/guides/frameworks/index.mdx
...
meta.json
...
docs/repo-docs/reference/meta.json
...
bin.mdx
...
docs/repo-docs/reference/bin.mdx
...
link.mdx
...
docs/repo-docs/reference/link.mdx
...
meta.json
...
docs/repo-docs/crafting-your-repository/meta.json
...
meta.json
...
docs/repo-docs/meta.json
...
tsconfig.json
...
docs/tsconfig.json
...
meta.json
...
docs/repo-docs/guides/meta.json
...
benchmarks.mdx
...
docs/pack-docs/benchmarks.mdx
...
README.MD
...
docs/README.MD
...
meta.json
...
docs/pack-docs/meta.json
...
meta.json
...
docs/pack-docs/features/meta.json
...
meta.json
...
docs/repo-docs/core-concepts/meta.json
...
logout.mdx
...
docs/repo-docs/reference/logout.mdx
...
unlink.mdx
...
docs/repo-docs/reference/unlink.mdx
...
meta.json
...
docs/repo-docs/guides/frameworks/meta.json
...
meta.json
...
docs/repo-docs/guides/ci-vendors/meta.json
...
meta.json
...
docs/repo-docs/guides/tools/meta.json
...
Summary by Sourcery
Introduce extensive documentation for Titanrepo, covering core concepts, features, integration with frameworks and CI/CD platforms, and best practices for managing a monorepo. Enhance user guidance with detailed API references and practical guides for using popular tools and frameworks.
New Features:
Enhancements:
Documentation:
run
,prune
,generate
, and others.