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

[WIP] build: use Rslib to build packages #1407

Closed
wants to merge 1 commit into from
Closed
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ node_modules/
.sonarlint

dist/
dist-rslib/
coverage/
release/
output/
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@modern-js/module-tools": "2.59.0",
"@modern-js/tsconfig": "2.59.0",
"@playwright/test": "1.46.0",
"@rslib/core": "latest",
"@types/cross-spawn": "^6.0.2",
"@types/fs-extra": "11.0.4",
"@types/node": "^18.11.17",
Expand All @@ -67,5 +68,10 @@
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"overrides": {
"@rslib/core": "link:../rslib/packages/core"
}
}
}
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"build:watch": "modern build -w",
"test": "vitest run",
"reset": "rimraf ./**/node_modules",
Expand Down
20 changes: 20 additions & 0 deletions packages/cli/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2023',
// dts: {
// bundle: true,
// distPath: 'dist-rslib',
// },
output: {
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib:wip": "rslib build",
"--wip--": "tailwind",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
1 change: 1 addition & 0 deletions packages/create-rspress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"build:watch": "modern build -w",
"reset": "rimraf ./**/node_modules",
"new": "modern new",
Expand Down
20 changes: 20 additions & 0 deletions packages/create-rspress/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2023',
// dts: {
// bundle: true,
// distPath: 'dist-rslib',
// },
output: {
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
2 changes: 1 addition & 1 deletion packages/modern-plugin-rspress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"main": "./dist/index.js",
"scripts": {
"new": "modern new",
"build": "modern build",
"build:rslib": "rslib build",
"dev": "modern build --watch"
},
"dependencies": {
Expand Down
40 changes: 40 additions & 0 deletions packages/modern-plugin-rspress/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'cjs',
syntax: 'es2020',
// dts: {
// bundle: true,
// distPath: 'dist-rslib',
// },
output: {
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
tools: {
rspack: {
module: {
parser: {
'javascript/auto': {
wrappedContextRecursive: false,
},
javascript: {
wrappedContextRecursive: false,
},
'javascript/dynamic': {
wrappedContextRecursive: false,
},
'javascript/esm': {
wrappedContextRecursive: false,
},
},
},
},
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-api-docgen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
23 changes: 23 additions & 0 deletions packages/plugin-api-docgen/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'cjs',
syntax: 'es2020',
// dts: {
// bundle: true,
// distPath: 'dist-rslib',
// },
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-auto-nav-sidebar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
23 changes: 23 additions & 0 deletions packages/plugin-auto-nav-sidebar/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2020',
// dts: {
// bundle: true,
// distPath: 'dist-rslib',
// },
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-client-redirects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-client-redirects/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2020',
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-container-syntax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-container-syntax/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2020',
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-last-updated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-last-updated/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2020',
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-medium-zoom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/plugin-medium-zoom/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'esm',
syntax: 'es2020',
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib',
},
target: 'node',
},
},
],
});
1 change: 1 addition & 0 deletions packages/plugin-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"scripts": {
"dev": "modern build -w",
"build": "modern build",
"build:rslib": "rslib build",
"reset": "rimraf ./**/node_modules",
"test": "vitest run --passWithNoTests"
},
Expand Down
70 changes: 70 additions & 0 deletions packages/plugin-playground/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [
{
format: 'cjs',
syntax: 'es2020',
source: {
entry: { index: './src/cli/index.ts' },
},
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib/cli/cjs',
},
target: 'node',
},
},
{
format: 'esm',
syntax: 'es2020',
source: {
entry: { index: './src/cli/index.ts' },
},
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib/cli/esm',
},
target: 'node',
},
},
{
format: 'cjs',
syntax: 'es2020',
source: {
entry: { index: './src/web/index.ts' },
},
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib/web/cjs',
},
target: 'web',
},
},
{
format: 'esm',
syntax: 'es2020',
source: {
entry: { index: './src/web/index.ts' },
},
output: {
sourceMap: {
js: 'source-map',
},
distPath: {
root: 'dist-rslib/web/esm',
},
target: 'web',
},
},
],
});
Loading