Skip to content

Commit

Permalink
Docusaurus: more random things (#5759)
Browse files Browse the repository at this point in the history
* Add back prism.css file. Resolves DA-147

* fix some broken tables

* make baseUrl /docs

* remove docusaurus template stuff. Resolves DA-148

* update sidenavs + use _category_.json + move custom props to frontMatter. Resolves DA-151
  • Loading branch information
jharrell authored and carlagn committed Apr 1, 2024
1 parent 166650a commit e9af85d
Show file tree
Hide file tree
Showing 24 changed files with 276 additions and 447 deletions.
1 change: 1 addition & 0 deletions docs/100-getting-started/01-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: 'Quickstart'
metaTitle: 'Quickstart with TypeScript & SQLite'
metaDescription: 'Get started with Prisma ORM in 5 minutes. You will learn how to send queries to a SQLite database in a plain TypeScript script using Prisma Client.'
search: true
sidebar_custom_props: { badge: '5 min' }
---

<TopBlock title={frontMatter.title}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hide_table_of_contents: true

In this guide, you'll use [Prisma Migrate](/orm/prisma-migrate) to create the tables in your database. Add the following data model to your [Prisma schema](/orm/prisma-schema) in `prisma/schema.prisma`:

```prisma file=prisma/schema.prisma copy
```prisma file=prisma/schema.prisma
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
Expand Down Expand Up @@ -52,7 +52,9 @@ This command does two things:
1. It creates a new SQL migration file for this migration
1. It runs the SQL migration file against the database

> **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing.
:::note
`generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing.
:::

Great, you now created three tables in your database with Prisma Migrate 🚀

Expand Down Expand Up @@ -574,7 +576,9 @@ This command does two things:
1. It creates a new SQL migration file for this migration
1. It runs the SQL migration file against the database

> **Note**: `generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing.
:::note
`generate` is called under the hood by default, after running `prisma migrate dev`. If the `prisma-client-js` generator is defined in your schema, this will check if `@prisma/client` is installed and install it if it's missing.
:::

Great, you now created three tables in your database with Prisma Migrate 🚀

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metaDescription: 'Learn how to create a new Node.js or TypeScript project from s
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
---

<TopBlock title={frontMatter.title}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metaDescription: 'Learn how to create a new Node.js or TypeScript project from s
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['mongodb']
sidebar_custom_props: { badge: '15 min' }
---

<TopBlock title={frontMatter.title}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metaDescription: 'Learn how to add Prisma to an existing Node.js or TypeScript p
hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['postgresql', 'mysql', 'sqlserver', 'planetscale', 'cockroachdb']
sidebar_custom_props: { badge: '15 min' }
---

<TopBlock title={frontMatter.title}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hide_table_of_contents: true
langSwitcher: ['typescript', 'node']
dbSwitcher: ['mongodb']
sidebar_class_name: hidden-sidebar
sidebar_custom_props: { badge: '15 min' }
---

<TopBlock
Expand Down
2 changes: 1 addition & 1 deletion docs/100-getting-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metaDescription: 'Build data-driven applications with ease using Prisma ORM, add
hide_title: true
tocDepth: 1
sidebar_position: 0
sidebar_class_name: first-title
sidebar_class_name: firstTitle
---

import {
Expand Down
5 changes: 5 additions & 0 deletions docs/200-orm/050-overview/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Overview",
"collapsible": false,
"collapsed": false
}
5 changes: 5 additions & 0 deletions docs/200-orm/100-prisma-schema/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Prisma Schema",
"collapsible": false,
"collapsed": false
}
5 changes: 5 additions & 0 deletions docs/200-orm/200-prisma-client/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Prisma Client",
"collapsible": false,
"collapsed": false
}
5 changes: 5 additions & 0 deletions docs/200-orm/300-prisma-migrate/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Prisma Migrate",
"collapsible": false,
"collapsed": false
}
5 changes: 5 additions & 0 deletions docs/200-orm/400-tools/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Tools",
"collapsible": false,
"collapsed": false
}
22 changes: 11 additions & 11 deletions docs/200-orm/500-reference/100-prisma-schema-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Defines a [generator](/orm/prisma-schema/overview/generators) in the Prisma sche
A `generator` block accepts the following fields:

