Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Dec 29, 2023
1 parent 83a6f68 commit 31f90a0
Show file tree
Hide file tree
Showing 78 changed files with 3,122 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Verrou documentation website

This is the source code for the Verrou documentation website. It is built using [AdonisJS](https://adonisjs.com/) and [Dimer](https://github.com/dimerapp/docs-boilerplate)
20 changes: 20 additions & 0 deletions docs/adonisrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from '@adonisjs/core/app'

export default defineConfig({
typescript: true,
directories: {
views: 'templates',
},
providers: [
() => import('@adonisjs/core/providers/app_provider'),
() => import('@adonisjs/core/providers/edge_provider'),
() => import('@adonisjs/vite/vite_provider'),
() => import('@adonisjs/static/static_provider'),
],
metaFiles: [
{
pattern: './public/**/*',
reloadServer: false,
},
],
})
83 changes: 83 additions & 0 deletions docs/assets/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
@import 'unpoly';
@import '@docsearch/css';

/* Gray colors */
@import '@radix-ui/colors/mauve.css';
@import '@radix-ui/colors/mauve-alpha.css';
@import '@radix-ui/colors/mauve-dark.css';
@import '@radix-ui/colors/mauve-dark-alpha.css';

/* Accent colors */
@import '@radix-ui/colors/iris.css';
@import '@radix-ui/colors/iris-alpha.css';
@import '@radix-ui/colors/iris-dark.css';
@import '@radix-ui/colors/iris-dark-alpha.css';

/* Interface colors */
@import '@radix-ui/colors/orange-alpha.css';
@import '@radix-ui/colors/iris-alpha.css';
@import '@radix-ui/colors/orange-dark-alpha.css';
@import '@radix-ui/colors/iris-dark-alpha.css';

/**
* Dimer doc theme styles
*/
@import '@dimerapp/docs-theme/styles';

:root {
--progress-bar-color: var(--iris-a11);
--sidebar-active-link-bg-color: var(--iris-a6);
--sidebar-active-link-text-color: var(--iris-12);
--aside-active-link-text-color: var(--iris-11);
--pre-tabs-active-border-color: var(--iris-10);

--note-icon-color: var(--iris-a11);
--code-bg-color: var(--iris-a3);
--code-text-color: var(--iris-a11);
--code-highlight-border-color: var(--iris-11);
--sidebar-loading-link-bg-color: var(--iris-a3);
--docsearch-primary-color: var(--iris-9);
}

html.dark {
--progress-bar-color: var(--iris-a11);
--sidebar-active-link-bg-color: var(--iris-a5);
--sidebar-active-link-text-color: var(--iris-12);
--aside-active-link-text-color: var(--iris-11);
--pre-tabs-active-border-color: var(--iris-a10);

--note-icon-color: var(--iris-a11);
--code-bg-color: var(--iris-a3);
--code-text-color: var(--iris-a11);
--code-highlight-border-color: var(--iris-a8);
--sidebar-loading-link-bg-color: var(--iris-a7);
--docsearch-primary-color: var(--iris-9);
}

.markdown .media_box {
padding: 2rem;
border: 4px solid var(--mauve-4);
border-radius: 4px;
margin: var(--prose-elements-margin) 0;
}

.markdown .media_box figure, .markdown .media_box p {
margin: 0;
}

.markdown ul li ul {
margin: 0px;
}


@media only screen and (min-width: 768px) {
.header_container {
background-color: var(--mauveA1);
backdrop-filter: blur(10px);
}
}

.markdown .table_container {
overflow-x: auto;
}

26 changes: 26 additions & 0 deletions docs/assets/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'unpoly'

import Alpine from 'alpinejs'
import mediumZoom from 'medium-zoom'
import docsearch from '@docsearch/js'
import { tabs } from 'edge-uikit/tabs'
import Persist from '@alpinejs/persist'
import {
initZoomComponent,
initBaseComponents,
initSearchComponent,
} from '@dimerapp/docs-theme/scripts'

import.meta.glob([
'../content/**/*.png',
'../content/**/*.jpeg',
'../content/**/*.jpg',
'../content/**/*.webp',
])

Alpine.plugin(tabs)
Alpine.plugin(Persist)
Alpine.plugin(initBaseComponents)
Alpine.plugin(initSearchComponent(docsearch))
Alpine.plugin(initZoomComponent(mediumZoom))
Alpine.start()
Binary file added docs/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions docs/bin/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
|--------------------------------------------------------------------------
| Development server entrypoint
|--------------------------------------------------------------------------
|
| The "server.ts" file is the entrypoint for starting the AdonisJS HTTP
| server. Either you can run this file directly or use the "serve"
| command to run this file and monitor file changes
|
*/

import 'reflect-metadata'

import { Ignitor } from '@adonisjs/core'
import { defineConfig } from '@adonisjs/vite'

/**
* URL to the application root. AdonisJS need it to resolve
* paths to file and directories for scaffolding commands
*/
const APP_ROOT = new URL('../', import.meta.url)

/**
* The importer is used to import files in context of the
* application.
*/
const IMPORTER = (filePath: string) => {
if (filePath.startsWith('./') || filePath.startsWith('../')) {
return import(new URL(filePath, APP_ROOT).href)
}
return import(filePath)
}

/**
* Exports collection to HTML files
*/
async function exportHTML() {
const { collections } = await import('#src/collections')
const { default: ace } = await import('@adonisjs/core/services/ace')
const { default: app } = await import('@adonisjs/core/services/app')

for (const collection of collections) {
for (const entry of collection.all()) {
try {
const output = await entry.writeToDisk(app.makePath('dist'), { collection, entry })
ace.ui.logger.action(`create ${output.filePath}`).succeeded()
} catch (error) {
ace.ui.logger.action(`create ${entry.permalink}`).failed(error)
}
}
}
}

const app = new Ignitor(APP_ROOT, { importer: IMPORTER })
.tap((app) => {
app.initiating(() => {
app.useConfig({
appUrl: process.env.APP_URL || '',
app: {
appKey: 'zKXHe-Ahdb7aPK1ylAJlRgTefktEaACi',
http: {},
},
logger: {
default: 'app',
loggers: {
app: {
enabled: true,
},
},
},
vite: defineConfig({}),
})
})
})
.createApp('console')

await app.init()
await app.boot()
await app.start(exportHTML)
64 changes: 64 additions & 0 deletions docs/bin/download_sponsors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
|--------------------------------------------------------------------------
| Script to download sponsors
|--------------------------------------------------------------------------
|
| This script downloads the sponsors JSON from the pre-configured URLs
| configured inside the "content/config.json" file.
|
*/

import { request } from 'undici'
import { readFile, writeFile } from 'node:fs/promises'

/**
* The file path to the config.json file
*/
const CONFIG_FILE_PATH = new URL('../content/config.json', import.meta.url)

/**
* The file path to the sponsors.json file. The output will be written
* here.
*/
const SPONSORS_FILE_PATH = new URL('../content/sponsors.json', import.meta.url)

export async function downloadSponsors() {
console.log('starting to download sponsors...')

try {
const fileContents = await readFile(CONFIG_FILE_PATH, 'utf-8')
const sources = JSON.parse(fileContents).sponsors_sources
let sponsorsList: any[] = []

/**
* No sources configured. So going to create an empty
* sponsors.json file.
*/
if (sources.length === 0) {
console.log('skipping download. No sources found...')
await writeFile(SPONSORS_FILE_PATH, JSON.stringify(sponsorsList))
return
}

/**
* Processing sponsors
*/
for (const source of sources) {
const { body } = await request(source)
const sponsors = (await body.json()) as any[]
sponsorsList = sponsorsList.concat(sponsors)
console.log(`Downloaded "${sponsors.length} sponsors" from "${source}"`)
}

await writeFile(SPONSORS_FILE_PATH, JSON.stringify(sponsorsList))
} catch (error) {
if (error.code === 'ENOENT') {
console.warn('Cannot download sponsors list. Unable to find "content/config.json" file')
return
}

console.error(error)
}
}

await downloadSponsors()
89 changes: 89 additions & 0 deletions docs/bin/serve.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
|--------------------------------------------------------------------------
| Development server entrypoint
|--------------------------------------------------------------------------
|
| The "server.ts" file is the entrypoint for starting the AdonisJS HTTP
| server. Either you can run this file directly or use the "serve"
| command to run this file and monitor file changes
|
*/

import 'reflect-metadata'

import { Ignitor } from '@adonisjs/core'
import { defineConfig } from '@adonisjs/vite'

/**
* URL to the application root. AdonisJS need it to resolve
* paths to file and directories for scaffolding commands
*/
const APP_ROOT = new URL('../', import.meta.url)

/**
* The importer is used to import files in context of the
* application.
*/
const IMPORTER = (filePath: string) => {
if (filePath.startsWith('./') || filePath.startsWith('../')) {
return import(new URL(filePath, APP_ROOT).href)
}
return import(filePath)
}

/**
* Defining routes for development server
*/
async function defineRoutes() {
const { default: server } = await import('@adonisjs/core/services/server')
const { collections } = await import('#src/collections')
const { default: router } = await import('@adonisjs/core/services/router')

server.use([() => import('@adonisjs/static/static_middleware')])

router.get('*', async ({ request, response }) => {
for (const collection of collections) {
await collection.refresh()
const entry = collection.findByPermalink(request.url())

if (entry) {
return entry.render({ collection, entry })
}
}

return response.notFound('Page not found')
})
}

new Ignitor(APP_ROOT, { importer: IMPORTER })
.tap((app) => {
app.initiating(() => {
app.useConfig({
appUrl: process.env.APP_URL || '',
app: {
appKey: 'zKXHe-Ahdb7aPK1ylAJlRgTefktEaACi',
http: {},
},
static: {
enabled: true,
etag: true,
lastModified: true,
dotFiles: 'ignore',
},
logger: {
default: 'app',
loggers: {
app: {
enabled: true,
},
},
},
vite: defineConfig({}),
})
})

app.starting(defineRoutes)
})
.httpServer()
.start()
.catch(console.error)
Binary file added docs/content/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions docs/content/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"links": {
"home": {
"title": "Verrou",
"href": "/"
},
"github": {
"title": "Verrou on GitHub",
"href": "https://github.com/Julien-R44/verrou"
}
},
"sponsors_sources": ["julien-r44"],
"search": {
"appId": "2XMML2O2ES",
"apiKey": "c66d8c1caefe3ba8895d676f9843da3b",
"indexName": "bentocache"
},
"fileEditBaseUrl": "https://github.com/Julien-R44/verrou/tree/develop/docs",
"copyright": "Verrou"
}
Binary file added docs/content/docs/bentocache_flow.webp
Binary file not shown.
Loading

0 comments on commit 31f90a0

Please sign in to comment.