-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate packages building with Rslib
- Loading branch information
Showing
14 changed files
with
227 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function HelloWorld() { | ||
return <div>Hello World External</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Guide | ||
|
||
```jsx | ||
export default function HelloWorld() { | ||
return <div>Hello World Internal (default)</div>; | ||
} | ||
``` | ||
|
||
<code src="./component.jsx" /> | ||
|
||
```jsx direction=vertical | ||
export default function HelloWorld() { | ||
return <div>Hello World Internal (vertical)</div>; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@rspress-fixture/plugin-playground", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "rspress build", | ||
"dev": "rspress dev", | ||
"preview": "rspress preview" | ||
}, | ||
"dependencies": { | ||
"@rspress/plugin-playground": "workspace:*", | ||
"@rspress/shared": "workspace:*", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"rspress": "workspace:*", | ||
"solid-js": "^1.9.4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.11.17" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import path from 'node:path'; | ||
import { pluginPlayground } from '@rspress/plugin-playground'; | ||
import { defineConfig } from 'rspress/config'; | ||
|
||
export default defineConfig({ | ||
root: path.join(__dirname, 'doc'), | ||
plugins: [pluginPlayground()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"jsx": "react-jsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import path from 'node:path'; | ||
import { expect, test } from '@playwright/test'; | ||
import { getPort, killProcess, runDevCommand } from '../utils/runCommands'; | ||
|
||
const fixtureDir = path.resolve(__dirname, '../fixtures'); | ||
|
||
test.describe('plugin test', async () => { | ||
let appPort; | ||
let app; | ||
test.beforeAll(async () => { | ||
const appDir = path.join(fixtureDir, 'plugin-playground'); | ||
appPort = await getPort(); | ||
app = await runDevCommand(appDir, appPort); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
if (app) { | ||
await killProcess(app); | ||
} | ||
}); | ||
|
||
test('Should render the element', async ({ page }) => { | ||
await page.goto(`http://localhost:${appPort}/`, { | ||
waitUntil: 'networkidle', | ||
}); | ||
|
||
const playgroundElements = await page.$$('.rspress-playground'); | ||
|
||
const internalDemoCodePreviewDefault = await page | ||
.locator('.rspress-playground > .rspress-playground-runner > div') | ||
.getByText('Hello World Internal (default)'); | ||
|
||
const internalDemoCodePreviewVertical = await page | ||
.locator('.rspress-playground > .rspress-playground-runner > div') | ||
.getByText('Hello World Internal (vertical)'); | ||
|
||
const externalDemoCodePreview = await page | ||
.locator('.rspress-playground > .rspress-playground-runner > div') | ||
.getByText('Hello World External'); | ||
|
||
expect(playgroundElements.length).toBe(3); | ||
expect(await internalDemoCodePreviewDefault.count()).toBe(1); | ||
expect(await internalDemoCodePreviewVertical.count()).toBe(1); | ||
expect(await externalDemoCodePreview.count()).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [ | ||
{ | ||
format: 'cjs', | ||
source: { | ||
entry: { index: 'src/cli/index.ts' }, | ||
}, | ||
output: { | ||
distPath: { | ||
root: 'dist/cli/cjs', | ||
}, | ||
}, | ||
syntax: 'es2020', | ||
}, | ||
{ | ||
format: 'esm', | ||
source: { | ||
entry: { index: 'src/cli/index.ts' }, | ||
}, | ||
output: { | ||
distPath: { | ||
root: 'dist/cli/esm', | ||
}, | ||
externals: ['@types/react'], | ||
}, | ||
syntax: 'es2020', | ||
dts: { bundle: true }, | ||
}, | ||
{ | ||
format: 'cjs', | ||
source: { | ||
entry: { index: 'src/web/index.ts' }, | ||
}, | ||
output: { | ||
distPath: { | ||
root: 'dist/web/cjs', | ||
}, | ||
}, | ||
syntax: 'es2020', | ||
}, | ||
{ | ||
format: 'esm', | ||
source: { | ||
entry: { index: 'src/web/index.ts' }, | ||
}, | ||
output: { | ||
externals: ['@types/react'], | ||
distPath: { | ||
root: 'dist/web/esm', | ||
}, | ||
}, | ||
syntax: 'es2020', | ||
dts: { bundle: true }, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [ | ||
{ | ||
format: 'cjs', | ||
source: { | ||
entry: { index: 'src/index.ts' }, | ||
}, | ||
syntax: 'es2020', | ||
dts: { | ||
bundle: true, | ||
}, | ||
}, | ||
{ | ||
format: 'cjs', | ||
source: { | ||
entry: { utils: 'src/utils.ts' }, | ||
}, | ||
syntax: 'es2020', | ||
dts: { | ||
bundle: true, | ||
}, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.