Skip to content
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
1 change: 1 addition & 0 deletions packages/create-rstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ npx create-rstack -d my-project -t app-vanilla-ts
- `lib-vue-ts` - TypeScript Vue library
- `lib-solid-js` - JavaScript Solid library
- `lib-solid-ts` - TypeScript Solid library
- `doc-basic` - Basic documentation site

## Documentation

Expand Down
11 changes: 11 additions & 0 deletions packages/create-rstack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const getTemplateName = async ({ template }: Argv): Promise<string> => {
return `lib-${libraryType}-${language}`;
}

if (template === 'doc' || template.startsWith('doc-')) {
const [, documentationType = 'basic'] = template.split('-');
return `doc-${documentationType}`;
}

const [type, language = 'js'] = template.split('-');
return `${type}-${language}`;
}
Expand All @@ -33,10 +38,15 @@ const getTemplateName = async ({ template }: Argv): Promise<string> => {
options: [
{ value: 'app', label: 'Web Application' },
{ value: 'lib', label: 'Library' },
{ value: 'doc', label: 'Documentation' },
],
}),
);

if (projectType === 'doc') {
return 'doc-basic';
}

const templateType = checkCancel<string>(
await select({
message: projectType === 'app' ? 'Select framework' : 'Select library type',
Expand Down Expand Up @@ -90,6 +100,7 @@ await create({
'lib-vue-ts',
'lib-solid-js',
'lib-solid-ts',
'doc-basic',
],
builtinTools: [],
getTemplateName,
Expand Down
13 changes: 13 additions & 0 deletions packages/create-rstack/template-doc-basic/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# AGENTS.md

## Commands

- `{{ packageManager }} run dev` - Start the documentation development server
- `{{ packageManager }} run build` - Build the documentation site for production
- `{{ packageManager }} run preview` - Preview the production build locally

## Docs

- Rstack: https://rstack.rs/llms.txt
- Rspress: https://rspress.rs/llms.txt
- Rsbuild: https://rsbuild.rs/llms.txt
34 changes: 34 additions & 0 deletions packages/create-rstack/template-doc-basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Rstack documentation site

## Setup

Install the dependencies:

```bash
{{ packageManager }} install
```

## Get started

Start the development server:

```bash
{{ packageManager }} run dev
```

Build the website for production:

```bash
{{ packageManager }} run build
```

Preview the production build locally:

```bash
{{ packageManager }} run preview
```

## Learn more

- [Rstack documentation](https://rstack.rs)
- [Rspress documentation](https://rspress.rs)
16 changes: 16 additions & 0 deletions packages/create-rstack/template-doc-basic/docs/_nav.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"text": "Guide",
"link": "/guide/start/introduction",
"activeMatch": "/guide/"
},
{
"text": "API",
"link": "/api/",
"activeMatch": "/api/"
},
{
"text": "Rspress",
"link": "https://rspress.rs/"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["index", "commands"]
25 changes: 25 additions & 0 deletions packages/create-rstack/template-doc-basic/docs/api/commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Commands

## dev

Start the local development server:

```bash
rs doc
```

## build

Build the documentation site for production:

```bash
rs doc build
```

## preview

Preview the production build locally:

```bash
rs doc preview
```
6 changes: 6 additions & 0 deletions packages/create-rstack/template-doc-basic/docs/api/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: API Overview
overview: true
---

This is an API Overview page which outlines all the available APIs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "dir-section-header",
"name": "start",
"label": "Getting Started"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["introduction"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Introduction

Rspress is a fast static site generator based on [Rsbuild](https://rsbuild.rs/). It supports Markdown and MDX and includes a default documentation theme.

Learn more in the [Rspress documentation](https://rspress.rs/).
39 changes: 39 additions & 0 deletions packages/create-rstack/template-doc-basic/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
pageType: home

hero:
name: My Site
text: A cool website!
tagline: This is the tagline
actions:
- theme: brand
text: Quick Start
link: /guide/start/introduction
- theme: alt
text: GitHub
link: https://github.com/rstackjs/rstack-cli
image:
src: https://assets.rspack.rs/rspress/rspress-logo.svg
alt: Logo
features:
- title: Blazing fast build speed
details: The core compilation module is based on the Rust front-end toolchain, providing a more ultimate development experience.
icon: 🏃🏻‍♀️
link: /guide/start/introduction
- title: Built-in full-text search
details: Automatically generates a full-text search index for you during construction, providing out-of-the-box full-text search capabilities.
icon: 🎨
link: https://rspress.rs/guide/advanced/custom-search
- title: AI-friendly
details: Generate llms.txt and Markdown files compliant with the llms.txt specification through SSG-MD, making it easier for large language models to understand and use your documentation.
icon: 🤖
link: https://rspress.rs/guide/basic/ssg-md
- title: Static site generation
details: In production, it automatically builds into static HTML files, which can be easily deployed anywhere.
icon: 🌈
link: https://rspress.rs/guide/basic/ssg
- title: Providing multiple custom capabilities
details: Through its extension mechanism, you can easily extend theme UI and build process.
icon: 🔥
link: https://rspress.rs/guide/basic/custom-theme
---
14 changes: 14 additions & 0 deletions packages/create-rstack/template-doc-basic/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/
doc_build/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
23 changes: 23 additions & 0 deletions packages/create-rstack/template-doc-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "rstack-doc-basic",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "rs doc build",
"dev": "rs doc",
"format": "rs fmt",
"lint": "rs lint",
"preview": "rs doc preview"
},
"devDependencies": {
"@rspress/core": "^2.0.19",
"@types/node": "^24.13.3",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"rstack": "^0.3.5",
"typescript": "^7.0.2"
}
}
19 changes: 19 additions & 0 deletions packages/create-rstack/template-doc-basic/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Rstack configuration guide: https://rstack.rs/config
import path from 'node:path';
import { define } from 'rstack';

define.doc({
root: path.join(import.meta.dirname, 'docs'),
title: 'My Site',
});

define.lint(async () => {
const { js, ts, reactPlugin, reactHooksPlugin } = await import('rstack/lint');

return [
js.configs.recommended,
ts.configs.recommended,
reactPlugin.configs.recommended,
reactHooksPlugin.configs.recommended,
];
});
26 changes: 26 additions & 0 deletions packages/create-rstack/template-doc-basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"lib": ["DOM", "ES2020"],
"jsx": "react-jsx",
"target": "ES2020",
"noEmit": true,
"skipLibCheck": true,
"types": ["rstack/types", "node"],
"useDefineForClassFields": true,

/* modules */
"moduleDetection": "force",
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,

/* type checking */
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["docs", "rstack.config.ts"],
"mdx": {
"checkMdx": true
}
}
18 changes: 18 additions & 0 deletions packages/create-rstack/tests/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@ test.each([
},
);

test('creates the doc-basic template', async () => {
const projectDirectory = await createProject('doc-basic');
const packageJson = JSON.parse(
await readFile(path.join(projectDirectory, 'package.json'), 'utf8'),
);

expect(packageJson.name).toBe('my-app');

await expect(access(path.join(projectDirectory, 'README.md'))).resolves.toBeUndefined();
await expect(access(path.join(projectDirectory, '.gitignore'))).resolves.toBeUndefined();
await expect(access(path.join(projectDirectory, 'rstack.config.ts'))).resolves.toBeUndefined();
await expect(access(path.join(projectDirectory, 'tsconfig.json'))).resolves.toBeUndefined();
await expect(access(path.join(projectDirectory, 'docs', 'index.md'))).resolves.toBeUndefined();
await expect(
access(path.join(projectDirectory, 'docs', 'guide', 'start', 'introduction.md')),
).resolves.toBeUndefined();
});

test.each([
{
template: 'lib-node-js',
Expand Down