Merge pull request #526 from aluzzardi/docs-dogfood
docs: deploy using dagger
This commit is contained in:
commit
ca03cd6e58
2
.dagger/env/docs/.gitignore
vendored
Normal file
2
.dagger/env/docs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
23
.dagger/env/docs/plan/main.cue
vendored
Normal file
23
.dagger/env/docs/plan/main.cue
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/js/yarn"
|
||||
"dagger.io/netlify"
|
||||
)
|
||||
|
||||
// dagger repository
|
||||
repository: dagger.#Artifact @dagger(input)
|
||||
|
||||
// Build the docs website
|
||||
docs: yarn.#Package & {
|
||||
source: repository
|
||||
cwd: "tools/daggosaurus/"
|
||||
buildDir: "tools/daggosaurus/build"
|
||||
}
|
||||
|
||||
// Deploy the docs website
|
||||
site: netlify.#Site & {
|
||||
name: string | *"docs-dagger-io" @dagger(input)
|
||||
contents: docs.build
|
||||
}
|
33
.dagger/env/docs/values.yaml
vendored
Normal file
33
.dagger/env/docs/values.yaml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
name: docs
|
||||
inputs:
|
||||
repository:
|
||||
dir:
|
||||
path: .
|
||||
exclude:
|
||||
- '**/node_modules'
|
||||
- cmd/dagger/dagger
|
||||
- cmd/dagger/dagger-debug
|
||||
site.account.name:
|
||||
text: blocklayer
|
||||
site.account.token:
|
||||
secret: ENC[AES256_GCM,data:jPJ8N6cAmtYnQh2SyhM9bQGfkhz777S4fyPDm2YhujwgXH6EogN2Uyw6Ew==,iv:gDchoJYLdQ8IPxrUUIsQ9s2f12JOhh7p573DwOIV2zE=,tag:okatHyjVGPGNOt+aw4iUHg==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBaZVVuYThsYk9YcWhYb0g4
|
||||
TDhZQ21YN0FCRExKV2tqbVVUNTg5MWRUVUJzCndjc28yVUZEK3ZoQzVDQkk4emZQ
|
||||
WGx2bUxSZlBENXlibzQ1MVkvc2I2MVkKLS0tIFJKS0ZENFhuVmdUM2h1a2xrK01a
|
||||
ejRKQXNFZzBTbUxpc05acnkxQ2U2UkEKX1byNj64xOiRGAJ9lwh55d/mlasI3H6H
|
||||
b+o3HbXSbV0G0UwQxEOisntR6o27ry/l12ai/sOQ4f9MXm6FRw2XTg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-06-02T22:14:46Z"
|
||||
mac: ENC[AES256_GCM,data:x/Up/GCLTwIWSbyxvy3S79j4gbKRRYnDguvgPJFAii2PS6rjSU7KHtwM9WbUqQtd+NDbe1eWjdmAC4jPwVsa9OY7s+heR3597OpTh0pHcOgTrc4fTVN9IVHwehlg4hJU00iL1oiiHfeCD5dMUGeIRyqRqoAyMJrPdC9IDwjnp6E=,iv:IUbrkPQqLC/wnfKZMnOK9jKSc+xDXpeJwKLXuioifyE=,tag:2l+FhV3k5WvhQyvvf37Hjw==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
72
.github/workflows/docs.yml
vendored
72
.github/workflows/docs.yml
vendored
@ -2,8 +2,6 @@ name: Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
paths:
|
||||
@ -15,75 +13,11 @@ on:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
|
||||
steps:
|
||||
- name: Set Version
|
||||
id: vars
|
||||
run: |
|
||||
tag=${GITHUB_REF#refs/*/}
|
||||
[ "$tag" = "main" ] && echo ::set-output name=tag::devel || echo ::set-output name=tag::$tag
|
||||
|
||||
# fetch-depth: '0' enables listing all tags for version selector
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: "0"
|
||||
|
||||
#################################################################
|
||||
# BUILD SITE
|
||||
#################################################################
|
||||
|
||||
# Install Node
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: dagger/dagger-action@v1
|
||||
with:
|
||||
node-version: "14"
|
||||
- run: yarn --cwd ./tools/gendocs
|
||||
- name: Build Site
|
||||
run: yarn --cwd ./tools/gendocs build --prefix-paths
|
||||
env:
|
||||
VERSION: ${{steps.vars.outputs.tag}}
|
||||
|
||||
#################################################################
|
||||
# DEPLOY TO S3
|
||||
#################################################################
|
||||
|
||||
# deploy the site in the right foder ( tag or devel)
|
||||
- name: S3 Sync
|
||||
uses: ItsKarma/aws-cli@v1.70.0
|
||||
with:
|
||||
args: s3 sync --delete ./tools/gendocs/public/ s3://docs.dagger.io/${{steps.vars.outputs.tag}}/
|
||||
|
||||
# list All Tags in json file for version selector
|
||||
# upload to /tags.json
|
||||
- name: Create tags.json
|
||||
run: echo "[" {\"tag\"':' \"$(git tag -l "v*" | tr '\n' '|' | sed -e 's/|/"}, {\"tag\"':' "/g')devel\"} "]" > tags.json
|
||||
- name: Copy tags.json
|
||||
uses: ItsKarma/aws-cli@v1.70.0
|
||||
with:
|
||||
args: s3 cp ./tags.json s3://docs.dagger.io/
|
||||
|
||||
# landing alway on latest tag
|
||||
# use S3 Rediret objet
|
||||
# upload to /docs/index.html
|
||||
- name: Create index.html
|
||||
run: |
|
||||
cat <<EOF > index.html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=/${{steps.vars.outputs.tag}}">
|
||||
</head>
|
||||
<body>
|
||||
Nothing to see here; <a href="/${{steps.vars.outputs.tag}}">see the
|
||||
latest version of the docs</a>.
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
- name: Copy index.html
|
||||
if: ${{ steps.vars.outputs.tag != 'devel' }}
|
||||
uses: ItsKarma/aws-cli@v1.70.0
|
||||
with:
|
||||
args: s3 cp --cache-control max-age=0 ./index.html s3://docs.dagger.io/
|
||||
age-key: ${{ secrets.DAGGER_AGE_KEY }}
|
||||
args: up -e docs
|
||||
|
@ -213,6 +213,8 @@ func (p *Pipeline) doOp(ctx context.Context, op *compiler.Value, st llb.State) (
|
||||
return p.Local(ctx, op, st)
|
||||
case "load":
|
||||
return p.Load(ctx, op, st)
|
||||
case "workdir":
|
||||
return p.Workdir(ctx, op, st)
|
||||
case "subdir":
|
||||
return p.Subdir(ctx, op, st)
|
||||
case "docker-build":
|
||||
@ -232,6 +234,14 @@ func (p *Pipeline) vertexNamef(format string, a ...interface{}) string {
|
||||
return prefix + " " + name
|
||||
}
|
||||
|
||||
func (p *Pipeline) Workdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) {
|
||||
path, err := op.Lookup("path").String()
|
||||
if err != nil {
|
||||
return st, err
|
||||
}
|
||||
return st.Dir(path), nil
|
||||
}
|
||||
|
||||
func (p *Pipeline) Subdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) {
|
||||
// FIXME: this could be more optimized by carrying subdir path as metadata,
|
||||
// and using it in copy, load or mount.
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
contentType: string | *"" @dagger(input)
|
||||
|
||||
// Always write the object to S3
|
||||
always?: bool @dagger(input)
|
||||
always: bool | *true @dagger(input)
|
||||
|
||||
// URL of the uploaded S3 object
|
||||
url: {
|
||||
@ -90,3 +90,80 @@ import (
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// S3 Sync
|
||||
#Sync: {
|
||||
// AWS Config
|
||||
config: aws.#Config
|
||||
|
||||
// Source Artifact to upload to S3
|
||||
source: dagger.#Artifact @dagger(input)
|
||||
|
||||
// Target S3 URL (eg. s3://<bucket-name>/<path>/<sub-path>)
|
||||
target: string @dagger(input)
|
||||
|
||||
// Files that exist in the destination but not in the
|
||||
// source are deleted during sync.
|
||||
delete: *false | bool @dagger(input)
|
||||
|
||||
// Object content type
|
||||
contentType: string | *"" @dagger(input)
|
||||
|
||||
// Always write the object to S3
|
||||
always: bool | *true @dagger(input)
|
||||
|
||||
// URL of the uploaded S3 object
|
||||
url: {
|
||||
@dagger(output)
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: aws.#CLI & {
|
||||
"config": config
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
if always != _|_ {
|
||||
"always": always
|
||||
}
|
||||
env: {
|
||||
TARGET: target
|
||||
OPT_CONTENT_TYPE: contentType
|
||||
if delete {
|
||||
OPT_DELETE: "1"
|
||||
}
|
||||
}
|
||||
|
||||
mount: "/source": from: source
|
||||
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
opts=()
|
||||
if [ -d /source ]; then
|
||||
op=sync
|
||||
fi
|
||||
[ -n "$OPT_CONTENT_TYPE" ] && opts+="--content-type $OPT_CONTENT_TYPE"
|
||||
[ -n "$OPT_DELETE" ] && opts+="--delete"
|
||||
aws s3 sync ${opts[@]} /source "$TARGET"
|
||||
echo -n "$TARGET" \
|
||||
| sed -E 's=^s3://([^/]*)/=https://\1.s3.amazonaws.com/=' \
|
||||
> /url
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/url"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ package op
|
||||
dir: string
|
||||
}
|
||||
|
||||
#Workdir: {
|
||||
do: "workdir"
|
||||
path: string
|
||||
}
|
||||
|
||||
#Exec: {
|
||||
do: "exec"
|
||||
args: [...string]
|
||||
|
@ -12,6 +12,7 @@ package op
|
||||
#Copy |
|
||||
#Load |
|
||||
#Subdir |
|
||||
#Workdir |
|
||||
#WriteFile |
|
||||
#Mkdir |
|
||||
#DockerBuild) & {do: string}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/op"
|
||||
"dagger.io/alpine"
|
||||
)
|
||||
|
||||
// A git repository
|
||||
@ -23,3 +25,82 @@ import (
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Get the name of the current checked out branch or tag
|
||||
#CurrentBranch: {
|
||||
repository: dagger.#Artifact @dagger(input)
|
||||
name: {
|
||||
string
|
||||
@dagger(output)
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
package: git: "=~2.30"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/repository": from: repository
|
||||
dir: "/repository"
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
printf "$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)" > /name.txt
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/name.txt"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// List tags of a repository
|
||||
#Tags: {
|
||||
repository: dagger.#Artifact @dagger(input)
|
||||
tags: {
|
||||
[...string]
|
||||
@dagger(output)
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
package: jq: "=~1.6"
|
||||
package: git: "=~2.30"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/repository": from: repository
|
||||
dir: "/repository"
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
git tag -l | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' > /tags.json
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/tags.json"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,14 @@ import (
|
||||
// Application source code
|
||||
source: dagger.#Artifact @dagger(input)
|
||||
|
||||
// Extra alpine packages to install
|
||||
package: {
|
||||
[string]: true | false | string @dagger(input)
|
||||
}
|
||||
|
||||
// working directory to use
|
||||
cwd: *"." | string @dagger(input)
|
||||
|
||||
// Environment variables
|
||||
env: {
|
||||
[string]: string @dagger(input)
|
||||
@ -31,6 +39,9 @@ import (
|
||||
// Run this yarn script
|
||||
script: string | *"build" @dagger(input)
|
||||
|
||||
// Optional arguments for the script
|
||||
args: [...string] | *[] @dagger(input)
|
||||
|
||||
build: os.#Dir & {
|
||||
from: ctr
|
||||
path: "/build"
|
||||
@ -38,7 +49,7 @@ import (
|
||||
|
||||
ctr: os.#Container & {
|
||||
image: alpine.#Image & {
|
||||
package: {
|
||||
"package": package & {
|
||||
bash: "=~5.1"
|
||||
yarn: "=~1.22"
|
||||
}
|
||||
@ -46,13 +57,17 @@ import (
|
||||
shell: path: "/bin/bash"
|
||||
command: """
|
||||
[ -n "$ENVFILE_NAME" ] && echo "$ENVFILE" > "$ENVFILE_NAME"
|
||||
yarn install --production false
|
||||
yarn run "$YARN_BUILD_SCRIPT"
|
||||
yarn --cwd "$YARN_CWD" install --production false
|
||||
|
||||
opts=( $(echo $YARN_ARGS) )
|
||||
yarn --cwd "$YARN_CWD" run "$YARN_BUILD_SCRIPT" ${opts[@]}
|
||||
mv "$YARN_BUILD_DIRECTORY" /build
|
||||
"""
|
||||
"env": env & {
|
||||
YARN_BUILD_SCRIPT: script
|
||||
YARN_ARGS: strings.Join(args, "\n")
|
||||
YARN_CACHE_FOLDER: "/cache/yarn"
|
||||
YARN_CWD: cwd
|
||||
YARN_BUILD_DIRECTORY: buildDir
|
||||
if writeEnvFile != "" {
|
||||
ENVFILE_NAME: writeEnvFile
|
||||
|
@ -49,3 +49,23 @@ TestS3UploadDir: {
|
||||
file: "foo.txt"
|
||||
}
|
||||
}
|
||||
|
||||
TestS3Sync: {
|
||||
deploy: s3.#Sync & {
|
||||
config: TestConfig.awsConfig
|
||||
source: TestDirectory
|
||||
target: "s3://\(bucket)/"
|
||||
}
|
||||
|
||||
verifyFile: #VerifyS3 & {
|
||||
config: TestConfig.awsConfig
|
||||
target: deploy.target
|
||||
file: "dirFile.txt"
|
||||
}
|
||||
|
||||
verifyDir: #VerifyS3 & {
|
||||
config: TestConfig.awsConfig
|
||||
target: deploy.target
|
||||
file: "foo.txt"
|
||||
}
|
||||
}
|
||||
|
71
tools/gendocs/.gitignore
vendored
71
tools/gendocs/.gitignore
vendored
@ -1,71 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# dotenv environment variable files
|
||||
.env*
|
||||
|
||||
# gatsby files
|
||||
.cache/
|
||||
public
|
||||
|
||||
# Mac files
|
||||
.DS_Store
|
||||
|
||||
# Yarn
|
||||
yarn-error.log
|
||||
.pnp/
|
||||
.pnp.js
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
.idea/
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Rocketseat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,61 +0,0 @@
|
||||
<p align="center">
|
||||
<img src="https://rocketseat-cdn.s3-sa-east-1.amazonaws.com/theme-docs.svg" alt="A illustration of file that is the @rocketseat/gatsby-theme-docs logo" width="100">
|
||||
</p>
|
||||
|
||||
<h2 align="center">
|
||||
Gatsby Starter: Rocket Docs
|
||||
</h2>
|
||||
|
||||
<p align="center">
|
||||
Out of the box Gatsby Starter for creating documentation websites easily and quickly. With support for MDX, code highlight, Analytics, SEO and more 🔥 Using the theme: <a href="https://github.com/Rocketseat/gatsby-themes/tree/main/%40rocketseat/gatsby-theme-docs">@rocketseat/gatsby-theme-docs</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/PRs-welcome-%238257E6.svg" alt="PRs welcome!" />
|
||||
|
||||
<img alt="License" src="https://img.shields.io/badge/license-MIT-%238257E6">
|
||||
|
||||
<a href="https://twitter.com/intent/follow?screen_name=rocketseat">
|
||||
<img src="https://img.shields.io/twitter/follow/rocketseat.svg?label=Follow%20@rocketseat" alt="Follow @rocketseat" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- 📝 MDX for docs;
|
||||
- 🛣 Yaml-based sidebar navigation;
|
||||
- 📱 Responsive and mobile friendly;
|
||||
- 🖥 Code highlighting with [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) and [react-live](https://github.com/FormidableLabs/react-live) support;
|
||||
- 🥇 SEO (Sitemap, schema.org data, Open Graph and Twitter tags).
|
||||
- 📈 Google Analytics support;
|
||||
- 📄 Custom docs schema;
|
||||
- 🖱 Table of Contents;
|
||||
- ⚡️ Offline Support & WebApp Manifest;
|
||||
- and much more 🔥
|
||||
|
||||
## ⚡️ Getting started
|
||||
|
||||
1. Create the website.
|
||||
|
||||
```sh
|
||||
npx gatsby new rocket-docs https://github.com/rocketseat/gatsby-starter-rocket-docs
|
||||
```
|
||||
|
||||
2. Start developing.
|
||||
|
||||
```sh
|
||||
cd rocket-docs
|
||||
gatsby develop
|
||||
```
|
||||
|
||||
3. Are you ready for launch?
|
||||
|
||||
Your site is now running at `http://localhost:8000`
|
||||
|
||||
## 📄 Docs
|
||||
|
||||
Looking for docs? Check our live demo and documentation [website](https://rocketdocs.netlify.app).
|
||||
|
||||
---
|
||||
|
||||
Made with 💜 by Rocketseat :wave: [check our community!](https://discordapp.com/invite/gCRAFhc)
|
@ -1 +0,0 @@
|
||||
../../docs
|
@ -1,28 +0,0 @@
|
||||
module.exports = {
|
||||
pathPrefix: `/${process.env.VERSION}`,
|
||||
siteMetadata: {
|
||||
siteTitle: `Dagger Docs`,
|
||||
defaultTitle: `Dagger Docs`,
|
||||
siteTitleShort: `Dagger Docs`,
|
||||
siteDescription: `Dagger Documentation`,
|
||||
siteUrl: `https://launch.dagger.io`,
|
||||
siteAuthor: `@dagger`,
|
||||
siteImage: `/banner.png`,
|
||||
siteLanguage: `en`,
|
||||
themeColor: `#1890FF`,
|
||||
docVersion : `${process.env.VERSION}`,
|
||||
},
|
||||
flags: { PRESERVE_WEBPACK_CACHE: true },
|
||||
plugins: [
|
||||
{
|
||||
resolve: `@rocketseat/gatsby-theme-docs`,
|
||||
options: {
|
||||
basePath: `/`,
|
||||
configPath: `docs/sidebar`,
|
||||
docsPath: `docs`,
|
||||
repositoryUrl: `https://github.com/dagger/dagger`,
|
||||
baseDir: `/`,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "dagger-docs",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": "dagger dc",
|
||||
"author": "Dagger",
|
||||
"license": "MIT",
|
||||
"starter-name": "dagger-docs-generator",
|
||||
"dependencies": {
|
||||
"@rocketseat/gatsby-theme-docs": "^2.3.1",
|
||||
"gatsby": "^3.0.4",
|
||||
"gatsby-plugin-canonical-urls": "^3.0.0",
|
||||
"gatsby-plugin-google-analytics": "^3.0.0",
|
||||
"gatsby-plugin-manifest": "^3.0.0",
|
||||
"gatsby-plugin-offline": "^4.0.0",
|
||||
"gatsby-plugin-remove-trailing-slashes": "^3.0.0",
|
||||
"gatsby-plugin-sitemap": "^3.0.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"keywords": [
|
||||
"gatsby",
|
||||
"rocketseat",
|
||||
"gatsby-starter"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "gatsby build",
|
||||
"start": "gatsby develop",
|
||||
"serve": "gatsby serve",
|
||||
"clean": "gatsby clean"
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
@ -1,6 +0,0 @@
|
||||
import React from 'react';
|
||||
import logo from '../assets/dagger-logo.png'
|
||||
|
||||
export default function Logo(props) {
|
||||
return <img src={logo} alt="Logo" />
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FiExternalLink } from 'react-icons/fi';
|
||||
|
||||
export default function ExternalLink({ link, label }) {
|
||||
return (
|
||||
<a href={link} rel="noopener noreferrer">
|
||||
{label}
|
||||
<FiExternalLink
|
||||
style={{ width: '16px', height: '16px', marginLeft: '10px' }}
|
||||
/>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
ExternalLink.propTypes = {
|
||||
link: PropTypes.string.isRequired,
|
||||
label: PropTypes.string.isRequired,
|
||||
};
|
@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {Link} from 'gatsby';
|
||||
|
||||
export default function InternalLink({ link, label }) {
|
||||
|
||||
return (
|
||||
<Link to={link} activeClassName="active-link">
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
InternalLink.propTypes = {
|
||||
link: PropTypes.string.isRequired,
|
||||
label: PropTypes.string.isRequired,
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Select as SelectStyled } from '../styles';
|
||||
|
||||
const Select = () => {
|
||||
const isBrowser = typeof window !== "undefined"
|
||||
const [tagsList, setTagsList] = useState([])
|
||||
const currentLocation = isBrowser ? window.location.pathname.split('/') : []
|
||||
currentLocation.shift() //remove last trailing slash
|
||||
|
||||
useEffect(() => {
|
||||
async function getTags() {
|
||||
const fetchTags = await fetch('/tags.json').then(result => result.json());
|
||||
if (fetchTags.length > 0) {
|
||||
setTagsList(fetchTags);
|
||||
}
|
||||
}
|
||||
|
||||
getTags()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<SelectStyled value={currentLocation[0]} onChange={(e) => isBrowser ? window.location.pathname = `/${e.currentTarget.value}` : null}>
|
||||
{tagsList.map(t => (
|
||||
<option>{t.tag}</option>
|
||||
))}
|
||||
</SelectStyled>
|
||||
);
|
||||
};
|
||||
|
||||
export default Select;
|
@ -1,95 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useStaticQuery, graphql, Link } from 'gatsby';
|
||||
import { useSidebar } from '@rocketseat/gatsby-theme-docs-core';
|
||||
|
||||
import {
|
||||
Container,
|
||||
LogoContainer,
|
||||
List,
|
||||
Heading,
|
||||
Item,
|
||||
SubItem,
|
||||
} from './styles';
|
||||
import Select from './Select'
|
||||
import { isExternalUrl } from '../../util/url';
|
||||
import ExternalLink from './ExternalLink';
|
||||
import InternalLink from './InternalLink';
|
||||
import Logo from '../Logos';
|
||||
|
||||
function ListWithSubItems({ children, text }) {
|
||||
return (
|
||||
<>
|
||||
<Heading>{text}</Heading>
|
||||
<SubItem>{children}</SubItem>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Sidebar({ isMenuOpen }) {
|
||||
const {
|
||||
site: {
|
||||
siteMetadata: { basePath },
|
||||
},
|
||||
} = useStaticQuery(graphql`
|
||||
{
|
||||
site {
|
||||
siteMetadata {
|
||||
basePath
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
const data = useSidebar();
|
||||
|
||||
function renderLink(link, label) {
|
||||
return isExternalUrl(link) ? (
|
||||
<ExternalLink link={link} label={label} />
|
||||
) : (
|
||||
<InternalLink link={link} label={label} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container isMenuOpen={isMenuOpen}>
|
||||
<LogoContainer>
|
||||
<Link to={basePath} aria-label="Go to home page">
|
||||
<Logo aria-hidden="true" />
|
||||
</Link>
|
||||
</LogoContainer>
|
||||
<Select />
|
||||
<nav>
|
||||
<List>
|
||||
{data.map(({ node: { label, link, items, id } }) => {
|
||||
if (Array.isArray(items)) {
|
||||
const subitems = items.map((item) => (
|
||||
<Item key={item.link}>{renderLink(item.link, item.label)}</Item>
|
||||
));
|
||||
|
||||
return (
|
||||
<ListWithSubItems key={id} text={label}>
|
||||
{subitems}
|
||||
</ListWithSubItems>
|
||||
);
|
||||
}
|
||||
|
||||
return <Item key={id}>{renderLink(link, label)}</Item>;
|
||||
})}
|
||||
</List>
|
||||
</nav>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
ListWithSubItems.propTypes = {
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.element),
|
||||
PropTypes.node,
|
||||
]).isRequired,
|
||||
text: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
Sidebar.propTypes = {
|
||||
isMenuOpen: PropTypes.bool.isRequired,
|
||||
};
|
@ -1,139 +0,0 @@
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
export const Container = styled.aside`
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
position: sticky;
|
||||
top: 0;
|
||||
padding-top: 36px;
|
||||
transition: transform 0.5s;
|
||||
height: calc(100vh - 1px);
|
||||
|
||||
nav {
|
||||
width: 100%;
|
||||
padding-top: 24px;
|
||||
align-self: flex-start;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 780px) {
|
||||
max-width: 75%;
|
||||
min-width: auto;
|
||||
z-index: 1001;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
padding-top: 32px;
|
||||
background: ${({ theme }) => theme.colors.background};
|
||||
transform: translate3d(
|
||||
${({ isMenuOpen }) => (isMenuOpen ? '0' : '-100%')},
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
`;
|
||||
|
||||
export const LogoContainer = styled.div`
|
||||
width: 70%;
|
||||
|
||||
a {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
`;
|
||||
|
||||
export const List = styled.ul`
|
||||
list-style: none;
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
`;
|
||||
|
||||
export const Heading = styled.li`
|
||||
padding-left: 30px;
|
||||
width: 100%;
|
||||
text-transform: uppercase;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-top: 20px;
|
||||
color: ${({ theme }) => theme.colors.title};
|
||||
letter-spacing: 0.142em;
|
||||
`;
|
||||
|
||||
export const Item = styled.li`
|
||||
font-size: 15px;
|
||||
width: 100%;
|
||||
transition: all 200ms ease-in-out;
|
||||
padding: 0 20px;
|
||||
cursor: pointer;
|
||||
|
||||
a,
|
||||
span {
|
||||
display: block;
|
||||
font-size: 15px;
|
||||
color: ${({ theme }) => theme.colors.text};
|
||||
background-color: ${({ theme }) => theme.colors.background};
|
||||
padding: 4px 10px;
|
||||
margin: 4px 0;
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
cursor: pointer;
|
||||
margin: 0 auto;
|
||||
|
||||
transition: all 0.2s ease;
|
||||
|
||||
svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&:not(.active-link):hover {
|
||||
color: ${({ theme }) => theme.colors.primary};
|
||||
}
|
||||
|
||||
&.active-link {
|
||||
color: ${({ theme }) => theme.colors.primary};
|
||||
background-color: ${({ theme }) => theme.colors.shape};
|
||||
}
|
||||
|
||||
@media (max-width: 780px) {
|
||||
&.active-link {
|
||||
background: ${({ theme }) => theme.colors.shape};
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SubItem = styled(List)`
|
||||
margin: 5px 0 0 0;
|
||||
`;
|
||||
|
||||
export const Select = styled.select`
|
||||
border: 1px solid #6C6C808C;
|
||||
padding: 0.5rem;
|
||||
margin: 2rem 0 1rem;
|
||||
width: 100%;
|
||||
`;
|
@ -1,15 +0,0 @@
|
||||
export default {
|
||||
colors: {
|
||||
primary: '#1890FF',
|
||||
background: '#FFFFFF',
|
||||
shape: `#F2F2FA`,
|
||||
title: `#3D3D4D`,
|
||||
text: `#6C6C80`,
|
||||
components: {
|
||||
blockquote: {
|
||||
background: `#332616`,
|
||||
text: `#E1E1E6`,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export const copyToClipboard = (str) => {
|
||||
const { clipboard } = window.navigator;
|
||||
|
||||
if (!clipboard || typeof clipboard.writeText !== `function`) {
|
||||
const textarea = document.createElement(`textarea`);
|
||||
textarea.value = str;
|
||||
textarea.setAttribute(`readonly`, true);
|
||||
textarea.setAttribute(`contenteditable`, true);
|
||||
textarea.style.position = `absolute`;
|
||||
textarea.style.left = `-9999px`;
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
textarea.setSelectionRange(0, textarea.value.length);
|
||||
document.execCommand(`copy`);
|
||||
document.body.removeChild(textarea);
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
return clipboard.writeText(str);
|
||||
};
|
@ -1,11 +0,0 @@
|
||||
export default function slugify(string) {
|
||||
return string
|
||||
.toString() // Cast to string
|
||||
.toLowerCase() // Convert the string to lowercase letters
|
||||
.trim() // Remove whitespace from both sides of a string
|
||||
.replace(/\s/g, '-') // Replace each space with -
|
||||
.replace(
|
||||
/[^\w\-\u00b4\u00C0-\u00C3\u00c7\u00C9-\u00CA\u00CD\u00D3-\u00D5\u00DA\u00E0-\u00E3\u00E7\u00E9-\u00EA\u00ED\u00F3-\u00F5\u00FA]+/g,
|
||||
'',
|
||||
); // Removes all chars that aren't words, -, ´ or some latin characters (À Á Â Ã Ç É Ê Í Ó Ô Õ Ú à á â ã ç é ê í ó ô õ ú)
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
function isExternalUrl(url) {
|
||||
return new RegExp('^((https?:)?//)', 'i').test(url);
|
||||
}
|
||||
|
||||
module.exports = { isExternalUrl };
|
@ -1,18 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'gatsby';
|
||||
|
||||
import Layout from '@rocketseat/gatsby-theme-docs/src/components/Layout';
|
||||
import SEO from '@rocketseat/gatsby-theme-docs/src/components/SEO';
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<Layout title="Page not found!">
|
||||
<SEO title="404: Not found" />
|
||||
<p>You just hit a route that doesn't exist... the sadness.</p>
|
||||
<p>
|
||||
If you'd like to go back to homepage, <Link to="/">click here</Link>
|
||||
.
|
||||
</p>
|
||||
</Layout>
|
||||
);
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 77 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
14640
tools/gendocs/yarn.lock
14640
tools/gendocs/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user