From 07881a4ff4742287e62e1ab31f336d83985aed1c Mon Sep 17 00:00:00 2001 From: SoonIter Date: Mon, 21 Oct 2024 17:57:19 +0800 Subject: [PATCH 1/3] chore(infra/bench): remove getCwdByExample stack in bench --- tests/benchmark/index.bench.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/benchmark/index.bench.ts b/tests/benchmark/index.bench.ts index 5956646db..4f2c10120 100644 --- a/tests/benchmark/index.bench.ts +++ b/tests/benchmark/index.bench.ts @@ -21,11 +21,20 @@ const onlyEnableMF = (rslibConfig: RslibConfig) => { const iterations = process.env.CI ? 10 : 50; -describe('benchmark Rslib in examples', () => { +const exampleCwds = { + 'express-plugin': getCwdByExample('express-plugin'), + 'react-component-bundle': getCwdByExample('react-component-bundle'), + 'react-component-bundle-false': getCwdByExample('react-component-bundle-false'), + 'react-component-umd': getCwdByExample('react-component-bundle-false'), + 'module-federation/mf-react-component': getCwdByExample('module-federation/mf-react-component'), +}; + +describe('benchmark Rslib in examples', async () => { + bench( 'examples/express-plugin', async () => { - const cwd = getCwdByExample('express-plugin'); + const cwd = exampleCwds['express-plugin']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -33,7 +42,7 @@ describe('benchmark Rslib in examples', () => { bench( 'examples/react-component-bundle', async () => { - const cwd = getCwdByExample('react-component-bundle'); + const cwd = exampleCwds['react-component-bundle']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -41,7 +50,7 @@ describe('benchmark Rslib in examples', () => { bench( 'examples/react-component-bundle-false', async () => { - const cwd = getCwdByExample('react-component-bundle-false'); + const cwd = exampleCwds['react-component-bundle-false']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -49,7 +58,7 @@ describe('benchmark Rslib in examples', () => { bench( 'examples/react-component-umd', async () => { - const cwd = getCwdByExample('react-component-bundle-false'); + const cwd = exampleCwds['react-component-bundle-false']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -57,7 +66,7 @@ describe('benchmark Rslib in examples', () => { bench( 'examples/module-federation/mf-react-component', async () => { - const cwd = getCwdByExample('module-federation/mf-react-component'); + const cwd = exampleCwds['module-federation/mf-react-component']; await rslibBuild({ cwd, modifyConfig: onlyEnableMF }); }, { iterations }, From 4d13f0a989c3c5bc3d290929a7da21e1aeb8c38c Mon Sep 17 00:00:00 2001 From: SoonIter Date: Mon, 21 Oct 2024 17:58:57 +0800 Subject: [PATCH 2/3] chore: lint --- tests/benchmark/index.bench.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/benchmark/index.bench.ts b/tests/benchmark/index.bench.ts index 4f2c10120..8b2193f82 100644 --- a/tests/benchmark/index.bench.ts +++ b/tests/benchmark/index.bench.ts @@ -24,13 +24,16 @@ const iterations = process.env.CI ? 10 : 50; const exampleCwds = { 'express-plugin': getCwdByExample('express-plugin'), 'react-component-bundle': getCwdByExample('react-component-bundle'), - 'react-component-bundle-false': getCwdByExample('react-component-bundle-false'), + 'react-component-bundle-false': getCwdByExample( + 'react-component-bundle-false', + ), 'react-component-umd': getCwdByExample('react-component-bundle-false'), - 'module-federation/mf-react-component': getCwdByExample('module-federation/mf-react-component'), + 'module-federation/mf-react-component': getCwdByExample( + 'module-federation/mf-react-component', + ), }; describe('benchmark Rslib in examples', async () => { - bench( 'examples/express-plugin', async () => { From 927d751e915c3526c7d2ec1e3a6b725f9dc27042 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Mon, 21 Oct 2024 18:02:55 +0800 Subject: [PATCH 3/3] chore: lint --- tests/benchmark/index.bench.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/benchmark/index.bench.ts b/tests/benchmark/index.bench.ts index 8b2193f82..3b6d1a807 100644 --- a/tests/benchmark/index.bench.ts +++ b/tests/benchmark/index.bench.ts @@ -21,7 +21,7 @@ const onlyEnableMF = (rslibConfig: RslibConfig) => { const iterations = process.env.CI ? 10 : 50; -const exampleCwds = { +const exampleCwd = { 'express-plugin': getCwdByExample('express-plugin'), 'react-component-bundle': getCwdByExample('react-component-bundle'), 'react-component-bundle-false': getCwdByExample( @@ -37,7 +37,7 @@ describe('benchmark Rslib in examples', async () => { bench( 'examples/express-plugin', async () => { - const cwd = exampleCwds['express-plugin']; + const cwd = exampleCwd['express-plugin']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -45,7 +45,7 @@ describe('benchmark Rslib in examples', async () => { bench( 'examples/react-component-bundle', async () => { - const cwd = exampleCwds['react-component-bundle']; + const cwd = exampleCwd['react-component-bundle']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -53,7 +53,7 @@ describe('benchmark Rslib in examples', async () => { bench( 'examples/react-component-bundle-false', async () => { - const cwd = exampleCwds['react-component-bundle-false']; + const cwd = exampleCwd['react-component-bundle-false']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -61,7 +61,7 @@ describe('benchmark Rslib in examples', async () => { bench( 'examples/react-component-umd', async () => { - const cwd = exampleCwds['react-component-bundle-false']; + const cwd = exampleCwd['react-component-bundle-false']; await rslibBuild({ cwd, modifyConfig: disableDts }); }, { iterations }, @@ -69,7 +69,7 @@ describe('benchmark Rslib in examples', async () => { bench( 'examples/module-federation/mf-react-component', async () => { - const cwd = exampleCwds['module-federation/mf-react-component']; + const cwd = exampleCwd['module-federation/mf-react-component']; await rslibBuild({ cwd, modifyConfig: onlyEnableMF }); }, { iterations },