Skip to content

Commit

Permalink
Merge branch 'main' into feat-preserve-query-on-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Mar 28, 2024
2 parents 35643f8 + ead0d0a commit 824fa98
Show file tree
Hide file tree
Showing 88 changed files with 944 additions and 293 deletions.
26 changes: 26 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .github/release.yml

changelog:
exclude:
authors:
# Ignore the release PR created by github-actions
- github-actions
categories:
- title: Breaking Changes 🍭
labels:
- "change: breaking"
- title: New Features 🎉
labels:
- "change: feat"
- title: Performance 🚀
labels:
- "change: perf"
- title: Bug Fixes 🐞
labels:
- "change: fix"
- title: Document 📖
labels:
- "change: docs"
- title: Other Changes
labels:
- "*"
10 changes: 7 additions & 3 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"extends": ["config:recommended", "schedule:weekly"],
"packageRules": [
// Use chore as semantic commit type for commit messages
{
"matchPackagePatterns": ["*"],
"semanticCommitType": "chore"
"semanticCommitType": "chore",
// always bump package.json
"rangeStrategy": "bump"
},
{
"groupName": "rsbuild",
Expand Down Expand Up @@ -33,6 +35,8 @@
// manually updating
"typescript",
// align Node.js version minimum requirements
"@types/node"
"@types/node",
"node",
"pnpm"
]
}
7 changes: 7 additions & 0 deletions e2e/fixtures/api-docgen/doc/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Hello World

## API

This is API Table

<API moduleName="button" />
17 changes: 17 additions & 0 deletions e2e/fixtures/api-docgen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@rspress-fixture/rspress-api-docgen",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"preview": "rspress preview"
},
"dependencies": {
"@rspress/plugin-api-docgen": "workspace:*",
"rspress": "workspace:*"
},
"devDependencies": {
"@types/node": "^14"
}
}
15 changes: 15 additions & 0 deletions e2e/fixtures/api-docgen/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import path from 'path';
import { defineConfig } from 'rspress/config';
import { pluginApiDocgen } from '@rspress/plugin-api-docgen';

export default defineConfig({
root: path.join(__dirname, 'doc'),
plugins: [
pluginApiDocgen({
entries: {
button: './src/Button.ts',
},
apiParseTool: 'react-docgen-typescript',
}),
],
});
15 changes: 15 additions & 0 deletions e2e/fixtures/api-docgen/src/Button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export type ButtonProps = {
/**
* Whether to disable the button
* - This is extra line a
* - This is extra line b
*/
disabled?: boolean;
/**
* Type of Button
* @default 'default'
*/
size?: 'mini' | 'small' | 'default' | 'large';
};

export const Button = (props?: ButtonProps) => {};
File renamed without changes.
16 changes: 16 additions & 0 deletions e2e/fixtures/custom-id/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@rspress-fixture/rspress-custom-id",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"preview": "rspress preview"
},
"dependencies": {
"rspress": "workspace:*"
},
"devDependencies": {
"@types/node": "^14"
}
}
6 changes: 6 additions & 0 deletions e2e/fixtures/custom-id/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as path from 'path';
import { defineConfig } from 'rspress/config';

export default defineConfig({
root: path.join(__dirname, 'doc'),
});
1 change: 1 addition & 0 deletions e2e/fixtures/custom-id/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
14 changes: 14 additions & 0 deletions e2e/fixtures/i18n/doc/en/guide/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"type": "dir",
"name": "basic",
"label": "basic"
},
{
"type": "divider"
},
{
"type": "section-header",
"label": "growth"
}
]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Quick Start

[click by absolute path](/guide/install) to go to install
[click by absolute path](/guide/basic/install) to go to install

[click for relative path](./install) to go to install
14 changes: 14 additions & 0 deletions e2e/fixtures/i18n/doc/zh/guide/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"type": "dir",
"name": "basic",
"label": "basic"
},
{
"type": "divider"
},
{
"type": "section-header",
"label": "growth"
}
]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 快速开始

[点击通过绝对路径](/guide/install) 跳往安装
[点击通过绝对路径](/guide/basic/install) 跳往安装

