Skip to content

Commit

Permalink
fix: build typo (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 authored Dec 26, 2023
1 parent 450cfcc commit 9605b21
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ The size of the bundles after the build.
- `build-prepare-time`: the time taken from when the plugins are loaded to when the build prep process is fully completed. Corresponding hooks: `loadPlugin -> prepare`.
- `build-cold-boot-time`: the time it takes for the build to complete without caching. Corresponding hooks: `beforeBuild -> afterBuild`.
- `build-hot-boot-time`: the time it takes to complete a build with caching. Corresponding hooks: `beforeBuild -> afterBuild`.
- `bulid-cjs-time`: the time it takes to complete a build task for cjs in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `bulid-esm-time`: the time it takes to complete a build task for esm in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `bulid-dts-time`: the time it takes to complete a build task for dts in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `build-cjs-time`: the time it takes to complete a build task for cjs in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `build-esm-time`: the time it takes to complete a build task for esm in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `build-dts-time`: the time it takes to complete a build task for dts in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`.
- `route-generate-time`: the time it takes to generate routes in rspress. Corresponding hooks: `beforeBuild -> routeGenerated`.
- `before-dev-time`: the time it takes for the dev command to initialize, in other words, cli cold boot time.
- `before-build-time`: the time it takes for the build command to initialize, in other words, cli cold boot time.
Expand Down
8 changes: 7 additions & 1 deletion scripts/src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function generateTable(
) {
const overThresholdTags: string[] = [];
const properties = Object.keys(base);
const limited = caseName.startsWith('module-') ? 10 : 5;

const maxPropertyLength = Math.max(...properties.map(p => p.length));

Expand All @@ -57,6 +56,13 @@ function generateTable(

properties.forEach(property => {
if (property === 'time') return;

const limited =
caseName.startsWith('module-') &&
property.toLowerCase().indexOf('build') > -1
? 15
: 5;

const percent =
((current[property] - base[property]) * 100) / base[property];
const formattedPercent =
Expand Down
10 changes: 5 additions & 5 deletions scripts/src/plugins/modernjs-module/measure-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const measurePlugin = () => ({

setup(api: any) {
let beforeBuildTime: number;
let beforeBulidCjsTime: number;
let beforeBuildCjsTime: number;
let beforeBuildEsmTime: number;
let beforeBuildDtsTime: number;

Expand All @@ -33,7 +33,7 @@ export const measurePlugin = () => ({
if (config.dts === false) {
if (config.format === 'cjs') {
// build cjs
beforeBulidCjsTime = performance.now();
beforeBuildCjsTime = performance.now();
} else if (config.format === 'esm') {
// build esm
beforeBuildEsmTime = performance.now();
Expand All @@ -48,14 +48,14 @@ export const measurePlugin = () => ({
if (options.config.dts === false) {
if (options.config.format === 'cjs') {
// build cjs
metrics.bulidCjsTime = performance.now() - beforeBulidCjsTime;
metrics.buildCjsTime = performance.now() - beforeBuildCjsTime;
} else if (options.config.format === 'esm') {
// build esm
metrics.bulidEsmTime = performance.now() - beforeBuildEsmTime;
metrics.buildEsmTime = performance.now() - beforeBuildEsmTime;
}
} else {
// build dts
metrics.bulidDtsTime = performance.now() - beforeBuildDtsTime;
metrics.buildDtsTime = performance.now() - beforeBuildDtsTime;
}
},

Expand Down
7 changes: 3 additions & 4 deletions scripts/src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ export type Metrics = {
buildColdBootTime?: number;
buildPluginSetupTime?: number;
buildPrepareTime?: number;
beforeBulidCjsTime?: number;
bulidCjsTime?: number;
bulidEsmTime?: number;
bulidDtsTime?: number;
buildCjsTime?: number;
buildEsmTime?: number;
buildDtsTime?: number;
routeGenerateTime?: number;

// Bundle size
Expand Down
6 changes: 3 additions & 3 deletions website/src/shared/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export const COMPILE_SPEED_METRICS = {
'buildColdBootTime',
'beforeBuildTime',
'buildPluginSetupTime',
'bulidCjsTime',
'bulidEsmTime',
'bulidDtsTime',
'buildCjsTime',
'buildEsmTime',
'buildDtsTime',
],
[PRODUCT.RSPRESS]: [
'buildColdBootTime',
Expand Down

0 comments on commit 9605b21

Please sign in to comment.