Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 6edf23a

Browse files
committed
docs v2
1 parent a87dc56 commit 6edf23a

File tree

186 files changed

+18128
-7207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+18128
-7207
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@
2323
npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
26-
.pnpm-debug.log*
2726

2827
# local env files
2928
.env*.local
3029

3130
# vercel
3231
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts
36+
37+
.contentlayer
38+
39+
old

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged

.spellcheckerrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
files:
2-
- 'src/pages/**/*.{md,mdx}'
2+
- 'docs/**/*.{md,mdx}'
33
dictionaries:
44
- dictionary.txt
55
quiet: true

components.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema.json",
3-
"style": "default",
4-
"rsc": false,
3+
"style": "new-york",
4+
"rsc": true,
55
"tsx": true,
66
"tailwind": {
7-
"config": "tailwind.config.js",
7+
"config": "tailwind.config.ts",
88
"css": "src/styles/tailwind.css",
9-
"baseColor": "slate",
9+
"baseColor": "zinc",
1010
"cssVariables": true,
1111
"prefix": ""
1212
},
1313
"aliases": {
1414
"components": "@/components",
15-
"utils": "@/lib/utils"
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
1619
}
1720
}

contentlayer.config.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
2+
import { extractTocHeadings } from './src/mdx/remark-toc-headings.mjs'
3+
import { title } from 'radash'
4+
import path from 'path'
5+
import fs from 'fs'
6+
7+
const contentDirPath = 'docs'
8+
9+
const branch = process.env.NEXT_PUBLIC_GITHUB_BRANCH || 'main'
10+
11+
const Doc = defineDocumentType(() => ({
12+
name: 'Doc',
13+
filePathPattern: '**/*.mdx',
14+
fields: {
15+
title: {
16+
type: 'string',
17+
description: 'The meta title of the doc',
18+
},
19+
nav_title: {
20+
type: 'string',
21+
description: 'The title of the doc in the navigation',
22+
},
23+
description: {
24+
type: 'string',
25+
description: 'The description of the doc',
26+
},
27+
image: {
28+
type: 'string',
29+
description: 'The image of the doc',
30+
},
31+
image_alt: {
32+
type: 'string',
33+
description: 'The image alt of the doc',
34+
},
35+
disable_edit: {
36+
type: 'boolean',
37+
description: 'Disable the github edit button',
38+
},
39+
},
40+
computedFields: {
41+
slug: {
42+
type: 'string',
43+
resolve: (doc) => doc._raw.flattenedPath,
44+
},
45+
toc: { type: 'json', resolve: (doc) => extractTocHeadings(doc.body.raw) },
46+
editUrl: {
47+
type: 'string',
48+
resolve: (doc) =>
49+
`https://github.com/nitrictech/docs/edit/${branch}/docs/${doc._raw.sourceFilePath}`,
50+
},
51+
lastModified: {
52+
type: 'date',
53+
resolve: (doc) => {
54+
// Get the full path to the markdown file
55+
const filePath = path.join(
56+
process.cwd(),
57+
contentDirPath,
58+
doc._raw.sourceFilePath,
59+
)
60+
// Extract and return the last modified date
61+
const stats = fs.statSync(filePath)
62+
return stats.mtime // This is the last modified date
63+
},
64+
},
65+
},
66+
}))
67+
68+
export default makeSource({
69+
contentDirPath,
70+
documentTypes: [Doc],
71+
})

cypress.config.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

cypress/e2e/broken-links.cy.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const isExternalUrl = (url: string) => {
3333
return !url.includes('localhost')
3434
}
3535

36-
const req = (url: string, retryCount = 0) => {
36+
const req = (url: string, retryCount = 0): any => {
3737
return cy
3838
.request({
3939
url,
@@ -71,7 +71,8 @@ describe('Broken links test suite', () => {
7171
(link.getAttribute('href') &&
7272
link.getAttribute('href')?.includes(l)) ||
7373
//@ts-ignore
74-
(link.getAttribute('src') && link.getAttribute('src').includes(l))
74+
(link.getAttribute('src') &&
75+
link.getAttribute('src').includes(l)),
7576
)
7677
})
7778
.each((link) => {
@@ -90,7 +91,7 @@ describe('Broken links test suite', () => {
9091
let acceptableCodes = CORRECT_CODES
9192
if (REDIRECT_CODES.includes(res.status) && !isExternalUrl(url)) {
9293
assert.fail(
93-
`${url} returned ${res.status} to ${res.headers['location']}`
94+
`${url} returned ${res.status} to ${res.headers['location']}`,
9495
)
9596
} else {
9697
acceptableCodes = [
@@ -106,7 +107,7 @@ describe('Broken links test suite', () => {
106107

107108
expect(res.status).oneOf(
108109
acceptableCodes,
109-
`${url} returned ${res.status}`
110+
`${url} returned ${res.status}`,
110111
)
111112
})
112113
}
@@ -129,7 +130,7 @@ describe('Current links test suite', () => {
129130
? '/docs'
130131
: `/docs${p.loc
131132
.substring(PROD_BASE_URL.length, p.loc.length)
132-
.replace('/_index', '')}`
133+
.replace('/_index', '')}`,
133134
)
134135
})
135136
})

src/pages/getting-started/installation.mdx renamed to docs/getting-started/installation.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { InstallNitric } from '@/components/InstallNitric'
2-
31
export const description =
42
'Basic installation instructions for the Nitric Framework'
53

@@ -26,16 +24,16 @@ Please follow these links to the official installation steps for each.
2624

2725
<InstallNitric>
2826

29-
```bash {{ title: 'macOS' }}
27+
```bash !!tabs macOS
3028
brew install nitrictech/tap/nitric
3129
```
3230

33-
```bash {{ title: 'Windows' }}
31+
```bash !!tabs Windows
3432
scoop bucket add nitric https://github.com/nitrictech/scoop-bucket.git
3533
scoop install nitric
3634
```
3735

38-
```bash {{ title: 'Linux' }}
36+
```bash !!tabs Linux
3937
curl -L "https://nitric.io/install?version=latest" | bash
4038
```
4139

@@ -49,15 +47,15 @@ Alternatively, you can download pre-compiled binaries from the [releases](https:
4947

5048
<InstallNitric>
5149

52-
```bash {{ title: 'macOS' }}
50+
```bash !!tabs macOS
5351
brew upgrade nitric
5452
```
5553

56-
```bash {{ title: 'Windows' }}
54+
```bash !!tabs Windows
5755
scoop update nitric
5856
```
5957

60-
```bash {{ title: 'Linux' }}
58+
```bash !!tabs Linux
6159
curl -L "https://nitric.io/install?version=latest" | bash
6260
```
6361

0 commit comments

Comments
 (0)