diff --git a/.github/workflows/ci-cli.yml b/.github/workflows/ci-npm-documentation-cli.yml similarity index 96% rename from .github/workflows/ci-cli.yml rename to .github/workflows/ci-npm-documentation-cli.yml index bc63398a9d1..2861b1f7a0b 100644 --- a/.github/workflows/ci-cli.yml +++ b/.github/workflows/ci-npm-documentation-cli.yml @@ -1,6 +1,6 @@ # This file is automatically added by @npmcli/template-oss. Do not edit. -name: CI - cli +name: CI - @npm/documentation-cli on: workflow_dispatch: @@ -87,9 +87,9 @@ jobs: - name: Install Dependencies run: npm i --no-audit --no-fund - name: Lint - run: npm run lint --ignore-scripts -w cli + run: npm run lint --ignore-scripts -w @npm/documentation-cli - name: Post Lint - run: npm run postlint --ignore-scripts -w cli + run: npm run postlint --ignore-scripts -w @npm/documentation-cli test: name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }} @@ -172,4 +172,4 @@ jobs: - name: Add Problem Matcher run: echo "::add-matcher::.github/matchers/tap.json" - name: Test - run: npm test --ignore-scripts -w cli + run: npm test --ignore-scripts -w @npm/documentation-cli diff --git a/.github/workflows/ci-theme.yml b/.github/workflows/ci-npm-documentation-theme.yml similarity index 95% rename from .github/workflows/ci-theme.yml rename to .github/workflows/ci-npm-documentation-theme.yml index 93d23570bbc..de5932fb99b 100644 --- a/.github/workflows/ci-theme.yml +++ b/.github/workflows/ci-npm-documentation-theme.yml @@ -1,6 +1,6 @@ # This file is automatically added by @npmcli/template-oss. Do not edit. -name: CI - theme +name: CI - @npm/documentation-theme on: workflow_dispatch: @@ -87,9 +87,9 @@ jobs: - name: Install Dependencies run: npm i --no-audit --no-fund - name: Lint - run: npm run lint --ignore-scripts -w theme + run: npm run lint --ignore-scripts -w @npm/documentation-theme - name: Post Lint - run: npm run postlint --ignore-scripts -w theme + run: npm run postlint --ignore-scripts -w @npm/documentation-theme test: name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }} @@ -172,4 +172,4 @@ jobs: - name: Add Problem Matcher run: echo "::add-matcher::.github/matchers/tap.json" - name: Test - run: npm test --ignore-scripts -w theme + run: npm test --ignore-scripts -w @npm/documentation-theme diff --git a/.reuse/dep5 b/.reuse/dep5 index 375d6563094..fb62cb51153 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -3,10 +3,10 @@ Upstream-Name: documentation Upstream-Contact: Myles Borins Source: https://github.com/npm/documentation -Files: content/* static/* +Files: content/* static/* src/* Copyright: 2020 GitHub License: CC-BY-4.0 -Files: scripts/* cli/* theme/* src/* .github/* *.md *.js *.json .npmrc .gitignore .nvmrc +Files: scripts/* cli/* theme/* .github/* *.md *.js *.json .npmrc .gitignore .nvmrc Copyright: 2020 GitHub License: MIT diff --git a/CONTENT-MODEL.md b/CONTENT-MODEL.md index b0c27a9e328..e762257971c 100644 --- a/CONTENT-MODEL.md +++ b/CONTENT-MODEL.md @@ -95,7 +95,6 @@ You can use this template when starting a new article. For more information abou --- title: --- -import shared form '../../../src/shared.js' // Conceptual content: What feature is the article about? // Prerequisites (if applicable): Who can use the feature? diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3ff05e0337..51fecb0342d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,7 +74,7 @@ referenced as: There are various places where we want to share content between pages, to prevent copy-pasta. For example, we display a screenshot of the user login dialog repeatedly. Therefore this shared content -is defined in `src/shared.js`, and includes a literal MDX snippet. +is defined in `src/@npm/documentation-theme/shared.js`, and includes a literal MDX snippet. For example, `user-login` is defined with `text` and `image` properties: @@ -88,19 +88,15 @@ m login dialog" />) }, ``` -Since MDX is reactive, you can import the shared data at the top of the -file, just beneath your frontmatter: +Everything exported from `shared.js` is available in all content files under the namespace `shared`. Text content should be wrapped like this: `<>{text}`. -``` +For example, to render the `text` from `user-login` you would do the following: + +```mdx --- title: Using shared content --- -import shared form '../../../src/shared.js' -``` -And then reference the shared content within `<>`: - -``` To login, <>{shared['user-login'].text} ``` @@ -147,7 +143,7 @@ The content pages should include ## Navigation The site's navigation (on the left-hand sidebar of the site) is controlled -by `src/theme/nav.yml`. If you add or remove a page from the site, you'll +by `src/nav.yml`. If you add or remove a page from the site, you'll also want to add or remove it from the navigation configuration. ## CLI diff --git a/cli/package.json b/cli/package.json index 3776f76194c..d1946f8bd18 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,5 +1,5 @@ { - "name": "cli", + "name": "@npm/documentation-cli", "private": true, "repository": { "url": "https://github.com/npm/documentation.git", diff --git a/content/about-npm/index.mdx b/content/about-npm/index.mdx index e618c9aee60..73988ec30b5 100644 --- a/content/about-npm/index.mdx +++ b/content/about-npm/index.mdx @@ -1,6 +1,7 @@ --- title: About npm -redirect_from: [ /getting-started/what-is-npm ] +redirect_from: + - /getting-started/what-is-npm --- npm is the world's largest software registry. Open source developers from every continent use npm to share and borrow packages, and many organizations use npm to manage private development as well. diff --git a/content/getting-started/configuring-your-local-environment/downloading-and-installing-node-js-and-npm.mdx b/content/getting-started/configuring-your-local-environment/downloading-and-installing-node-js-and-npm.mdx index 4170dd62ad4..e864bbd6fe6 100644 --- a/content/getting-started/configuring-your-local-environment/downloading-and-installing-node-js-and-npm.mdx +++ b/content/getting-started/configuring-your-local-environment/downloading-and-installing-node-js-and-npm.mdx @@ -1,6 +1,7 @@ --- title: Downloading and installing Node.js and npm -redirect_from: [ /getting-started/installing-node ] +redirect_from: + - /getting-started/installing-node --- To publish and install packages to and from the public npm registry or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. **We strongly recommend using a Node version manager like [nvm](https://github.com/nvm-sh/nvm) to install Node.js and npm.** We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally. diff --git a/content/getting-started/configuring-your-local-environment/index.mdx b/content/getting-started/configuring-your-local-environment/index.mdx index a396cb6f0f4..1611810fbe7 100644 --- a/content/getting-started/configuring-your-local-environment/index.mdx +++ b/content/getting-started/configuring-your-local-environment/index.mdx @@ -1,6 +1,6 @@ --- title: Configuring your local environment +edit_on_github: false --- - diff --git a/content/getting-started/index.mdx b/content/getting-started/index.mdx index ddbf918d0a0..e9c65fca7ae 100644 --- a/content/getting-started/index.mdx +++ b/content/getting-started/index.mdx @@ -1,6 +1,6 @@ --- title: Getting started +edit_on_github: false --- - diff --git a/content/getting-started/managing-your-npm-user-account/changing-your-npm-username.mdx b/content/getting-started/managing-your-npm-user-account/changing-your-npm-username.mdx index cb46d82b22d..3883a3200f2 100644 --- a/content/getting-started/managing-your-npm-user-account/changing-your-npm-username.mdx +++ b/content/getting-started/managing-your-npm-user-account/changing-your-npm-username.mdx @@ -1,7 +1,6 @@ --- title: Changing your npm username --- -import shared from '../../../src/shared.js' It is not currently possible to change your npm username. You'll need to create a new account and migrate the data to the new account manually. diff --git a/content/getting-started/managing-your-npm-user-account/deleting-your-npm-user-account.mdx b/content/getting-started/managing-your-npm-user-account/deleting-your-npm-user-account.mdx index f228af76c10..1b6b89c7944 100644 --- a/content/getting-started/managing-your-npm-user-account/deleting-your-npm-user-account.mdx +++ b/content/getting-started/managing-your-npm-user-account/deleting-your-npm-user-account.mdx @@ -1,7 +1,6 @@ --- title: Deleting your npm user account --- -import shared from '../../../src/shared.js' From the web, you can delete your npm user account. diff --git a/content/getting-started/managing-your-npm-user-account/index.mdx b/content/getting-started/managing-your-npm-user-account/index.mdx index d0968b5f327..e611d715ac1 100644 --- a/content/getting-started/managing-your-npm-user-account/index.mdx +++ b/content/getting-started/managing-your-npm-user-account/index.mdx @@ -1,6 +1,6 @@ --- title: Managing your npm user account +edit_on_github: false --- - diff --git a/content/getting-started/managing-your-npm-user-account/managing-your-profile-settings.mdx b/content/getting-started/managing-your-npm-user-account/managing-your-profile-settings.mdx index 8158488627c..ab1da01b140 100644 --- a/content/getting-started/managing-your-npm-user-account/managing-your-profile-settings.mdx +++ b/content/getting-started/managing-your-npm-user-account/managing-your-profile-settings.mdx @@ -3,7 +3,6 @@ title: Managing your profile settings redirect_from: - /getting-started/modifying_your_profile_from_command_line --- -import shared from '../../../src/shared.js' You can manage settings for your user account profile from the web or command line. diff --git a/content/getting-started/paying-for-your-npm-user-account/downgrading-to-a-free-user-account-plan.mdx b/content/getting-started/paying-for-your-npm-user-account/downgrading-to-a-free-user-account-plan.mdx index a9ed5526671..0227c14101d 100644 --- a/content/getting-started/paying-for-your-npm-user-account/downgrading-to-a-free-user-account-plan.mdx +++ b/content/getting-started/paying-for-your-npm-user-account/downgrading-to-a-free-user-account-plan.mdx @@ -1,7 +1,6 @@ --- title: Downgrading to a free user account plan --- -import shared from '../../../src/shared.js' diff --git a/content/getting-started/paying-for-your-npm-user-account/index.mdx b/content/getting-started/paying-for-your-npm-user-account/index.mdx index 032d94db8a3..a37cc29520a 100644 --- a/content/getting-started/paying-for-your-npm-user-account/index.mdx +++ b/content/getting-started/paying-for-your-npm-user-account/index.mdx @@ -1,6 +1,6 @@ --- title: Paying for your npm user account +edit_on_github: false --- - diff --git a/content/getting-started/paying-for-your-npm-user-account/updating-user-account-billing-settings.mdx b/content/getting-started/paying-for-your-npm-user-account/updating-user-account-billing-settings.mdx index 5c5a3a69357..ffa7c282d98 100644 --- a/content/getting-started/paying-for-your-npm-user-account/updating-user-account-billing-settings.mdx +++ b/content/getting-started/paying-for-your-npm-user-account/updating-user-account-billing-settings.mdx @@ -1,7 +1,6 @@ --- title: Updating user account billing settings --- -import shared from '../../../src/shared.js' diff --git a/content/getting-started/paying-for-your-npm-user-account/upgrading-to-a-paid-user-account-plan.mdx b/content/getting-started/paying-for-your-npm-user-account/upgrading-to-a-paid-user-account-plan.mdx index 6d7f2310e48..22b90b3e78c 100644 --- a/content/getting-started/paying-for-your-npm-user-account/upgrading-to-a-paid-user-account-plan.mdx +++ b/content/getting-started/paying-for-your-npm-user-account/upgrading-to-a-paid-user-account-plan.mdx @@ -1,7 +1,6 @@ --- title: Upgrading to a paid user account plan --- -import shared from '../../../src/shared.js' diff --git a/content/getting-started/paying-for-your-npm-user-account/viewing-downloading-and-emailing-receipts-for-your-user-account.mdx b/content/getting-started/paying-for-your-npm-user-account/viewing-downloading-and-emailing-receipts-for-your-user-account.mdx index 4c44d0cef42..0c1f9fdfed6 100644 --- a/content/getting-started/paying-for-your-npm-user-account/viewing-downloading-and-emailing-receipts-for-your-user-account.mdx +++ b/content/getting-started/paying-for-your-npm-user-account/viewing-downloading-and-emailing-receipts-for-your-user-account.mdx @@ -1,7 +1,6 @@ --- title: Viewing, downloading, and emailing receipts for your npm user account --- -import shared from '../../../src/shared.js' diff --git a/content/getting-started/setting-up-your-npm-user-account/about-two-factor-authentication.mdx b/content/getting-started/setting-up-your-npm-user-account/about-two-factor-authentication.mdx index c8bba227327..8229a3cfa81 100644 --- a/content/getting-started/setting-up-your-npm-user-account/about-two-factor-authentication.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/about-two-factor-authentication.mdx @@ -1,6 +1,7 @@ --- title: About two-factor authentication -redirect_from: [ /getting-started/using-two-factor-authentication ] +redirect_from: + - /getting-started/using-two-factor-authentication --- [Two-factor authentication (2FA)][2fa] protects against unauthorized access to your account by confirming your identity using: diff --git a/content/getting-started/setting-up-your-npm-user-account/accessing-npm-using-2fa.mdx b/content/getting-started/setting-up-your-npm-user-account/accessing-npm-using-2fa.mdx index c82cc320fdd..349eebce3bc 100644 --- a/content/getting-started/setting-up-your-npm-user-account/accessing-npm-using-2fa.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/accessing-npm-using-2fa.mdx @@ -1,8 +1,8 @@ --- title: Accessing npm using two-factor authentication -redirect_from: [ /getting-started/using-two-factor-authentication ] +redirect_from: + - /getting-started/using-two-factor-authentication --- -import shared from '../../../src/shared.js' ## Sign in from the command line using security-key flow diff --git a/content/getting-started/setting-up-your-npm-user-account/configuring-two-factor-authentication.mdx b/content/getting-started/setting-up-your-npm-user-account/configuring-two-factor-authentication.mdx index ebd3c817a6c..4ae5f3411fd 100644 --- a/content/getting-started/setting-up-your-npm-user-account/configuring-two-factor-authentication.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/configuring-two-factor-authentication.mdx @@ -1,7 +1,6 @@ --- title: Configuring two-factor authentication --- -import shared from '../../../src/shared.js' You can enable two-factor authentication (2FA) on your npm user account to protect against unauthorized access to your account and packages, either by using a [security-key][webauthn] or [time-based one-time password (TOTP)][totp] from a mobile app. diff --git a/content/getting-started/setting-up-your-npm-user-account/index.mdx b/content/getting-started/setting-up-your-npm-user-account/index.mdx index 0f41c00b98b..b10ce6d5ba0 100644 --- a/content/getting-started/setting-up-your-npm-user-account/index.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/index.mdx @@ -1,6 +1,6 @@ --- title: Setting up your npm user account +edit_on_github: false --- - diff --git a/content/getting-started/setting-up-your-npm-user-account/receiving-a-one-time-password-over-email.mdx b/content/getting-started/setting-up-your-npm-user-account/receiving-a-one-time-password-over-email.mdx index a0ce22a3dbe..77e147a3407 100644 --- a/content/getting-started/setting-up-your-npm-user-account/receiving-a-one-time-password-over-email.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/receiving-a-one-time-password-over-email.mdx @@ -1,7 +1,6 @@ --- title: Receiving a one-time password over email --- -import shared from '../../../src/shared.js' For your security, npm may require additional verification to allow you to log in to your account. If you do not have [two-factor authentication](configuring-two-factor-authentication) enabled, you may be asked to verify yourself with a one-time password sent to the email address configured for your account. diff --git a/content/getting-started/setting-up-your-npm-user-account/recovering-your-2fa-enabled-account.mdx b/content/getting-started/setting-up-your-npm-user-account/recovering-your-2fa-enabled-account.mdx index e6e1592fbe0..4a03839c08c 100644 --- a/content/getting-started/setting-up-your-npm-user-account/recovering-your-2fa-enabled-account.mdx +++ b/content/getting-started/setting-up-your-npm-user-account/recovering-your-2fa-enabled-account.mdx @@ -1,7 +1,6 @@ --- title: Recovering your 2FA-enabled account --- -import shared from '../../../src/shared.js' When you have two-factor access enabled on your account, and you lose access to your 2FA device, you may be able to recover your account using the following methods. diff --git a/content/getting-started/troubleshooting/generating-and-locating-npm-debug.log-files.mdx b/content/getting-started/troubleshooting/generating-and-locating-npm-debug.log-files.mdx index a16fceecf4a..eb4e172b59c 100644 --- a/content/getting-started/troubleshooting/generating-and-locating-npm-debug.log-files.mdx +++ b/content/getting-started/troubleshooting/generating-and-locating-npm-debug.log-files.mdx @@ -3,7 +3,6 @@ title: Generating and locating npm-debug.log files redirect_from: - /generating-and-locating-npm-debug-log-files --- -import shared from '../../../src/shared.js' When a package fails to install or publish, the npm CLI will generate an `npm-debug.log` file. This log file can help you figure out what went wrong. diff --git a/content/getting-started/troubleshooting/index.mdx b/content/getting-started/troubleshooting/index.mdx index bafbc510c67..bbbe01bb023 100644 --- a/content/getting-started/troubleshooting/index.mdx +++ b/content/getting-started/troubleshooting/index.mdx @@ -1,6 +1,6 @@ --- title: Troubleshooting +edit_on_github: false --- - diff --git a/content/index.mdx b/content/index.mdx index 2254ea79fe0..5e706f8a05e 100644 --- a/content/index.mdx +++ b/content/index.mdx @@ -1,10 +1,10 @@ --- title: npm Documentation -github_path: src/nav-base.yml +github_path: src/nav.yml +edit_on_github: false --- -import {HeroLayout, Index} from 'theme' +import HeroLayout from '@npm/documentation-theme/src/layout/hero' export default HeroLayout - diff --git a/content/integrations/index.mdx b/content/integrations/index.mdx index a2914eb0bf3..4bb0bf903ca 100644 --- a/content/integrations/index.mdx +++ b/content/integrations/index.mdx @@ -1,6 +1,6 @@ --- title: Integrations +edit_on_github: false --- - diff --git a/content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx b/content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx index 32241e566fa..c34cf8610f7 100644 --- a/content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx +++ b/content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx @@ -1,6 +1,7 @@ --- title: Creating and viewing access tokens -redirect_from: [ /creating-and-viewing-authentication-tokens ] +redirect_from: + - /creating-and-viewing-authentication-tokens --- You can [create](#creating-access-tokens) and [view](#viewing-access-tokens) access tokens from the website and command line interface (CLI). diff --git a/content/integrations/integrating-npm-with-external-services/index.mdx b/content/integrations/integrating-npm-with-external-services/index.mdx index 9c646e22585..6c1680aefb7 100644 --- a/content/integrations/integrating-npm-with-external-services/index.mdx +++ b/content/integrations/integrating-npm-with-external-services/index.mdx @@ -1,6 +1,6 @@ --- title: Integrating npm with external services +edit_on_github: false --- - diff --git a/content/integrations/integrating-npm-with-external-services/revoking-access-tokens.mdx b/content/integrations/integrating-npm-with-external-services/revoking-access-tokens.mdx index afe4fe449e5..1db2daf624e 100644 --- a/content/integrations/integrating-npm-with-external-services/revoking-access-tokens.mdx +++ b/content/integrations/integrating-npm-with-external-services/revoking-access-tokens.mdx @@ -1,6 +1,7 @@ --- title: Revoking access tokens -redirect_from: [ /revoking-authentication-tokens ] +redirect_from: + - /revoking-authentication-tokens --- To keep your account and packages secure, we strongly recommend revoking (deleting) tokens you no longer need or that have been compromised. You can revoke any token you have created. diff --git a/content/organizations/creating-and-managing-organizations/converting-your-user-account-to-an-organization.mdx b/content/organizations/creating-and-managing-organizations/converting-your-user-account-to-an-organization.mdx index e686ea0fffd..fe45e566704 100644 --- a/content/organizations/creating-and-managing-organizations/converting-your-user-account-to-an-organization.mdx +++ b/content/organizations/creating-and-managing-organizations/converting-your-user-account-to-an-organization.mdx @@ -3,7 +3,6 @@ title: Converting your user account to an organization redirect_from: - /converting-your-user-account-to-an-org --- -import shared from '../../../src/shared.js' If you have an npm user account, you can convert your user account to an organization. When you convert your user account to an organization, we will: diff --git a/content/organizations/creating-and-managing-organizations/creating-an-organization.mdx b/content/organizations/creating-and-managing-organizations/creating-an-organization.mdx index 9e1480acc0b..1ec58d67222 100644 --- a/content/organizations/creating-and-managing-organizations/creating-an-organization.mdx +++ b/content/organizations/creating-and-managing-organizations/creating-an-organization.mdx @@ -4,7 +4,6 @@ redirect_from: - /orgs/creating-an-org - /creating-an-org --- -import shared from '../../../src/shared.js' Any npm user can create an organization to manage contributor access to packages governed by the organization. diff --git a/content/organizations/creating-and-managing-organizations/deleting-an-organization.mdx b/content/organizations/creating-and-managing-organizations/deleting-an-organization.mdx index 5b439e90a69..1354388e48b 100644 --- a/content/organizations/creating-and-managing-organizations/deleting-an-organization.mdx +++ b/content/organizations/creating-and-managing-organizations/deleting-an-organization.mdx @@ -3,7 +3,6 @@ title: Deleting an organization redirect_from: - /deleting-an-org --- -import shared from '../../../src/shared.js' An organization administrator can delete the organization; packages in the organization will also [be deleted](/unpublishing-packages-from-the-registry) if they fulfill the diff --git a/content/organizations/creating-and-managing-organizations/index.mdx b/content/organizations/creating-and-managing-organizations/index.mdx index 6e9fae4a11f..40f564dac64 100644 --- a/content/organizations/creating-and-managing-organizations/index.mdx +++ b/content/organizations/creating-and-managing-organizations/index.mdx @@ -2,7 +2,7 @@ title: Creating and managing organizations redirect_from: - /orgs/creating-and-managing-orgs +edit_on_github: false --- - diff --git a/content/organizations/creating-and-managing-organizations/requiring-two-factor-authentication-in-your-organization.mdx b/content/organizations/creating-and-managing-organizations/requiring-two-factor-authentication-in-your-organization.mdx index 40946f5d37b..81eefa154ed 100644 --- a/content/organizations/creating-and-managing-organizations/requiring-two-factor-authentication-in-your-organization.mdx +++ b/content/organizations/creating-and-managing-organizations/requiring-two-factor-authentication-in-your-organization.mdx @@ -1,7 +1,6 @@ --- title: Requiring two-factor authentication in your organization --- -import shared from '../../../src/shared.js' Organization owners can require organization members to enable two-factor authentication for their personal accounts, making it harder for malicious actors to access an organization's packages and settings diff --git a/content/organizations/index.mdx b/content/organizations/index.mdx index acf69bf9fa2..333d170fe9f 100644 --- a/content/organizations/index.mdx +++ b/content/organizations/index.mdx @@ -3,12 +3,9 @@ title: Organizations redirect_from: - /getting-started/working-with-orgs - /orgs +edit_on_github: false --- -import {Link} from '@primer/components' -import shared from '../../src/shared.js' - <>Organizations allow teams of contributors to read and write public and private packages. Organizations are free when they publish public packages. When organizations publish private packages, an npm Teams subscription is required. For more information on npm Teams pricing, see our products page. - diff --git a/content/organizations/managing-organization-members/adding-members-to-your-organization.mdx b/content/organizations/managing-organization-members/adding-members-to-your-organization.mdx index 8341a2b9144..5a2320adcfb 100644 --- a/content/organizations/managing-organization-members/adding-members-to-your-organization.mdx +++ b/content/organizations/managing-organization-members/adding-members-to-your-organization.mdx @@ -3,7 +3,6 @@ title: Adding members to your organization redirect_from: - /adding-members-to-your-org --- -import shared from '../../../src/shared.js' As an organization owner, you can add other npm users to your organization to give them read or read and write access to public and private packages within your organization's scope, as well as public unscoped packages governed by your organization. diff --git a/content/organizations/managing-organization-members/index.mdx b/content/organizations/managing-organization-members/index.mdx index 526198421d2..363f771c3c2 100644 --- a/content/organizations/managing-organization-members/index.mdx +++ b/content/organizations/managing-organization-members/index.mdx @@ -2,7 +2,7 @@ title: Managing organization members redirect_from: - /orgs/managing-org-members +edit_on_github: false --- - diff --git a/content/organizations/managing-organization-members/managing-organization-permissions.mdx b/content/organizations/managing-organization-members/managing-organization-permissions.mdx index 03555de6048..11714c2a216 100644 --- a/content/organizations/managing-organization-members/managing-organization-permissions.mdx +++ b/content/organizations/managing-organization-members/managing-organization-permissions.mdx @@ -3,7 +3,6 @@ title: Managing organization permissions redirect_from: - /managing-org-permissions --- -import shared from '../../../src/shared.js' As an organization owner, you can change the role of any member of your organization to add or remove permissions on the organization for that member. diff --git a/content/organizations/managing-organization-members/organization-roles-and-permissions.mdx b/content/organizations/managing-organization-members/organization-roles-and-permissions.mdx index 99ee196472e..12aacdfc270 100644 --- a/content/organizations/managing-organization-members/organization-roles-and-permissions.mdx +++ b/content/organizations/managing-organization-members/organization-roles-and-permissions.mdx @@ -3,7 +3,6 @@ title: Organization roles and permissions redirect_from: - /org-roles-and-permissions --- -import shared from '../../../src/shared.js' There are three roles in an organization: diff --git a/content/organizations/managing-organization-members/removing-members-from-your-organization.mdx b/content/organizations/managing-organization-members/removing-members-from-your-organization.mdx index 59f91ec8c86..42690e718cd 100644 --- a/content/organizations/managing-organization-members/removing-members-from-your-organization.mdx +++ b/content/organizations/managing-organization-members/removing-members-from-your-organization.mdx @@ -3,7 +3,6 @@ title: Removing members from your organization redirect_from: - /removing-members-from-your-org --- -import shared from '../../../src/shared.js' As an organization owner, you can remove members from your organization if they are no longer collaborating on packages owned or governed by your organization. diff --git a/content/organizations/managing-organization-packages/configuring-your-npm-client-with-your-organization-settings.mdx b/content/organizations/managing-organization-packages/configuring-your-npm-client-with-your-organization-settings.mdx index 751726a34a2..717a925a54e 100644 --- a/content/organizations/managing-organization-packages/configuring-your-npm-client-with-your-organization-settings.mdx +++ b/content/organizations/managing-organization-packages/configuring-your-npm-client-with-your-organization-settings.mdx @@ -3,7 +3,6 @@ title: Configuring your npm client with your organization settings redirect_from: - /configuring-your-npm-client-with-your-org-settings --- -import shared from '../../../src/shared.js' As an organization member, you can configure your npm client to: diff --git a/content/organizations/managing-organization-packages/creating-and-publishing-an-organization-scoped-package.mdx b/content/organizations/managing-organization-packages/creating-and-publishing-an-organization-scoped-package.mdx index 666d7e8befe..567fc21be5e 100644 --- a/content/organizations/managing-organization-packages/creating-and-publishing-an-organization-scoped-package.mdx +++ b/content/organizations/managing-organization-packages/creating-and-publishing-an-organization-scoped-package.mdx @@ -3,7 +3,6 @@ title: Creating and publishing an organization scoped package redirect_from: - /creating-and-publishing-an-org-scoped-package --- -import shared from '../../../src/shared.js' As an organization member, you can create and publish public and private packages within the organization's scope. diff --git a/content/organizations/managing-organization-packages/index.mdx b/content/organizations/managing-organization-packages/index.mdx index 884b5e8860a..91a348fb681 100644 --- a/content/organizations/managing-organization-packages/index.mdx +++ b/content/organizations/managing-organization-packages/index.mdx @@ -2,7 +2,7 @@ title: Managing organization packages redirect_from: - /orgs/managing-org-packages +edit_on_github: false --- - diff --git a/content/organizations/managing-teams/adding-organization-members-to-teams.mdx b/content/organizations/managing-teams/adding-organization-members-to-teams.mdx index 6a37bd09c75..d00bb1bf901 100644 --- a/content/organizations/managing-teams/adding-organization-members-to-teams.mdx +++ b/content/organizations/managing-teams/adding-organization-members-to-teams.mdx @@ -3,7 +3,6 @@ title: Adding organization members to teams redirect_from: - /adding-org-members-to-teams --- -import shared from '../../../src/shared.js' As an organization owner or team admin, you can add organization members to teams to give them access to a specific set of packages governed by the organization. diff --git a/content/organizations/managing-teams/creating-teams.mdx b/content/organizations/managing-teams/creating-teams.mdx index ba81cbeb1b0..bbb88001272 100644 --- a/content/organizations/managing-teams/creating-teams.mdx +++ b/content/organizations/managing-teams/creating-teams.mdx @@ -1,7 +1,6 @@ --- title: Creating teams --- -import shared from '../../../src/shared.js' As an organization owner or team admin, you can create teams to manage access to sets of packages governed by your organization. diff --git a/content/organizations/managing-teams/index.mdx b/content/organizations/managing-teams/index.mdx index 9743279b2e5..f1ecdb7f0d7 100644 --- a/content/organizations/managing-teams/index.mdx +++ b/content/organizations/managing-teams/index.mdx @@ -2,7 +2,7 @@ title: Managing teams redirect_from: - /orgs/managing-teams +edit_on_github: false --- - diff --git a/content/organizations/managing-teams/managing-team-access-to-organization-packages.mdx b/content/organizations/managing-teams/managing-team-access-to-organization-packages.mdx index 147137e880c..d1fa6fa0cb0 100644 --- a/content/organizations/managing-teams/managing-team-access-to-organization-packages.mdx +++ b/content/organizations/managing-teams/managing-team-access-to-organization-packages.mdx @@ -4,7 +4,6 @@ redirect_from: - /managing-team-access-to-org-packages - /managing-team-access-to-packages --- -import shared from '../../../src/shared.js' As an organization owner or team admin, you can add or remove package access to or from teams in your organization. diff --git a/content/organizations/managing-teams/removing-organization-members-from-teams.mdx b/content/organizations/managing-teams/removing-organization-members-from-teams.mdx index 089ad8b099c..0f65e7a1696 100644 --- a/content/organizations/managing-teams/removing-organization-members-from-teams.mdx +++ b/content/organizations/managing-teams/removing-organization-members-from-teams.mdx @@ -3,7 +3,6 @@ title: Removing organization members from teams redirect_from: - /removing-org-members-from-teams --- -import shared from '../../../src/shared.js' As an organization owner or team admin, you can remove organization members from teams if they no longer need access to packages accessible to the team. diff --git a/content/organizations/managing-teams/removing-teams.mdx b/content/organizations/managing-teams/removing-teams.mdx index efa1b1f370e..b3b04f9c324 100644 --- a/content/organizations/managing-teams/removing-teams.mdx +++ b/content/organizations/managing-teams/removing-teams.mdx @@ -1,7 +1,6 @@ --- title: Removing teams --- -import shared from '../../../src/shared.js' As an organization owner or team admin, you can remove teams that no longer need access to a set of packages governed by your organization. Removing the team will not remove the team members or packages from your organization. diff --git a/content/organizations/paying-for-your-organization/downgrading-to-a-free-organization-plan.mdx b/content/organizations/paying-for-your-organization/downgrading-to-a-free-organization-plan.mdx index c0caa1eaa66..37f0048558d 100644 --- a/content/organizations/paying-for-your-organization/downgrading-to-a-free-organization-plan.mdx +++ b/content/organizations/paying-for-your-organization/downgrading-to-a-free-organization-plan.mdx @@ -3,7 +3,6 @@ title: Downgrading to a free organization plan redirect_from: - /downgrading-to-a-free-org-plan --- -import shared from '../../../src/shared.js' diff --git a/content/organizations/paying-for-your-organization/index.mdx b/content/organizations/paying-for-your-organization/index.mdx index b30ae9d9633..a5c210b73c3 100644 --- a/content/organizations/paying-for-your-organization/index.mdx +++ b/content/organizations/paying-for-your-organization/index.mdx @@ -2,7 +2,7 @@ title: Paying for your organization redirect_from: - /orgs/paying-for-your-org +edit_on_github: false --- - diff --git a/content/organizations/paying-for-your-organization/updating-organization-billing-settings.mdx b/content/organizations/paying-for-your-organization/updating-organization-billing-settings.mdx index cca76ff819b..54c7c55b996 100644 --- a/content/organizations/paying-for-your-organization/updating-organization-billing-settings.mdx +++ b/content/organizations/paying-for-your-organization/updating-organization-billing-settings.mdx @@ -3,7 +3,6 @@ title: Updating organization billing settings redirect_from: - /updating-org-billing-settings --- -import shared from '../../../src/shared.js' diff --git a/content/organizations/paying-for-your-organization/upgrading-to-a-paid-organization-plan.mdx b/content/organizations/paying-for-your-organization/upgrading-to-a-paid-organization-plan.mdx index a624b4c0c71..86f404398d2 100644 --- a/content/organizations/paying-for-your-organization/upgrading-to-a-paid-organization-plan.mdx +++ b/content/organizations/paying-for-your-organization/upgrading-to-a-paid-organization-plan.mdx @@ -3,7 +3,6 @@ title: Upgrading to a paid organization plan redirect_from: - /upgrading-to-a-paid-org-plan --- -import shared from '../../../src/shared.js' diff --git a/content/organizations/paying-for-your-organization/viewing-downloading-and-emailing-receipts-for-your-organization.mdx b/content/organizations/paying-for-your-organization/viewing-downloading-and-emailing-receipts-for-your-organization.mdx index e79e13aa2b7..33c57b6d61d 100644 --- a/content/organizations/paying-for-your-organization/viewing-downloading-and-emailing-receipts-for-your-organization.mdx +++ b/content/organizations/paying-for-your-organization/viewing-downloading-and-emailing-receipts-for-your-organization.mdx @@ -3,7 +3,6 @@ title: Viewing, downloading, and emailing receipts for your organization redirect_from: - /viewing-downloading-and-emailing-receipts-for-your-org --- -import shared from '../../../src/shared.js' diff --git a/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-private-packages.mdx b/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-private-packages.mdx index 0e22c5082a8..756c9efc54c 100644 --- a/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-private-packages.mdx +++ b/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-private-packages.mdx @@ -3,7 +3,6 @@ title: Creating and publishing private packages redirect_from: - /private-modules/intro --- -import shared from '../../../src/shared.js' To share your code with a limited set of users or teams, you can publish private user-scoped or organization-scoped packages to the npm registry. diff --git a/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-scoped-public-packages.mdx b/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-scoped-public-packages.mdx index d09cc30b616..e20b5691758 100644 --- a/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-scoped-public-packages.mdx +++ b/content/packages-and-modules/contributing-packages-to-the-registry/creating-and-publishing-scoped-public-packages.mdx @@ -1,7 +1,6 @@ --- title: Creating and publishing scoped public packages --- -import shared from '../../../src/shared.js' To share your code publicly in a user or organization namespace, you can publish public user-scoped or organization-scoped packages to the npm registry. diff --git a/content/packages-and-modules/contributing-packages-to-the-registry/index.mdx b/content/packages-and-modules/contributing-packages-to-the-registry/index.mdx index 0a7966aa4ed..10dba8b97f8 100644 --- a/content/packages-and-modules/contributing-packages-to-the-registry/index.mdx +++ b/content/packages-and-modules/contributing-packages-to-the-registry/index.mdx @@ -1,7 +1,8 @@ --- title: Contributing packages to the registry -redirect_from: [ /getting-started/publishing-npm-packages ] +redirect_from: + - /getting-started/publishing-npm-packages +edit_on_github: false --- - diff --git a/content/packages-and-modules/getting-packages-from-the-registry/index.mdx b/content/packages-and-modules/getting-packages-from-the-registry/index.mdx index 240800dfeb0..b58de94f513 100644 --- a/content/packages-and-modules/getting-packages-from-the-registry/index.mdx +++ b/content/packages-and-modules/getting-packages-from-the-registry/index.mdx @@ -1,6 +1,6 @@ --- title: Getting packages from the registry +edit_on_github: false --- - diff --git a/content/packages-and-modules/index.mdx b/content/packages-and-modules/index.mdx index efc1cc8d9b9..f173755dacd 100644 --- a/content/packages-and-modules/index.mdx +++ b/content/packages-and-modules/index.mdx @@ -1,6 +1,6 @@ --- title: Packages and modules +edit_on_github: false --- - diff --git a/content/packages-and-modules/introduction-to-packages-and-modules/index.mdx b/content/packages-and-modules/introduction-to-packages-and-modules/index.mdx index 2d820d74b15..ed294ef9faf 100644 --- a/content/packages-and-modules/introduction-to-packages-and-modules/index.mdx +++ b/content/packages-and-modules/introduction-to-packages-and-modules/index.mdx @@ -1,6 +1,6 @@ --- title: Introduction to packages and modules +edit_on_github: false --- - diff --git a/content/packages-and-modules/securing-your-code/index.mdx b/content/packages-and-modules/securing-your-code/index.mdx index 1dba5f6bdbe..4e87bacfd54 100644 --- a/content/packages-and-modules/securing-your-code/index.mdx +++ b/content/packages-and-modules/securing-your-code/index.mdx @@ -1,6 +1,6 @@ --- title: Securing your code +edit_on_github: false --- - diff --git a/content/packages-and-modules/securing-your-code/requiring-2fa-for-package-publishing-and-settings-modification.mdx b/content/packages-and-modules/securing-your-code/requiring-2fa-for-package-publishing-and-settings-modification.mdx index 3e87fb8c9e4..1d3f6c9e9ca 100644 --- a/content/packages-and-modules/securing-your-code/requiring-2fa-for-package-publishing-and-settings-modification.mdx +++ b/content/packages-and-modules/securing-your-code/requiring-2fa-for-package-publishing-and-settings-modification.mdx @@ -1,7 +1,6 @@ --- title: Requiring 2FA for package publishing and settings modification --- -import shared from '../../../src/shared.js' To protect your packages, as a package publisher, you can require everyone who has write access to a package to have two-factor authentication (2FA) enabled. This will require that users provide 2FA credentials in addition to their login token when they publish the package. For more information, see "[Configuring two-factor authentication][config-2fa]". diff --git a/content/packages-and-modules/updating-and-managing-your-published-packages/deprecating-and-undeprecating-packages-or-package-versions.mdx b/content/packages-and-modules/updating-and-managing-your-published-packages/deprecating-and-undeprecating-packages-or-package-versions.mdx index ff496a3ebf0..ea101aadd6a 100644 --- a/content/packages-and-modules/updating-and-managing-your-published-packages/deprecating-and-undeprecating-packages-or-package-versions.mdx +++ b/content/packages-and-modules/updating-and-managing-your-published-packages/deprecating-and-undeprecating-packages-or-package-versions.mdx @@ -1,7 +1,6 @@ --- title: Deprecating and undeprecating packages or package versions --- -import shared from '../../../src/shared.js' If you no longer wish to maintain a package, or if you would like to encourage users to update to a new or different version, you can [deprecate][deprecate-cli] it. Deprecating a package or version will print a message to the terminal when a user installs it. diff --git a/content/packages-and-modules/updating-and-managing-your-published-packages/index.mdx b/content/packages-and-modules/updating-and-managing-your-published-packages/index.mdx index 9373eb474b5..cbf6cc7374e 100644 --- a/content/packages-and-modules/updating-and-managing-your-published-packages/index.mdx +++ b/content/packages-and-modules/updating-and-managing-your-published-packages/index.mdx @@ -1,6 +1,6 @@ --- title: Updating and managing your published packages +edit_on_github: false --- - diff --git a/content/packages-and-modules/updating-and-managing-your-published-packages/unpublishing-packages-from-the-registry.mdx b/content/packages-and-modules/updating-and-managing-your-published-packages/unpublishing-packages-from-the-registry.mdx index 15b521b8ae9..a47d091b262 100644 --- a/content/packages-and-modules/updating-and-managing-your-published-packages/unpublishing-packages-from-the-registry.mdx +++ b/content/packages-and-modules/updating-and-managing-your-published-packages/unpublishing-packages-from-the-registry.mdx @@ -1,7 +1,6 @@ --- title: Unpublishing packages from the registry --- -import shared from '../../../src/shared.js' As a package owner or collaborator, if your package has no dependents, you can permanently remove it from the npm registry by using the CLI. You can [unpublish](https://docs.npmjs.com/cli/commands/npm-unpublish) within 72 hours of the initial publish; beyond 72 hours, you can still unpublish your package if [it meets certain criteria](https://www.npmjs.com/policies/unpublish). diff --git a/content/policies/index.mdx b/content/policies/index.mdx index 645799b03d1..164b406defe 100644 --- a/content/policies/index.mdx +++ b/content/policies/index.mdx @@ -5,7 +5,6 @@ edit_on_github: false These are the legal policies of npm, Inc. - These are updated from time to time. Their sources are stored in a git repository at [https://github.com/npm/documentation/tree/main/content/policies](https://github.com/npm/documentation/tree/main/content/policies). diff --git a/gatsby-config.js b/gatsby-config.js index f3d3b635607..62d27cf8321 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -12,7 +12,7 @@ module.exports = { { resolve: './theme', options: { - icon: './src/images/npm-favicon.png', + icon: './static/favicon.png', showContributors: false, repo: { url: 'https://github.com/npm/documentation', diff --git a/gatsby-node.js b/gatsby-node.js new file mode 100644 index 00000000000..9ec34ee456b --- /dev/null +++ b/gatsby-node.js @@ -0,0 +1,20 @@ +exports.onCreateNode = ({ node, actions, getNode }) => { + if (node.internal.type === 'Mdx') { + const { name, relativeDirectory: dir } = getNode(node.parent) + + // These paths are unchanged: + // - directory indexes + // - all cli paths + // - all policies paths + if (name === 'index' || dir.startsWith('cli/') || dir.startsWith('policies/')) { + return + } + + // otherwise, omit the directory path and use the filename as the slug + actions.createNodeField({ + name: 'slug', + node, + value: name, + }) + } +} diff --git a/package-lock.json b/package-lock.json index c73469104ce..7d2dc693dfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,21 @@ { - "name": "npm-documentation", + "name": "@npm/documentation", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "npm-documentation", + "name": "@npm/documentation", "version": "1.0.0", "workspaces": [ "cli/", "theme/" ], "dependencies": { + "@npm/documentation-theme": "^1.0.0", "gatsby": "^4.25.7", - "gatsby-plugin-meta-redirect": "^1.1.1", "react": "^17.0.2", - "react-dom": "^17.0.2", - "theme": "^1.0.0" + "react-dom": "^17.0.2" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.2", @@ -30,6 +29,7 @@ } }, "cli": { + "name": "@npm/documentation-cli", "dependencies": { "@octokit/rest": "^20.0.2", "front-matter": "^4.0.2", @@ -5034,6 +5034,14 @@ "node": ">= 8" } }, + "node_modules/@npm/documentation-cli": { + "resolved": "cli", + "link": true + }, + "node_modules/@npm/documentation-theme": { + "resolved": "theme", + "link": true + }, "node_modules/@npmcli/agent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-2.2.0.tgz", @@ -11100,10 +11108,6 @@ "node": ">=6" } }, - "node_modules/cli": { - "resolved": "cli", - "link": true - }, "node_modules/cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", @@ -31839,10 +31843,6 @@ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" }, - "node_modules/theme": { - "resolved": "theme", - "link": true - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -34069,6 +34069,7 @@ } }, "theme": { + "name": "@npm/documentation-theme", "version": "1.0.0", "license": "MIT", "dependencies": { @@ -34087,6 +34088,7 @@ "gatsby-plugin-catch-links": "^4.25.0", "gatsby-plugin-manifest": "^4.25.0", "gatsby-plugin-mdx": "^3.20.0", + "gatsby-plugin-meta-redirect": "^1.1.1", "gatsby-plugin-react-helmet": "^5.25.0", "gatsby-plugin-styled-components": "^5.25.0", "gatsby-source-filesystem": "^4.25.0", diff --git a/package.json b/package.json index 665c8589790..6e2ab77cb15 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "npm-documentation", + "name": "@npm/documentation", "version": "1.0.0", "repository": { "type": "git", @@ -7,8 +7,9 @@ }, "private": true, "scripts": { - "develop": "gatsby develop", - "build": "NODE_OPTIONS=--max-old-space-size=7168 gatsby build", + "develop": "NODE_OPTIONS=--max-old-space-size=8192 gatsby develop", + "build": "NODE_OPTIONS=--max-old-space-size=8192 gatsby build", + "clean": "rm -rf .cache/ public/", "serve": "gatsby serve", "lint": "eslint \"**/*.js\"", "postlint": "template-oss-check", @@ -25,10 +26,10 @@ "theme/" ], "dependencies": { + "@npm/documentation-theme": "^1.0.0", "gatsby": "^4.25.7", "react": "^17.0.2", - "react-dom": "^17.0.2", - "theme": "^1.0.0" + "react-dom": "^17.0.2" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.2", diff --git a/src/theme/header-nav.yml b/src/@npm/documentation-theme/header-nav.yml similarity index 100% rename from src/theme/header-nav.yml rename to src/@npm/documentation-theme/header-nav.yml diff --git a/src/theme/nav.yml b/src/@npm/documentation-theme/nav.yml similarity index 100% rename from src/theme/nav.yml rename to src/@npm/documentation-theme/nav.yml diff --git a/src/shared.js b/src/@npm/documentation-theme/shared.js similarity index 98% rename from src/shared.js rename to src/@npm/documentation-theme/shared.js index ffe8da7c9f2..66d5914b4a6 100644 --- a/src/shared.js +++ b/src/@npm/documentation-theme/shared.js @@ -1,8 +1,6 @@ import React from 'react' -import { Link } from '@primer/components' -import { Note, Screenshot } from 'theme' -const shared = { +export default ({ Link, Screenshot, Note }) => ({ /* User login */ 'user-login': { text: (<>On the npm "Sign In" page, enter your account details and click Sign In.), @@ -211,6 +209,4 @@ const shared = { 'enterprise-migration-requirements': { text: (<>Note: Using pneumatic-tubes for migration requires
  • Node 8+
  • npm 5+ (to install or upgrade, run npm install npm@latest -g)
), }, -} - -export default shared +}) diff --git a/src/README.md b/src/README.md new file mode 100644 index 00000000000..79719b1f563 --- /dev/null +++ b/src/README.md @@ -0,0 +1,5 @@ +# Gatsby src/ dir + +This directory is only used to shadow files inside the root `theme/` directory. Note that the name of the directory much match the name of the theme in `theme/package.json`, which is `@npm/documentation-theme`. + +See [the Gatsby docs](https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/shadowing/) for more information. \ No newline at end of file diff --git a/src/images/npm-favicon.png b/src/images/npm-favicon.png deleted file mode 100644 index 2ba9b8cccb1..00000000000 Binary files a/src/images/npm-favicon.png and /dev/null differ diff --git a/src/images/npm.png b/static/favicon.png similarity index 100% rename from src/images/npm.png rename to static/favicon.png diff --git a/theme/README.md b/theme/README.md index de87b6889ee..be308871f9a 100644 --- a/theme/README.md +++ b/theme/README.md @@ -1,32 +1,23 @@ # theme -This theme is a simple fork of the excellent gatsby-theme-doctocat included in primer's [primer.style/doctocat](https://primer.style/doctocat). - -This theme just gives it a little more npm flavor. - ```javascript // gatsby-config.js module.exports = { - siteMetadata: { - ... - }, plugins: [ - ... { resolve: './theme', options: { - icon: './src/images/npm-favicon.png', + icon: './src/images/favicon.png', showContributors: false, repo: { url: 'https://github.com/npm/documentation', - defaultBranch: 'main' - } + defaultBranch: 'main', + }, }, - } + }, ], } - ``` ## Theme Options @@ -35,4 +26,4 @@ module.exports = { | ---------------- | -------- | ------- | ------- | ------------------------------------------------------- | | icon | yes | n/a | string | The favicon to display | | showContributors | yes | n/a | boolean | Determines if the repository contributors are displayed | -| repo | yes | n/a | object | `url`, `defaultBranch` and `path` to repository | +| repo | yes | n/a | object | `url` and `defaultBranch` to repository | diff --git a/theme/gatsby-browser.js b/theme/gatsby-browser.js index d1c556c1098..d93b95d0523 100644 --- a/theme/gatsby-browser.js +++ b/theme/gatsby-browser.js @@ -1,2 +1,2 @@ -export {default as wrapPageElement} from './src/components/wrap-page-element' -export {default as wrapRootElement} from './src/components/wrap-root-element' +export {default as wrapPageElement} from './src/wrap/page-element' +export {default as wrapRootElement} from './src/wrap/root-element' diff --git a/theme/gatsby-config.js b/theme/gatsby-config.js index 5efe0ea2742..0a112c8544a 100644 --- a/theme/gatsby-config.js +++ b/theme/gatsby-config.js @@ -1,6 +1,45 @@ const path = require('path') +const fs = require('fs') -module.exports = themeOptions => ({ +const {NODE_ENV, GATSBY_PARTIAL_CONTENT} = process.env +const CONTENT_DIR = path.resolve(__dirname, '..', 'content') + +const walkDirs = dir => { + const dirs = fs + .readdirSync(dir) + .filter(d => fs.statSync(path.join(dir, d)).isDirectory()) + .map(p => path.join(dir, p)) + const nested = dirs.flatMap(d => walkDirs(d)) + return [...dirs, ...nested] +} + +const getContentOptions = () => { + if (NODE_ENV !== 'development' || !GATSBY_PARTIAL_CONTENT) { + return + } + + const partialContent = (GATSBY_PARTIAL_CONTENT ?? '').split(',') + + const paths = walkDirs(CONTENT_DIR) + .map(p => path.relative(CONTENT_DIR, p)) + .sort() + .reduce( + (acc, p) => { + const include = partialContent.some(partial => partial.startsWith(p)) + acc[include ? 'include' : 'ignore'].push(p) + return acc + }, + {include: [], ignore: []}, + ) + + console.log(`Only including the following partial content in dev mode:\n - ${paths.include.join('\n - ')}`) + + return { + ignore: paths.ignore, + } +} + +module.exports = ({icon}) => ({ plugins: [ 'gatsby-plugin-styled-components', 'gatsby-plugin-react-helmet', @@ -11,7 +50,7 @@ module.exports = themeOptions => ({ options: { extensions: ['.mdx', '.md'], defaultLayouts: { - default: require.resolve('./src/components/layout.js'), + default: require.resolve('./src/layout/index.js'), }, }, }, @@ -19,15 +58,14 @@ module.exports = themeOptions => ({ resolve: 'gatsby-source-filesystem', options: { name: 'content', - path: process.env.GATSBY_PARTIAL_CONTENT - ? path.resolve(`./content/${process.env.GATSBY_PARTIAL_CONTENT}`) - : path.resolve('./content'), + path: CONTENT_DIR, + ...getContentOptions(), }, }, { resolve: 'gatsby-plugin-manifest', options: { - icon: themeOptions.icon ? path.resolve(themeOptions.icon) : require.resolve('./src/images/favicon.png'), + icon: path.resolve(icon), }, }, 'gatsby-plugin-meta-redirect', diff --git a/theme/gatsby-node.js b/theme/gatsby-node.js index b90cfab3e71..9d60f150630 100644 --- a/theme/gatsby-node.js +++ b/theme/gatsby-node.js @@ -1,8 +1,6 @@ const path = require('path') const uniqBy = require('lodash.uniqby') -const CONTRIBUTOR_CACHE = new Map() - exports.createSchemaCustomization = ({actions: {createTypes}}) => { createTypes(` type Mdx implements Node { @@ -23,33 +21,8 @@ exports.createSchemaCustomization = ({actions: {createTypes}}) => { `) } -exports.onCreateNode = ({node, actions, getNode}) => { - const {createNodeField} = actions - - if (node.internal.type === 'Mdx') { - const file = getNode(node.parent) - - // cli paths are unchanged - if (file.relativeDirectory.startsWith('cli/')) { - return - } - - // directory index paths and policy are unchanged - if (file.name === 'index' || file.relativeDirectory.match(/^policies(\/.*)?$/)) { - return - } - - // otherwise, omit the directory path and use the filename as the slug - createNodeField({ - name: 'slug', - node, - value: file.name, - }) - } -} - -exports.createPages = async ({graphql, actions}, themeOptions) => { - const repo = themeOptions.repo +exports.createPages = async ({graphql, actions}, {repo, showContributors}) => { + const rootAbsolutePath = process.cwd() const {data} = await graphql(` { @@ -84,20 +57,17 @@ exports.createPages = async ({graphql, actions}, themeOptions) => { // Turn every MDX file into a page. return Promise.all( data.allMdx.nodes.map(async node => { - const pagePath = getPath(node) - - const rootAbsolutePath = path.resolve(process.cwd(), themeOptions.repoRootPath || '.') + const {id, frontmatter, fileAbsolutePath, tableOfContents = {}} = node - const fileRelativePath = path.relative(rootAbsolutePath, node.fileAbsolutePath) - - const editUrl = getEditUrl(repo, fileRelativePath, node.frontmatter) + const pagePath = getPath(node) + const relativePath = path.relative(rootAbsolutePath, fileAbsolutePath) + const editUrl = getEditUrl(repo, relativePath, frontmatter) - const contributors = - themeOptions.showContributors !== false ? await fetchContributors(repo, fileRelativePath, node.frontmatte) : [] + const contributors = showContributors ? await fetchContributors(repo, relativePath, frontmatter) : [] // Fix some old CLI pages which have mismatched headings at the top level. // All top level headings should be the same level. - const tableOfContents = node.tableOfContents?.items?.reduce((acc, item) => { + const toc = tableOfContents.items?.reduce((acc, item) => { if (!item.url && Array.isArray(item.items)) { acc.push(...item.items) } else { @@ -108,34 +78,31 @@ exports.createPages = async ({graphql, actions}, themeOptions) => { actions.createPage({ path: pagePath, - component: node.fileAbsolutePath, + component: fileAbsolutePath, context: { - mdxId: node.id, - themeOptions, + mdxId: id, editUrl, contributors, - tableOfContents, + tableOfContents: toc, repositoryUrl: repo.url, }, }) - if (node.frontmatter.redirect_from) { - for (const from of node.frontmatter.redirect_from) { + for (const from of frontmatter.redirect_from ?? []) { + actions.createRedirect({ + fromPath: from, + toPath: `/${pagePath}`, + isPermanent: true, + redirectInBrowser: true, + }) + + if (pagePath.startsWith('cli/') && !from.endsWith('index')) { actions.createRedirect({ - fromPath: from, + fromPath: `${from}.html`, toPath: `/${pagePath}`, isPermanent: true, redirectInBrowser: true, }) - - if (pagePath.startsWith('cli/') && !from.endsWith('index')) { - actions.createRedirect({ - fromPath: `${from}.html`, - toPath: `/${pagePath}`, - isPermanent: true, - redirectInBrowser: true, - }) - } } } }), @@ -159,19 +126,9 @@ function getPath(node) { .replace(/\\/g, '/') // Windows paths to forward slashes } -function getNameWithOwner(url) { - const nwo = url.match(/^http(?:s)?:\/\/(?:www\.)?github\.com\/([^/]+\/[^/]+)(?:\/)?$/i) - - if (nwo) { - return nwo[1] - } - - return null -} - function getGitHubData(repo, overrideData, filePath) { const gh = { - nwo: getNameWithOwner(repo.url), + nwo: new URL(repo.url).pathname.slice(1).split('/'), branch: 'master', } @@ -187,8 +144,6 @@ function getGitHubData(repo, overrideData, filePath) { if (overrideData.github_path) { gh.path = overrideData.github_path - } else if (repo.path) { - gh.path = `${repo.path}/${filePath}` } else { gh.path = filePath } @@ -205,6 +160,8 @@ function getEditUrl(repo, filePath, overrideData = {}) { return `https://github.com/${gh.nwo}/edit/${gh.branch}/${gh.path}` } +const CONTRIBUTOR_CACHE = new Map() + async function fetchContributors(repo, filePath, overrideData = {}) { if (!process.env.GITHUB_TOKEN) { console.warn('Skipping fetching contributors because no github token was set') diff --git a/theme/gatsby-ssr.js b/theme/gatsby-ssr.js index d1c556c1098..d93b95d0523 100644 --- a/theme/gatsby-ssr.js +++ b/theme/gatsby-ssr.js @@ -1,2 +1,2 @@ -export {default as wrapPageElement} from './src/components/wrap-page-element' -export {default as wrapRootElement} from './src/components/wrap-root-element' +export {default as wrapPageElement} from './src/wrap/page-element' +export {default as wrapRootElement} from './src/wrap/root-element' diff --git a/theme/index.js b/theme/index.js deleted file mode 100644 index 56098d0fc7f..00000000000 --- a/theme/index.js +++ /dev/null @@ -1,15 +0,0 @@ -export {default as Caption} from './src/components/caption' -export {default as Container} from './src/components/container' -export {default as Contributors} from './src/components/contributors' -export {Do, DoDontContainer, Dont} from './src/components/do-dont' -export {default as Frame} from './src/components/frame' -export {default as Head} from './src/components/head' -export {default as Header} from './src/components/header' -export {default as Hero} from './src/components/hero' -export {default as HeroLayout} from './src/components/hero-layout' -export {default as Index} from './src/components/index' -export {default as Note} from './src/components/note' -export {default as Screenshot} from './src/components/screenshot' -export {default as Sidebar} from './src/components/sidebar' -export {default as SourceLink} from './src/components/source-link' -export {default as StatusLabel} from './src/components/status-label' diff --git a/theme/package.json b/theme/package.json index b52c77deb21..9ecd41f20d0 100644 --- a/theme/package.json +++ b/theme/package.json @@ -1,5 +1,5 @@ { - "name": "theme", + "name": "@npm/documentation-theme", "version": "1.0.0", "repository": { "url": "https://github.com/npm/documentation.git", @@ -41,6 +41,7 @@ "gatsby-plugin-catch-links": "^4.25.0", "gatsby-plugin-manifest": "^4.25.0", "gatsby-plugin-mdx": "^3.20.0", + "gatsby-plugin-meta-redirect": "^1.1.1", "gatsby-plugin-react-helmet": "^5.25.0", "gatsby-plugin-styled-components": "^5.25.0", "gatsby-source-filesystem": "^4.25.0", diff --git a/theme/src/components/head.js b/theme/src/components/head.js index 485e4d388ee..e7ed5f168c2 100644 --- a/theme/src/components/head.js +++ b/theme/src/components/head.js @@ -1,6 +1,6 @@ import React from 'react' import {Helmet} from 'react-helmet' -import useSiteMetdata from '../use-site-metadata' +import useSiteMetdata from '../hooks/use-site-metadata' function Head(props) { const siteMetadata = useSiteMetdata() diff --git a/theme/src/components/header.js b/theme/src/components/header.js index d96f04afdf1..0392ec84781 100644 --- a/theme/src/components/header.js +++ b/theme/src/components/header.js @@ -3,12 +3,12 @@ import {Link as GatsbyLink} from 'gatsby' import React from 'react' import styled from 'styled-components' import headerNavItems from '../header-nav.yml' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' import MobileSearch from './mobile-search' import NavDrawer from './nav-drawer' import Search from './search' import NpmLogo from './npm-logo' -import useSearch from '../use-search' +import useSearch from '../hooks/use-search' export const HEADER_HEIGHT = 66 @@ -17,7 +17,7 @@ const NpmHeaderBar = styled(Box)` background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff); ` -function Header({location, repositoryUrl, isSearchEnabled = true}) { +function Header({location, repositoryUrl}) { const siteMetadata = useSiteMetadata() const search = useSearch() @@ -39,18 +39,16 @@ function Header({location, repositoryUrl, isSearchEnabled = true}) { {siteMetadata.title} - {isSearchEnabled ? ( - - - - ) : null} + + + - {isSearchEnabled ? : null} + diff --git a/theme/src/components/heading.js b/theme/src/components/heading.js index 55b4b5a165e..d64fab2b99e 100644 --- a/theme/src/components/heading.js +++ b/theme/src/components/heading.js @@ -5,7 +5,7 @@ import React from 'react' import textContent from 'react-addons-text-content' import styled from 'styled-components' import {HEADER_HEIGHT} from './header' -import {useSlugger} from '../use-slugger' +import {useSlugger} from '../hooks/use-slugger' const StyledHeading = styled(Heading)` margin-top: ${themeGet('space.4')}; diff --git a/theme/src/components/hero-layout.js b/theme/src/components/hero-layout.js deleted file mode 100644 index 29ef491b3c5..00000000000 --- a/theme/src/components/hero-layout.js +++ /dev/null @@ -1,43 +0,0 @@ -import {Box, Flex} from '@primer/components' -import React from 'react' -import Container from './container' -import PageFooter from './page-footer' -import Head from './head' -import Header from './header' -import Hero from './hero' -import Sidebar from './sidebar' -import * as Slugger from '../use-slugger' - -function HeroLayout({children, pageContext, location}) { - const {additionalContributors = []} = pageContext.frontmatter - - return ( - - - -
- - - - - - - - {children} - ({login})))} - /> - - - - - - ) -} - -export default HeroLayout diff --git a/theme/src/components/hero.js b/theme/src/components/hero.js index f676b0348c0..72b37c1cf0e 100644 --- a/theme/src/components/hero.js +++ b/theme/src/components/hero.js @@ -1,6 +1,6 @@ import {Box, Heading, Text} from '@primer/components' import React from 'react' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' import Container from './container' function Hero() { diff --git a/theme/src/components/live-code.js b/theme/src/components/live-code.js index 38a77fadb14..9207afbc586 100644 --- a/theme/src/components/live-code.js +++ b/theme/src/components/live-code.js @@ -5,7 +5,6 @@ import React, {useState} from 'react' import reactElementToJsxString from 'react-element-to-jsx-string' import {LiveEditor, LiveError, LivePreview, LiveProvider} from 'react-live' import {ThemeContext} from 'styled-components' -import scope from '../live-code-scope' import ClipboardCopy from './clipboard-copy' import LivePreviewWrapper from './live-preview-wrapper' @@ -14,6 +13,10 @@ const languageTransformers = { jsx: jsx => wrapWithFragment(jsx), } +// USed to define the scope of live code examples. +// See https://primer.style/doctocat/usage/live-code for more details +const scope = {} + function htmlToJsx(html) { try { const reactElement = htmlReactParser(removeNewlines(html)) diff --git a/theme/src/components/mobile-search.js b/theme/src/components/mobile-search.js index 62d5d50dc40..bf5854b8e66 100644 --- a/theme/src/components/mobile-search.js +++ b/theme/src/components/mobile-search.js @@ -6,7 +6,7 @@ import {FocusOn} from 'react-focus-on' import DarkButton from './dark-button' import DarkTextInput from './dark-text-input' import SearchResults from './search-results' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' function MobileSearch({onDismiss, ...props}) { const siteMetadata = useSiteMetadata() diff --git a/theme/src/components/nav-drawer.js b/theme/src/components/nav-drawer.js index 8a7043ae78f..a2ea6c24055 100644 --- a/theme/src/components/nav-drawer.js +++ b/theme/src/components/nav-drawer.js @@ -4,11 +4,11 @@ import {Link as GatsbyLink} from 'gatsby' import React from 'react' import navItems from '../nav.yml' import headerNavItems from '../header-nav.yml' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' import DarkButton from './dark-button' import Drawer from './drawer' import NavItems from './nav-items' -import {useIsMobile} from '../use-breakpoint' +import {useIsMobile} from '../hooks/use-breakpoint' const useDrawerIsOpen = () => { const isMobile = useIsMobile() diff --git a/theme/src/components/search-results.js b/theme/src/components/search-results.js index d94fff32509..393209ade34 100644 --- a/theme/src/components/search-results.js +++ b/theme/src/components/search-results.js @@ -1,6 +1,6 @@ import {Flex, Text} from '@primer/components' import React from 'react' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' import NavHierarchy from '../nav-hierarchy' function SearchResults({results, getItemProps, highlightedIndex}) { diff --git a/theme/src/components/search.js b/theme/src/components/search.js index 20cdbb3cd05..a18de2ec742 100644 --- a/theme/src/components/search.js +++ b/theme/src/components/search.js @@ -1,6 +1,6 @@ import {BorderBox, Position} from '@primer/components' import React from 'react' -import useSiteMetadata from '../use-site-metadata' +import useSiteMetadata from '../hooks/use-site-metadata' import DarkTextInput from './dark-text-input' import SearchResults from './search-results' diff --git a/theme/src/header-nav.yml b/theme/src/header-nav.yml index b05fb737664..c085d7c38a2 100644 --- a/theme/src/header-nav.yml +++ b/theme/src/header-nav.yml @@ -1,2 +1,2 @@ -- title: npmjs.com - url: https://www.npmjs.com/ +# For shadowing only +[] diff --git a/theme/src/use-breakpoint.js b/theme/src/hooks/use-breakpoint.js similarity index 100% rename from theme/src/use-breakpoint.js rename to theme/src/hooks/use-breakpoint.js diff --git a/theme/src/use-search.js b/theme/src/hooks/use-search.js similarity index 97% rename from theme/src/use-search.js rename to theme/src/hooks/use-search.js index e5e3a596c9d..57a89ad0bd8 100644 --- a/theme/src/use-search.js +++ b/theme/src/hooks/use-search.js @@ -59,7 +59,7 @@ function useSearch() { }, []) React.useEffect(() => { - const worker = new Worker(new URL('./search.worker.js', import.meta.url)) + const worker = new Worker(new URL('../search.worker.js', import.meta.url)) workerRef.current = worker worker.addEventListener('message', handleSearchResults) diff --git a/theme/src/use-site-metadata.js b/theme/src/hooks/use-site-metadata.js similarity index 100% rename from theme/src/use-site-metadata.js rename to theme/src/hooks/use-site-metadata.js diff --git a/theme/src/use-slugger.js b/theme/src/hooks/use-slugger.js similarity index 100% rename from theme/src/use-slugger.js rename to theme/src/hooks/use-slugger.js diff --git a/theme/src/images/favicon.png b/theme/src/images/favicon.png deleted file mode 100644 index d0ae5b2757e..00000000000 Binary files a/theme/src/images/favicon.png and /dev/null differ diff --git a/theme/src/layout/hero.js b/theme/src/layout/hero.js new file mode 100644 index 00000000000..01175e3f985 --- /dev/null +++ b/theme/src/layout/hero.js @@ -0,0 +1,30 @@ +import {Box, Flex} from '@primer/components' +import React from 'react' +import Container from '../components/container' +import Head from '../components/head' +import Header from '../components/header' +import Hero from '../components/hero' +import Sidebar from '../components/sidebar' +import * as Slugger from '../hooks/use-slugger' + +function HeroLayout({children, pageContext, location}) { + return ( + + + +
+ + + + + + + {children} + + + + + ) +} + +export default HeroLayout diff --git a/theme/src/components/layout.js b/theme/src/layout/index.js similarity index 82% rename from theme/src/components/layout.js rename to theme/src/layout/index.js index 3869cd8082e..2085e631309 100644 --- a/theme/src/components/layout.js +++ b/theme/src/layout/index.js @@ -1,20 +1,20 @@ import {BorderBox, Box, Flex, Grid, Heading, Position, StyledOcticon, Text} from '@primer/components' import {ChevronDownIcon, ChevronRightIcon} from '@primer/octicons-react' import React from 'react' -import Head from './head' -import Header, {HEADER_HEIGHT} from './header' -import PageFooter from './page-footer' -import Sidebar from './sidebar' -import SourceLink from './source-link' -import StatusLabel from './status-label' -import TableOfContents from './table-of-contents' -import VariantSelect from './variant-select' +import Head from '../components/head' +import Header, {HEADER_HEIGHT} from '../components/header' +import PageFooter from '../components/page-footer' +import Sidebar from '../components/sidebar' +import SourceLink from '../components/source-link' +import StatusLabel from '../components/status-label' +import TableOfContents from '../components/table-of-contents' +import VariantSelect from '../components/variant-select' import NavHierarchy from '../nav-hierarchy' -import Details from './details' -import * as Slugger from '../use-slugger' +import Details from '../components/details' +import * as Slugger from '../hooks/use-slugger' function Layout({children, pageContext, location}) { - const {title, description, status, source, additionalContributors = []} = pageContext.frontmatter + const {title, description, status, source} = pageContext.frontmatter const variantRoot = NavHierarchy.getVariantRoot(location.pathname) @@ -22,11 +22,7 @@ function Layout({children, pageContext, location}) { -
+
@@ -112,10 +108,7 @@ function Layout({children, pageContext, location}) { ) : null} {children} - ({login})))} - /> + diff --git a/theme/src/live-code-scope.js b/theme/src/live-code-scope.js deleted file mode 100644 index c362db6be19..00000000000 --- a/theme/src/live-code-scope.js +++ /dev/null @@ -1,3 +0,0 @@ -// Users can shadow this file to define the scope of live code examples. -// See https://primer.style/doctocat/usage/live-code for more details -export default {} diff --git a/theme/src/nav-hierarchy.js b/theme/src/nav-hierarchy.js index 31f7c0af387..12e28a282fc 100644 --- a/theme/src/nav-hierarchy.js +++ b/theme/src/nav-hierarchy.js @@ -1,5 +1,5 @@ -import navItems from './nav.yml' import {withPrefix} from 'gatsby' +import navItems from './nav.yml' export default { getLocation(path) { diff --git a/theme/src/nav.yml b/theme/src/nav.yml index d9282749db9..c085d7c38a2 100644 --- a/theme/src/nav.yml +++ b/theme/src/nav.yml @@ -1,3 +1,2 @@ -# Users can shadow this file to define navigation items. -# See https://primer.style/doctocat/usage/customization/#side-navigation for more details. +# For shadowing only [] diff --git a/theme/src/shared.js b/theme/src/shared.js new file mode 100644 index 00000000000..9f8d8573dcb --- /dev/null +++ b/theme/src/shared.js @@ -0,0 +1,2 @@ +// For shadowing only +export default () => ({}) diff --git a/theme/src/components/wrap-page-element.js b/theme/src/wrap/page-element.js similarity index 89% rename from theme/src/components/wrap-page-element.js rename to theme/src/wrap/page-element.js index 5abc689c7db..07c5ffed332 100644 --- a/theme/src/components/wrap-page-element.js +++ b/theme/src/wrap/page-element.js @@ -1,6 +1,6 @@ import {BaseStyles} from '@primer/components' import React from 'react' -import SkipLink from './skip-link' +import SkipLink from '../components/skip-link' import {createGlobalStyle} from 'styled-components' const GlobalStyle = createGlobalStyle` diff --git a/theme/src/components/wrap-root-element.js b/theme/src/wrap/root-element.js similarity index 51% rename from theme/src/components/wrap-root-element.js rename to theme/src/wrap/root-element.js index 2807d3113c8..8b62d875f4e 100644 --- a/theme/src/components/wrap-root-element.js +++ b/theme/src/wrap/root-element.js @@ -3,21 +3,22 @@ import {Link, theme} from '@primer/components' import {SSRProvider} from '@primer/react' import React from 'react' import {ThemeProvider} from 'styled-components' -import Blockquote from './blockquote' -import Code from './code' -import DescriptionList from './description-list' -import {H1, H2, H3, H4, H5, H6} from './heading' -import HorizontalRule from './horizontal-rule' -import Image from './image' -import InlineCode from './inline-code' -import List from './list' -import Paragraph from './paragraph' -import Table from './table' -import Index from './index' -import Note from './note' -import Prompt from './prompt' -import PromptReply from './prompt-reply' -import Screenshot from './screenshot' +import Blockquote from '../components/blockquote' +import Code from '../components/code' +import DescriptionList from '../components/description-list' +import {H1, H2, H3, H4, H5, H6} from '../components/heading' +import HorizontalRule from '../components/horizontal-rule' +import Image from '../components/image' +import InlineCode from '../components/inline-code' +import List from '../components/list' +import Paragraph from '../components/paragraph' +import Table from '../components/table' +import Index from '../components/index' +import Note from '../components/note' +import Prompt from '../components/prompt' +import PromptReply from '../components/prompt-reply' +import Screenshot from '../components/screenshot' +import shared from '../shared' const components = { a: Link, @@ -43,7 +44,9 @@ const components = { Prompt, PromptReply, Screenshot, + Link, } +components.shared = shared(components) function wrapRootElement({element}) { return (