| Name | Required | Type | Description |
| ----------------- | -------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| ----------------- | -------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider` | **Yes** | String (file path) or Enum (`prisma-client-js`) | Describes which [generator](/orm/prisma-schema/overview/generators) to use. This can point to a file that implements a generator or specify a built-in generator directly. |
| `output` | No | String (file path) | Determines the location for the generated client, [learn more](/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path). **Default**: `node_modules/.prisma/client` |
| `previewFeatures` | No | List of Enums | Use intellisense to see list of currently available Preview features (`Ctrl+Space` in Visual Studio Code) **Default**: none | |
Expand Down Expand Up @@ -430,9 +430,9 @@ Variable length text.

#### MySQL

| Native database type | Native database type attribute | Notes |
| :------------------- | :----------------------------- | ----- |
| `VARCHAR(x)` | `@db.VarChar(x)` | |
| Native database type | Native database type attribute |
| :------------------- | :----------------------------- |
| `VARCHAR(x)` | `@db.VarChar(x)` |
| `TEXT` | `@db.Text` |
| `CHAR(x)` | `@db.Char(x)` |
| `TINYTEXT` | `@db.TinyText` |
Expand All @@ -459,12 +459,12 @@ model Model {

#### Microsoft SQL Server

| Native database type | Native database type attribute | Notes |
| :------------------- | :----------------------------- | ----- |
| Native database type | Native database type attribute |
| :------------------- | :----------------------------- |
| `char(x)` | `@db.Char(x)` |
| `nchar(x)` | `@db.NChar(x)` |
| `varchar(x)` | `@db.VarChar(x)` |
| `nvarchar(x)` | `@db.NVarChar(x)` | |
| `nvarchar(x)` | `@db.NVarChar(x)` |
| `text` | `@db.Text` |
| `ntext` | `@db.NText` |
| `xml` | `@db.Xml` |
Expand Down Expand Up @@ -1952,9 +1952,9 @@ Defines a unique constraint for this field.

#### Arguments

| Name | Required | Type | Description |
| ----------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `map` | **No** | `String` | |
| Name | Required | Type | Description |
| ----------- | -------- | --------- | ----------- |
| `map` | **No** | `String` | |
| `length` | **No** | `number` | Allows you to specify a maximum length for the subpart of the value to be indexed.<br /><br />MySQL only. In preview in versions 3.5.0 and later, and in general availability in versions 4.0.0 and later. |
| `sort` | **No** | `String` | Allows you to specify in what order the entries of the constraint are stored in the database. The available options are `Asc` and `Desc`.<br /><br />In preview in versions 3.5.0 and later, and in general availability in versions 4.0.0 and later. |
| `clustered` | **No** | `Boolean` | Defines whether the constraint is clustered or non-clustered. Defaults to `false`.<br /><br />SQL Server only. In preview in versions 3.13.0 and later, and in general availability in versions 4.0.0 and later. |
Expand Down Expand Up @@ -2147,7 +2147,7 @@ Defines a compound [unique constraint](/orm/prisma-schema/data-model/models#defi
#### Arguments

| Name | Required | Type | Description |
| ----------- | -------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| ----------- | -------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fields` | **Yes** | `FieldReference[]` | A list of field names - for example, `["firstname", "lastname"]`. Fields must be mandatory - see remarks. |
| `name` | **No** | `String` | The name of the unique combination of fields - defaults to `fieldName1_fieldName2_fieldName3` |
| `map` | **No** | `String` |
Expand Down
5 changes: 5 additions & 0 deletions docs/200-orm/500-reference/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Reference",
"collapsible": false,
"collapsed": false
}
5 changes: 5 additions & 0 deletions docs/200-orm/800-more/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "More",
"collapsible": false,
"collapsed": false
}
4 changes: 4 additions & 0 deletions docs/500-platform/20-concepts/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"collapsed": false,
"collapsible": false
}
4 changes: 4 additions & 0 deletions docs/500-platform/60-platform-cli/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"collapsed": false,
"collapsible": false
}
5 changes: 5 additions & 0 deletions docs/500-platform/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"collapsed": false,
"collapsible": false,
"className": "firstTitle"
}
47 changes: 0 additions & 47 deletions docs/intro.md

This file was deleted.

14 changes: 10 additions & 4 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const config: Config = {
url: 'https://prisma.io',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
baseUrl: '/docs',

trailingSlash: false,
onBrokenLinks: 'warn',
Expand Down Expand Up @@ -80,14 +80,20 @@ const config: Config = {
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
'https://github.com/prisma/docs',
},
blog: false,
theme: {
customCss: ['./src/css/custom.css', './src/css/admonition.css', './src/css/docsearch.css', './src/css/all.css', './src/css/theming.css'],
customCss: [
'./src/css/custom.css',
'./src/css/admonition.css',
'./src/css/docsearch.css',
'./src/css/all.css',
'./src/css/theming.css',
'./src/css/prism.css'
],
},
} satisfies Preset.Options
],
Expand Down
Loading

0 comments on commit e9af85d

Please sign in to comment.