diff --git a/frontend/docs/index.md b/frontend/docs/index.md new file mode 100644 index 00000000..1ad05ca8 --- /dev/null +++ b/frontend/docs/index.md @@ -0,0 +1,30 @@ +# The OpenTofu Registry + +The OpenTofu Registry provides an API for OpenTofu to locate providers and modules. This documentation will guide you through the most important steps in using the registry or publishing your modules and providers. + +## For users + +This section contains the documentation for OpenTofu users. + +- [Overview](/docs/users) +- [Using a provider](/docs/users/providers) +- [Using a module](/docs/users/modules) + +## For provider authors + +This section guides you through the steps of creating and publishing an OpenTofu provider. + +- [Overview](/docs/providers) +- [Creating a provider](/docs/providers/creating) +- [Writing docs for your provider](/docs/providers/docs) +- [Publishing your provider](/docs/providers/publishing) +- [Adding a provider to the registry](/docs/providers/adding) + +## For module authors + +This section shows you how to create and publish a module. + +- [Overview](/docs/modules) +- [Creating a module](/docs/modules/creating) +- [Publishing a module](/docs/modules/publishing) +- [Adding a module to the OpenTofu Registry](/docs/modules/adding) diff --git a/frontend/docs/modules/adding.md b/frontend/docs/modules/adding.md new file mode 100644 index 00000000..575db4f2 --- /dev/null +++ b/frontend/docs/modules/adding.md @@ -0,0 +1,11 @@ +# Adding your module to the OpenTofu registry + +Once you have [published your module](/docs/modules/publishing), you can add your module to the OpenTofu Registry. You can do this by [creating an issue](https://github.com/opentofu/registry/issues/new/choose) on the OpenTofu Registry GitHub repository. + +Here you will have to provide your username/organization name and repository name, which will translate to a module name. For example, consider the following repository: + +``` +YOURNAME/terraform-NAME-TARGETSYSTEM +``` + +This will translate to a module address your users can reference as `YOURNAME/NAME/TARGETSYSTEM`. \ No newline at end of file diff --git a/frontend/docs/modules/creating.md b/frontend/docs/modules/creating.md new file mode 100644 index 00000000..f0ce43d7 --- /dev/null +++ b/frontend/docs/modules/creating.md @@ -0,0 +1,35 @@ +# Creating an OpenTofu module + +Any OpenTofu project can be a reusable module others can use. By pushing it to GitHub and then publishing the link to your module in the OpenTofu Registry, anyone can easily find and use it. + +In order to create a module for reuse, simply write your OpenTofu code the way you normally would and create [variables](https://opentofu.org/docs/language/values/variables/) for configuration. + +Your module may also create resources that a user may want to use further. For example, you may create a virtual machine and want to supply your user with the ID of that virtual machine. To return values from your module, you can use [output](https://opentofu.org/docs/language/values/outputs/) blocks. + +You can read more about how modules work [in the OpenTofu documentation](https://opentofu.org/docs/language/modules/). + +## Readme + +Once the code is done, make sure that you add a `README.md` file and explain to your users how to use your module. This file will show up in the Registry Search if the license allows for it. + +## License + +In order for your module to show up in the OpenTofu Registry Search, your module should be licensed under one of the [supported licenses](https://github.com/opentofu/registry-ui/blob/main/licenses.json). If your module is not under one of these licenses, your module will be findable in the Registry Search, but no other data will be displayed. + +## Submodules + +If you want to structure your modules further, you can use submodules you can place in subdirectories. To make the submodules show up in the Registry Search, place your submodules in the `modules/MODULENAME` directory in your module. + +You can add a `README.md` file to your submodule to provide more information about your submodule. + +## Examples + +Similar in structure to submodules, examples provide your users with an easy way to get into using your module. To make your example show up in the OpenTofu Registry Search, place the example project into the `examples/EXAMPLENAME` folder and add a `README.md` file. + +## Testing your module + +Tests are a great way to ensure that your module stays working when community pull requests come in. The [`tofu test` command](https://opentofu.org/docs/cli/commands/test/) has a host of tools to let you write automated tests for your module so you can merge pull requests safely. + +## Publishing your module + +Once you are happy with your module, [proceed to publishing it](/docs/modules/publishing). \ No newline at end of file diff --git a/frontend/docs/modules/index.md b/frontend/docs/modules/index.md new file mode 100644 index 00000000..09526b10 --- /dev/null +++ b/frontend/docs/modules/index.md @@ -0,0 +1,7 @@ +# The OpenTofu Registry for Module Authors + +This section shows you how to create and publish a module. + +- [Creating a module](/docs/modules/creating) +- [Publishing a module](/docs/modules/publishing) +- [Adding a module to the OpenTofu Registry](/docs/modules/adding) diff --git a/frontend/docs/modules/publishing.md b/frontend/docs/modules/publishing.md new file mode 100644 index 00000000..ada5d476 --- /dev/null +++ b/frontend/docs/modules/publishing.md @@ -0,0 +1,7 @@ +# Publishing an OpenTofu module + +You can host OpenTofu modules in any git repository. However, if you would like to publish the module in the OpenTofu Registry, you will need to host it on [GitHub](https://docs.github.com/en/get-started/start-your-journey). + +Once you pushed your code, make sure to [create a tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) following [semantic versioning](https://semver.org/). This tag will translate to a version in the OpenTofu registry. + +Once you have pushed your tag, you can now [add the module to the Registry](/docs/modules/adding). \ No newline at end of file diff --git a/frontend/docs/providers/adding.md b/frontend/docs/providers/adding.md new file mode 100644 index 00000000..29ce00cc --- /dev/null +++ b/frontend/docs/providers/adding.md @@ -0,0 +1,19 @@ +# Adding your provider to the OpenTofu Registry + +Once you have [published your provider](/docs/providers/publishing), you are ready to add your provider to the OpenTofu Registry. You only need to perform these steps once, the OpenTofu Registry will automatically discover new versions you publish. + +## Adding the provider + +To add your provider, please go to the [OpenTofu Registry repository](https://github.com/opentofu/registry/issues/new/choose) and select `Submit new Provider`. In the `Provider Repository` field please enter `YOURNAME/terraform-provider-YOURPROVIDER` and submit the issue. An OpenTofu team member will review your submission and merge it into the Registry. Your provider should be live within an hour after merging. + +## Adding the GPG key + +After your provider is merged, you can proceed to add your GPG key. You will need to perform the following steps: + +1. Export your *public* GPG key into a text file with ASCII-armor. +2. If your provider is located in an organization, make sure you make [your membership in the organization public](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership). This is required to validate you have the rights to publish a GPG key. +3. Go to the [OpenTofu Registry repository](https://github.com/opentofu/registry/issues/new/choose) and select `Submit new Provider Signing Key`. +4. In the `Provider Namespace` field enter your username or organization name. +5. In the `Provider GPG Key` field paste your GPG key. + +~> The GPG key applies to all providers under your username or organization. Don't submit a GPG key if you have providers that are not signed or are signed with a key you don't have. \ No newline at end of file diff --git a/frontend/docs/providers/creating.md b/frontend/docs/providers/creating.md new file mode 100644 index 00000000..4855bd21 --- /dev/null +++ b/frontend/docs/providers/creating.md @@ -0,0 +1,39 @@ +# Creating an OpenTofu provider + +OpenTofu, itself a fork of Terraform, uses the [Terraform plugin protocol](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol) in order to communicate with providers. Any provider implementing this protocol will also work with OpenTofu. + +## Using the Terraform Plugin Framework (recommended) + +As per the recommendation from HashiCorp for Terraform, the easiest option to write a provider is using the Terraform Plugin Framework. You can find detailed guides for this in the [Terraform documentation](https://developer.hashicorp.com/terraform/plugin/framework). + +## Manually (only for the adventurous) + +~> Support for programming languages other than Go and bypassing the official SDK/framework is very limited. For production use we recommend using Go and the [Terraform Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework). + +OpenTofu supports providers written in any language as long as they can be compiled to a static binary. Providers written in languages that don't compile to a static binary may or may not work, depending on the host operating system. + +In order to start the provider OpenTofu uses [go-plugin](https://github.com/hashicorp/go-plugin). This process is as follows: + +1. OpenTofu starts the plugin with the `PLUGIN_MIN_PORT`, `PLUGIN_MAX_PORT`, `PLUGIN_PROTOCOL_VERSIONS` and the `PLUGIN_CLIENT_CERT` environment variables set. While OpenTofu currently doesn't use them, your implementation should also implement handling the `PLUGIN_UNIX_SOCKET_DIR`, `PLUGIN_UNIX_SOCKET_GROUP`, and `PLUGIN_MULTIPLEX_GRPC` environment variables. +2. On Windows, the plugin will scan from `PLUGIN_MIN_PORT` and `PLUGIN_MAX_PORT` to find an open port and open a TCP listen socket on that port, binding to `127.0.0.1`. +3. On all other systems, the plugin will create a Unix socket in a directory of its choosing. (See the note about the additional environment variables here.) +4. The plugin chooses one of the `PLUGIN_PROTOCOL_VERSIONS` to support. This can be currently version `5` or `6`. +5. The plugin writes the following line to the stdout, terminated by a newline: `|||||\n`. The `` is always `1` and references the go-plugin protocol version. The `` references the plugin protocol version must be `5` or `6` for OpenTofu. The `` can only be `unix` or `tcp`, with the corresponding `` set. The `` must always be `grpc` for OpenTofu. Finally, the `` may contain a raw (not PEM-encoded) certificate with base64 encoding to secure the connection between the plugin and OpenTofu in conjunction with `PLUGIN_CLIENT_CERT`. +6. OpenTofu now sends GRPC requests to the plugin. You can find the protocol definitions for these requests [in the OpenTofu repository](https://github.com/opentofu/opentofu/tree/main/docs/plugin-protocol/). We also recommend reading the [Terraform Plugin Protocol documentation](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol). +7. The plugin may write logs to stderr, which OpenTofu records as plugin logs. + +## OpenTofu-specific enhancements + +### Configured functions + +When calling provider-defined functions (introduced in OpenTofu 1.7 and Terraform 1.8), Terraform does not pass any configuration to the provider. This means, your functions cannot make use of provider configuration if you want to support Terraform. OpenTofu configures the provider, so your functions may make use of this configuration. + +## Things that don't work in OpenTofu (yet) + +### Moving resources between different types ([#1369](https://github.com/opentofu/opentofu/issues/1369)) + +As of OpenTofu 1.8, OpenTofu does not yet implement using the `moved` block between resources of different types. See issue [#1369](https://github.com/opentofu/opentofu/issues/1369) for details. + +## Next steps + +Once you have written your provider code, you can proceed to [write your documentation](/docs/providers/docs). \ No newline at end of file diff --git a/frontend/docs/providers/docs.md b/frontend/docs/providers/docs.md new file mode 100644 index 00000000..e88d1c92 --- /dev/null +++ b/frontend/docs/providers/docs.md @@ -0,0 +1,30 @@ +# Writing documentation for your provider + +In order for your provider to show up in the OpenTofu Registry Search properly, you will need to write some documentation. Tools like [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs) can help you by auto-generating much of the documentation based on your provider schema. + +## Documentation structure + +You can place your documentation in the `docs` folder in your repository. Please create the files using the following naming convention: + +- `/docs/guides/.md` for guides. +- `/docs/resources/.md` for resources. (Note: if your resource is called `yourprovider_yourresource`, you should only include `yourresource` here.) +- `/docs/data-sources/.md` for resources. (Note: same as for resources) +- `/docs/functions/.md` for functions. + +Additionally, if you would like to support CDKTF, you can create the following documents: + +- `/docs/cdktf/[python|typescript|csharp|java|go]/resources/.md` +- `/docs/cdktf/[python|typescript|csharp|java|go]/data-sources/.md` +- `/docs/cdktf/[python|typescript|csharp|java|go]/functions/.md` + +You can include the following header (front matter) in your markdown files: + +```yaml +--- +page_title: Title of the page +subcategory: Subcategory to place the page in on the sidebar (optional) +description: Description of the page +--- +``` + +Once you have written your documentation, you can [proceed to publish your provider](/docs/providers/publishing). \ No newline at end of file diff --git a/frontend/docs/providers/index.md b/frontend/docs/providers/index.md new file mode 100644 index 00000000..104e2000 --- /dev/null +++ b/frontend/docs/providers/index.md @@ -0,0 +1,10 @@ +# The OpenTofu Registry for Provider Authors + +This section of the documentation guides you through the basic steps of creating and publishing a provider in the OpenTofu Registry. The documentation assumes you are familiar with the Go programming language. + +## In this section + +- [Creating a provider](/docs/providers/creating) +- [Writing docs for your provider](/docs/providers/docs) +- [Publishing your provider](/docs/providers/publishing) +- [Adding a provider to the registry](/docs/providers/adding) diff --git a/frontend/docs/providers/publishing.md b/frontend/docs/providers/publishing.md new file mode 100644 index 00000000..2883b360 --- /dev/null +++ b/frontend/docs/providers/publishing.md @@ -0,0 +1,45 @@ +# Publishing a provider version + +Once you have finished [creating your provider](/docs/providers/creating) and [wrote your documentation](/docs/providers/docs), you can proceed to publish your provider. First, create a GitHub repository named `terraform-provider-YOURNAME` and publish your source code in this repository. You can then proceed to [create a GitHub release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). + +~> Note, that your release name **must** start with a `v` and must follow [semantic versioning](https://semver.org/). + +## Using the scaffolding (recommended) + +If you used the [terraform-provider-scaffolding-framework](https://github.com/hashicorp/terraform-provider-scaffolding-framework) as your starting point, it also includes the necessary GitHub Actions and [goreleaser file](https://github.com/hashicorp/terraform-provider-scaffolding-framework/blob/main/.goreleaser.yml) needed to create a release. + +You will need to create the secrets called `GPG_PRIVATE_KEY` and `PASSPHRASE` in order to sign your release. GPG keys ensure the integrity of your provider binaries. While OpenTofu allows you to submit a provider without a GPG key for compatibility reasons, adding a GPG key helps keep your users safe and is also required if you intend to submit your provider to the Terraform Registry. The workflow in the terraform-provider-scaffolding-framework repository assumes you will use a GPG key. + +Please follow the [GitHub documentation on generating a GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key). You do not need to add the public key to your GitHub account, but instead you can [submit it to the OpenTofu Registry](/docs/providers/adding) in the next step. + +~> Keep your private key safe! If your private key becomes public, others will be able to produce correctly signed binaries for your provider! The private key should only be in your GitHub secrets and backed up on your own computer. You should never need to submit the private key anywhere. + +Once this is set up, proceed to create a release named `vYOURVERSION` on GitHub and wait for the GitHub Actions job to complete. + +## Manually (for the adventurous) + +If you are feeling adventurous, you can also create your release artifacts manually. You will need to produce the following artifacts: + +- `terraform-provider-YOURNAME_VERSION_PLATFORM_ARCH.zip` containing your provider binary named `terraform-provider-YOURNAME` or `terraform-provider-YOURNAME.exe` and any supplemental files. (e.g. `terraform-provider-aws_5.68.0_darwin_amd64.zip`) +- `terraform-provider-YOURNAME_SHA256SUMS` containing the SHA256 checksums and filenames for all files in your release, one in each line in the format of ` \n` (e.g. `0501ccb379b74832366860699ca6d5993b164ec44314a054453877d39c384869 terraform-provider-aws_5.68.0_darwin_amd64.zip`) +- `terraform-provider-YOURNAME_SHA256SUMS.sig` containing a detached GPG signature for the SHA256SUMS file (without ASCII-armor). This file is optional for OpenTofu. + +~> The versions in the filenames **must not** contain the `v` prefix. + +OpenTofu supports the following platform names: + +- `darwin` (MacOS) +- `linux` +- `windows` +- `freebsd` +- `openbsd` +- `solaris` + +You can use these in conjunction with the following architecture names: + +- `amd64` +- `arm64` +- `386` +- `arm` + +Once you are done, you can upload your release to GitHub and [submit your provider to the OpenTofu Registry](/docs/providers/adding) and the [Terrafom Registry](https://developer.hashicorp.com/terraform/registry/providers/publishing). diff --git a/frontend/docs/sidebar.json b/frontend/docs/sidebar.json new file mode 100644 index 00000000..462b8f30 --- /dev/null +++ b/frontend/docs/sidebar.json @@ -0,0 +1,82 @@ +[ + { + "title": "Overview", + "path": "index.md", + "slug": "" + }, + { + "title": "For users", + "items": [ + { + "title": "Overview", + "path": "users/index.md", + "slug": "users" + }, + { + "title": "Using a provider", + "path": "users/providers.md", + "slug": "users/providers" + }, + { + "title": "Using a module", + "path": "users/modules.md", + "slug": "users/modules" + } + ] + }, + { + "title": "For provider authors", + "items": [ + { + "title": "Overview", + "path": "providers/index.md", + "slug": "providers" + }, + { + "title": "Creating a provider", + "path": "providers/creating.md", + "slug": "providers/creating" + }, + { + "title": "Writing docs for your provider", + "path": "providers/docs.md", + "slug": "providers/docs" + }, + { + "title": "Publishing your provider", + "path": "providers/publishing.md", + "slug": "providers/publishing" + }, + { + "title": "Adding a provider to the registry", + "path": "providers/adding.md", + "slug": "providers/adding" + } + ] + }, + { + "title": "For module authors", + "items": [ + { + "title": "Overview", + "path": "modules/index.md", + "slug": "modules" + }, + { + "title": "Creating a module", + "path": "modules/creating.md", + "slug": "modules/creating" + }, + { + "title": "Publishing a module", + "path": "modules/publishing.md", + "slug": "modules/publishing" + }, + { + "title": "Adding a module to the Registry", + "path": "modules/adding.md", + "slug": "modules/adding" + } + ] + } +] diff --git a/frontend/docs/users/index.md b/frontend/docs/users/index.md new file mode 100644 index 00000000..f0273c24 --- /dev/null +++ b/frontend/docs/users/index.md @@ -0,0 +1,8 @@ +# The OpenTofu Registry for Users + +OpenTofu is a tool that works with integrations made by the community called *providers*. In addition to that, community-made modules simplify many common tasks. The OpenTofu Registry contains an index pointing to thousands of providers and thousands of modules on GitHub you can use. You can install them automatically by adding a code snippet to your project and running `tofu init`. + +## In this chapter + +- [Using a provider](/docs/users/providers) +- [Using a module](/docs/users/modules) diff --git a/frontend/docs/users/modules.md b/frontend/docs/users/modules.md new file mode 100644 index 00000000..05a84723 --- /dev/null +++ b/frontend/docs/users/modules.md @@ -0,0 +1,28 @@ +# Using a module + +Modules provide reusable pieces of code for your OpenTofu project. The OpenTofu Registry contains references to over 20,000 modules on GitHub created by the community. You can [find a module for your use case using the OpenTofu Registry Search](https://search.opentofu.org/modules/). You can learn more about how modules work in OpenTofu from the [OpenTofu documentation](https://opentofu.org/docs/language/modules/). + +~> The OpenTofu Registry does not perform security scanning on modules, and they may contain malicious code. Inspect any module you intend to use and only use modules from authors you trust. + +## Integrating a module in your project + +Module addresses have three parts: namespaces, names, and target systems. You can include a module in your project by specifying its address and its version: + +```hcl2 +source "my_name_for_the_module" { + source = "NAMESPACE/NAME/TARGETSYSTEM" + version = "v1.2.3" + + # Add parameters for the module here. +} +``` + +Specifying the version tells OpenTofu to fetch the module from the registry. Once added, you can run `tofu init` to download the module. + +For more information about modules, see [the OpenTofu documentation](https://opentofu.org/docs/language/modules/sources/). + +## Reporting provider issues + +If you find a bug in a module, please report the issue directly to the provider author. The OpenTofu team cannot fix module issues. + +-> Module namespaces, names and target systems in the OpenTofu registry translate directly to GitHub URLs in the form of `github.com/NAMESPACE/terraform-TARGETSYSTEM-NAME`. \ No newline at end of file diff --git a/frontend/docs/users/providers.md b/frontend/docs/users/providers.md new file mode 100644 index 00000000..bf54cff5 --- /dev/null +++ b/frontend/docs/users/providers.md @@ -0,0 +1,59 @@ +# Using a provider + +Providers give OpenTofu the ability to call various APIs. The OpenTofu registry currently holds over 4000 such providers created by the community. They provide integrations for a vast range of services, from cloud providers, such as [AWS](https://search.opentofu.org/provider/hashicorp/aws/latest), [Azure](https://search.opentofu.org/provider/hashicorp/azurerm/latest), [GCP](https://search.opentofu.org/provider/hashicorp/google/latest) and more, version control systems, such as [GitHub](https://search.opentofu.org/provider/integrations/github/latest), [GitLab](https://search.opentofu.org/provider/gitlabhq/gitlab/latest), to password manages like [1Password](https://search.opentofu.org/provider/1password/onepassword/latest). You can explore the providers available [using the OpenTofu Registry Search](https://search.opentofu.org/providers/) or learn more about how providers work in OpenTofu using the [OpenTofu documentation](https://opentofu.org/docs/language/providers/). + +~> Providers are binary programs created by their authors that run on your machine. The OpenTofu Registry does not perform security scanning on providers, and they may contain malicious code. There is also no guarantee that the provider binary was compiled from the code in the linked GitHub repository. Only use providers from authors you trust. + +## Integrating a provider into your project + +Once you found a provider for your needs, you can add it to your OpenTofu project in the `terraform` block: + +```hcl2 +terraform { + required_providers { + PROVIDER_NAME_HERE = { + source = "NAMESPACE_HERE/PROVIDER_NAME_HERE" + version = "PROVIDER_VERSION_HERE" + } + } +} +``` + +You can then configure your provider as follows: + +```hcl2 +provider "PROVIDER_NAME_HERE" { + option1 = "value1" + option2 = "value2" +} +``` + +For example, you can configure and use the GitHub provider like this: + +```hcl2 +terraform { + required_providers { + integrations = { + source = "integrations/github" + version = "v6.2.3" + } + } +} + +variable "github_token {} + +provider "github" { + token = var.github_token +} + +resource "github_repository" "myrepo" { + name = "myrepo" +} +``` + +## Reporting provider issues + +If you find a bug in a provider, please report the issue directly to the provider author. The OpenTofu team cannot fix provider issues. + +-> Provider namespaces and names in the OpenTofu registry translate directly to GitHub URLs in the form of `github.com/NAMESPACE/terraform-provider-NAME`. + diff --git a/frontend/package.json b/frontend/package.json index b5ab9019..39b5ae40 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -55,6 +55,8 @@ "typescript": "^5.6.2", "typescript-eslint": "^8.5.0", "unified": "^11.0.5", + "unplugin-macros": "^0.13.3", + "vfile-matter": "^5.0.0", "vite": "^5.4.6", "vite-tsconfig-paths": "^5.0.1" }, diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index ac286f68..ccbdf0e2 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -128,6 +128,12 @@ importers: unified: specifier: ^11.0.5 version: 11.0.5 + unplugin-macros: + specifier: ^0.13.3 + version: 0.13.3(rollup@4.24.0) + vfile-matter: + specifier: ^5.0.0 + version: 5.0.0 vite: specifier: ^5.4.6 version: 5.4.6 @@ -526,6 +532,15 @@ packages: resolution: {integrity: sha512-baiMx18+IMuD1yyvOGaHM9QrVUPGGG0jC+z+IPHnRJWUAUvaKuWKyE8gjDj2rzv3sz9zOGoRSPgeBVHRhZnBlA==} engines: {node: '>=14.0.0'} + '@rollup/pluginutils@5.1.2': + resolution: {integrity: sha512-/FIdS3PyZ39bjZlwqFnWqCOVnW7o963LtKMwQOD0NhQqw22gSr2YY1afu3FxRip4ZCZNsD5jq6Aaz6QV3D/Njw==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/rollup-android-arm-eabi@4.24.0': resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} cpu: [arm] @@ -825,6 +840,10 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} + ast-kit@1.2.1: + resolution: {integrity: sha512-h31wotR7rkFLrlmGPn0kGqOZ/n5EQFvp7dBs400chpHDhHc8BK3gpvyHDluRujuGgeoTAv3dSIMz9BI3JxAWyQ==} + engines: {node: '>=16.14.0'} + autoprefixer@10.4.20: resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==} engines: {node: ^10 || ^12 || >=14} @@ -1152,6 +1171,9 @@ packages: estree-util-is-identifier-name@3.0.0: resolution: {integrity: sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==} + estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} @@ -1497,6 +1519,10 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + magic-string-ast@0.6.2: + resolution: {integrity: sha512-oN3Bcd7ZVt+0VGEs7402qR/tjgjbM7kPlH/z7ufJnzTLVBzXJITRHOJiwMmmYMgZfdoWQsfQcY+iKlxiBppnMA==} + engines: {node: '>=16.14.0'} + magic-string@0.30.11: resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} @@ -2314,6 +2340,19 @@ packages: unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + unplugin-macros@0.13.3: + resolution: {integrity: sha512-IrXVXI62qbDhEd1gpPoScVHpfPyzOgBsAp3tacuD7aCQeBeKZ8XrHLKdMt3eE1n3aR7jyURPbxwRZ/Mcx+pLyA==} + engines: {node: '>=18.12.0'} + + unplugin@1.14.1: + resolution: {integrity: sha512-lBlHbfSFPToDYp9pjXlUEFVxYLaue9f9T1HC+4OHlmj+HnMDdz9oZY+erXfoCe/5V/7gKUSY2jpXPb9S7f0f/w==} + engines: {node: '>=14.0.0'} + peerDependencies: + webpack-sources: ^3 + peerDependenciesMeta: + webpack-sources: + optional: true + update-browserslist-db@1.1.0: resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} hasBin: true @@ -2329,6 +2368,9 @@ packages: vfile-location@5.0.3: resolution: {integrity: sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==} + vfile-matter@5.0.0: + resolution: {integrity: sha512-jhPSqlj8hTSkTXOqyxbUeZAFFVq/iwu/jukcApEqc/7DOidaAth6rDc0Zgg0vWpzUnWkwFP7aK28l6nBmxMqdQ==} + vfile-message@4.0.2: resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} @@ -2407,6 +2449,9 @@ packages: web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} + webpack-virtual-modules@0.6.2: + resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -2817,6 +2862,14 @@ snapshots: '@remix-run/router@1.19.2': {} + '@rollup/pluginutils@5.1.2(rollup@4.24.0)': + dependencies: + '@types/estree': 1.0.5 + estree-walker: 2.0.2 + picomatch: 2.3.1 + optionalDependencies: + rollup: 4.24.0 + '@rollup/rollup-android-arm-eabi@4.24.0': optional: true @@ -3128,6 +3181,11 @@ snapshots: assertion-error@2.0.1: {} + ast-kit@1.2.1: + dependencies: + '@babel/parser': 7.25.6 + pathe: 1.1.2 + autoprefixer@10.4.20(postcss@8.4.45): dependencies: browserslist: 4.23.3 @@ -3475,6 +3533,8 @@ snapshots: estree-util-is-identifier-name@3.0.0: {} + estree-walker@2.0.2: {} + estree-walker@3.0.3: dependencies: '@types/estree': 1.0.5 @@ -3834,6 +3894,10 @@ snapshots: dependencies: yallist: 3.1.1 + magic-string-ast@0.6.2: + dependencies: + magic-string: 0.30.11 + magic-string@0.30.11: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -4903,6 +4967,32 @@ snapshots: unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 + unplugin-macros@0.13.3(rollup@4.24.0): + dependencies: + '@rollup/pluginutils': 5.1.2(rollup@4.24.0) + ast-kit: 1.2.1 + magic-string-ast: 0.6.2 + unplugin: 1.14.1 + vite: 5.4.6 + vite-node: 2.0.5 + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - rollup + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - webpack-sources + + unplugin@1.14.1: + dependencies: + acorn: 8.12.1 + webpack-virtual-modules: 0.6.2 + update-browserslist-db@1.1.0(browserslist@4.23.3): dependencies: browserslist: 4.23.3 @@ -4920,6 +5010,11 @@ snapshots: '@types/unist': 3.0.3 vfile: 6.0.3 + vfile-matter@5.0.0: + dependencies: + vfile: 6.0.3 + yaml: 2.5.1 + vfile-message@4.0.2: dependencies: '@types/unist': 3.0.3 @@ -5000,6 +5095,8 @@ snapshots: web-namespaces@2.0.1: {} + webpack-virtual-modules@0.6.2: {} + which@2.0.2: dependencies: isexe: 2.0.0 diff --git a/frontend/src/components/AnnouncementBar/content.ts b/frontend/src/components/AnnouncementBar/content.ts new file mode 100644 index 00000000..bb8139b7 --- /dev/null +++ b/frontend/src/components/AnnouncementBar/content.ts @@ -0,0 +1,11 @@ +import { unified } from "unified"; +import remarkParse from "remark-parse"; +import remarkRehype from "remark-rehype"; +import rehypeStringify from "rehype-stringify"; +import announcement from "../../../announcement.md?raw"; + +export const content = unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeStringify) + .processSync(announcement).value; diff --git a/frontend/src/components/AnnouncementBar/index.tsx b/frontend/src/components/AnnouncementBar/index.tsx index e490b9d1..01e38eb9 100644 --- a/frontend/src/components/AnnouncementBar/index.tsx +++ b/frontend/src/components/AnnouncementBar/index.tsx @@ -1,8 +1,6 @@ -interface AnnouncementBarProps { - content: string; -} +import { content } from "./content" with { type: "macro" }; -export function AnnouncementBar({ content }: AnnouncementBarProps) { +export function AnnouncementBar() { return (
id.startsWith("module")} /> + id === "docs"} + />