Skip to content
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

fix: doc HMR #4

Merged
merged 5 commits into from
Sep 28, 2024
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
23 changes: 21 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,28 @@ jobs:
- name: Install dependencies
run: pnpm install
- run: pnpm test:type
build-dryrun:
runs-on: ubuntu-latest
name: Build DryRun
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- run: pnpm build
pub-dryrun:
runs-on: ubuntu-latest
name: Type Test
name: Publish Dry run
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -61,5 +80,5 @@ jobs:
- name: Install dependencies
run: pnpm install
- run: pnpm build
- run: pnpm publish --dry-run --access=public --no-git-checks
- run: pnpm publish -r --dry-run --access=public --no-git-checks

4 changes: 3 additions & 1 deletion doc/docs/guide/_meta.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
["index"]
[
"index"
]
7 changes: 7 additions & 0 deletions doc/docs/guide/basic-usage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Button } from '@qwqui/core';

export default function App() {
return (
<Button />
)
}
210 changes: 0 additions & 210 deletions doc/docs/guide/index.md

This file was deleted.

5 changes: 5 additions & 0 deletions doc/docs/guide/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Button

This is button

<code src="./basic-usage.tsx" />
12 changes: 9 additions & 3 deletions doc/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"name": "qwqui-doc",
"name": "@qwqui/doc",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"preview": "rspress preview"
"preview": "rspress preview",
"clean:dist": "rimraf doc_build",
"clean:deps": "rimraf node_modules"
},
"dependencies": {
"@qwqui/core": "workspace:^",
"@qwqui/theme": "workspace:^",
"@rspress/plugin-preview": "^1.31.1",
"rspress": "^1.31.0"
},
"devDependencies": {
"@types/node": "^16"
"@types/node": "^16",
"sass-embedded": "^1.79.3",
"sass-loader": "^16.0.2"
}
}
18 changes: 18 additions & 0 deletions doc/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as path from 'path';
import { defineConfig } from 'rspress/config';
import { pluginPreview } from "@rspress/plugin-preview";
import { pluginSass } from '@rsbuild/plugin-sass';

export default defineConfig({
root: path.join(__dirname, 'docs'),
Expand All @@ -15,4 +17,20 @@ export default defineConfig({
{ icon: 'github', mode: 'link', content: 'https://github.com/web-infra-dev/rspress' },
],
},
plugins: [pluginPreview()],
builderConfig: {
// plugins: [
// pluginSass()
// ],
tools: {
rspack: {
resolve: {
alias: {
'@qwqui/core': path.join(__dirname, '../packages/components'),
'@qwqui/theme': path.join(__dirname, '../packages/theme/index.scss')
},
},
},
}
}
});
7 changes: 6 additions & 1 deletion doc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
"resolveJsonModule": true,
"moduleResolution": "bundler",
"useDefineForClassFields": true,
"allowImportingTsExtensions": true
"allowImportingTsExtensions": true,
"paths": {
"@qwqui/core": [
"../packages/components"
]
}
},
"include": ["docs", "theme", "rspress.config.ts"],
"mdx": {
Expand Down
2 changes: 1 addition & 1 deletion internal/create-core-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function app() {
const exportStmts = dirs
.filter(path => !statSync(join(COMPONENT_ROOT, path)).isFile())
.filter(path => !blackList.some(name => path.includes(name)))
.map(dir => `export * from './${dir}'`);
.map(dir => `export * from './${dir}/index.ts'`);
const entites = fg.sync([
'**/*.scss'
], {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"@microsoft/api-extractor": "^7.47.9",
"@rsbuild/plugin-sass": "^1.0.1",
"@rslib/core": "^0.0.8",
"@swc/jest": "^0.2.36",
Expand All @@ -22,7 +23,9 @@
"build": "pnpm --filter !@qwqui/core build && pnpm --filter @qwqui/core build",
"clean:dist": "pnpm --filter @qwqui/* clean:dist",
"clean:deps": "pnpm --filter @qwqui/* clean:deps",
"create:comp": "esno internal/create-component.ts"
"create:comp": "esno internal/create-component.ts",
"dev": "pnpm -C doc dev",
"build:site": "pnpm --filter @qwqui/doc build"
},
"devDependencies": {
"@types/jest": "^29.5.13"
Expand Down
2 changes: 1 addition & 1 deletion packages/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const defineBuild = (config: DefineBuildConfig = {}) => {
]
}
}
}
},
})
}

4 changes: 3 additions & 1 deletion packages/components/button/src/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import './style.scss'

export const Button = () => {
return (
<></>
<button>
Click!
</button>
)
}
Loading