[点击通过相对路径](./install) 跳往安装
10 changes: 10 additions & 0 deletions e2e/fixtures/i18n/i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"basic": {
"zh": "基本",
"en": "Basic"
},
"growth": {
"zh": "成长",
"en": "Growth"
}
}
26 changes: 0 additions & 26 deletions e2e/fixtures/i18n/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ export default defineConfig({
lang: 'zh',
title: '一个很棒的项目',
description: '一个很棒的项目描述',
sidebar: {
'/guide/': [
{
text: '指南',
items: [
{
text: '快速上手',
link: '/guide/quick-start',
},
],
},
],
},
// 语言切换按钮的文案
// Language switch button text
label: '简体中文',
Expand All @@ -35,19 +22,6 @@ export default defineConfig({
lang: 'en',
title: 'A awesome project',
description: 'A awesome project description',
sidebar: {
'/en/guide/': [
{
text: 'Guide',
items: [
{
text: 'Quick Start',
link: '/en/guide/quick-start',
},
],
},
],
},
label: 'English',
},
],
Expand Down
1 change: 1 addition & 0 deletions e2e/fixtures/replace-rules/doc/content.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# content
3 changes: 3 additions & 0 deletions e2e/fixtures/replace-rules/doc/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Content from './content.mdx';

<Content />
16 changes: 16 additions & 0 deletions e2e/fixtures/replace-rules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@rspress-fixture/rspress-replace-rules",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"preview": "rspress preview"
},
"dependencies": {
"rspress": "workspace:*"
},
"devDependencies": {
"@types/node": "^14"
}
}
12 changes: 12 additions & 0 deletions e2e/fixtures/replace-rules/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as path from 'path';
import { defineConfig } from 'rspress/config';

export default defineConfig({
root: path.join(__dirname, 'doc'),
replaceRules: [
{
search: /content/g,
replace: 'h1',
},
],
});
1 change: 1 addition & 0 deletions e2e/fixtures/replace-rules/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
50 changes: 50 additions & 0 deletions e2e/tests/api-docgen.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { expect, test } from '@playwright/test';
import path from 'path';
import { getPort, killProcess, runDevCommand } from '../utils/runCommands';

const fixtureDir = path.resolve(__dirname, '../fixtures');

test.describe('api-docgen test', async () => {
let appPort;
let app;

test.beforeAll(async () => {
const appDir = path.join(fixtureDir, 'api-docgen');
appPort = await getPort();
app = await runDevCommand(appDir, appPort);
});

test.afterAll(async () => {
if (app) {
await killProcess(app);
}
});

test('Index page', async ({ page }) => {
await page.goto(`http://localhost:${appPort}`);
const table = await page.$('table');
const tableContent = await page.evaluate(table => table?.innerHTML, table);

// Property
expect(tableContent).toContain('Property');
expect(tableContent).toContain('disabled');
expect(tableContent).toContain('size');

// Description
expect(tableContent).toContain('Description');
expect(tableContent).toContain('Whether to disable the button');
expect(tableContent).toContain('- This is extra line a');
expect(tableContent).toContain('- This is extra line b');
expect(tableContent).toContain('Type of Button');

// Type
expect(tableContent).toContain('Type');
expect(tableContent).toContain('boolean');
expect(tableContent).toContain('"mini" | "small" | "default" | "large"');

// Default Value
expect(tableContent).toContain('Default Value');
expect(tableContent).toContain('-');
expect(tableContent).toContain("'default'");
});
});
13 changes: 1 addition & 12 deletions e2e/tests/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.describe('basic test', async () => {
await page.goto(`http://localhost:${appPort}`);
const h1 = await page.$('h1');
const text = await page.evaluate(h1 => h1?.textContent, h1);
await expect(text).toContain('Hello World');
expect(text).toContain('Hello World');
// expect the .header-anchor to be rendered and take the correct href
const headerAnchor = await page.$('.header-anchor');
const href = await page.evaluate(
Expand All @@ -33,17 +33,6 @@ test.describe('basic test', async () => {
expect(href).toBe('#hello-world');
});

test('Guide page', async ({ page }) => {
await page.goto(`http://localhost:${appPort}/guide`, {
waitUntil: 'networkidle',
});
const h1 = await page.$('h1');
const className = await page.evaluate(h1 => h1?.className, h1);
expect(className).toContain('title_3b154'); // hash in css module should stable
const text = await page.evaluate(h1 => h1?.textContent, h1);
expect(text).toContain('Guide');
});

test('404 page', async ({ page }) => {
await page.goto(`http://localhost:${appPort}/404`, {
waitUntil: 'networkidle',
Expand Down
33 changes: 33 additions & 0 deletions e2e/tests/custom-id.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { expect, test } from '@playwright/test';
import path from 'path';
import { getPort, killProcess, runDevCommand } from '../utils/runCommands';

const fixtureDir = path.resolve(__dirname, '../fixtures');

test.describe('custom-id test', async () => {
let appPort;
let app;
test.beforeAll(async () => {
const appDir = path.join(fixtureDir, 'custom-id');
appPort = await getPort();
app = await runDevCommand(appDir, appPort);
});

test.afterAll(async () => {
if (app) {
await killProcess(app);
}
});

test('Guide page', async ({ page }) => {
await page.goto(`http://localhost:${appPort}/guide`, {
waitUntil: 'networkidle',
});
const h1 = await page.$('h1');
const className = await page.evaluate(h1 => h1?.className, h1);
expect(className).toContain('title_3b154'); // hash in css module should stable
const text = await page.evaluate(h1 => h1?.textContent, h1);
expect(text).toContain('Guide');
});

});
Loading

0 comments on commit 824fa98

Please sign in to comment.