Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add offline docs #8527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/setup-node/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ runs:
cache-dependency-path: "site/yarn.lock"
- name: Install node_modules
shell: bash
run: ./scripts/yarn_install.sh
run: ../scripts/yarn_install.sh
working-directory: site
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ jobs:
env:
CODER_BASE_IMAGE_TAG: ${{ steps.image-base-tag.outputs.tag }}

- name: Generate offline docs
run: |
version="$(./scripts/version.sh)"
make -j build/coder_docs_"$version".tgz

- name: ls build
run: ls -lh build

Expand Down
2 changes: 2 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
printWidth: 80
semi: false
trailingComma: all
useTabs: false
tabWidth: 2
overrides:
- files:
- README.md
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,18 @@ build/coder_helm_$(VERSION).tgz:
--output "$@"

site/out/index.html: site/package.json $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
./scripts/yarn_install.sh
cd site
../scripts/yarn_install.sh
yarn build

offlinedocs/out/index.html: $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
cd offlinedocs
../scripts/yarn_install.sh
yarn export

build/coder_docs_$(VERSION).tgz: offlinedocs/out/index.html
tar -czf "$@" -C offlinedocs/out .

install: build/coder_$(VERSION)_$(GOOS)_$(GOARCH)$(GOOS_BIN_EXT)
install_dir="$$(go env GOPATH)/bin"
output_file="$${install_dir}/coder$(GOOS_BIN_EXT)"
Expand Down
3 changes: 3 additions & 0 deletions offlinedocs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
38 changes: 38 additions & 0 deletions offlinedocs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo

# content
public/images/
5 changes: 5 additions & 0 deletions offlinedocs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
7 changes: 7 additions & 0 deletions offlinedocs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
trailingSlash: true,
}

module.exports = nextConfig
37 changes: 37 additions & 0 deletions offlinedocs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "coder-docs-generator",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "yarn copy-images && next dev",
"build": "next build",
"start": "next start",
"export": "yarn copy-images && next build && next export",
"copy-images": "sh ./scripts/copyImages.sh"
},
"dependencies": {
"@chakra-ui/react": "2.7.1",
"@emotion/react": "11",
"@emotion/styled": "11",
"archiver": "5.3.1",
"framer-motion": "6",
"front-matter": "4.0.2",
"fs-extra": "10.1.0",
"lodash": "4.17.21",
"next": "12.1.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "4.4.0",
"react-markdown": "8.0.3",
"rehype-raw": "6.1.1",
"remark-gfm": "3.0.1"
},
"devDependencies": {
"@types/node": "18.0.0",
"@types/react": "18.0.14",
"@types/react-dom": "18.0.5",
"eslint": "8.17.0",
"eslint-config-next": "12.1.6",
"typescript": "4.7.3"
}
}
Loading