{"id":16302942,"url":"https://github.com/himenon/performance-report","last_synced_at":"2025-04-10T05:58:21.586Z","repository":{"id":55652047,"uuid":"312471649","full_name":"Himenon/performance-report","owner":"Himenon","description":"continuous performance report in integration.","archived":false,"fork":false,"pushed_at":"2020-12-15T07:28:57.000Z","size":500,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T19:34:42.363Z","etag":null,"topics":["continuous-integration","performance"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@himenon/performance-report","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Himenon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-13T04:19:16.000Z","updated_at":"2021-04-23T01:28:41.000Z","dependencies_parsed_at":"2022-08-15T05:31:38.959Z","dependency_job_id":null,"html_url":"https://github.com/Himenon/performance-report","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":"Himenon/template-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Fperformance-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Fperformance-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Fperformance-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Himenon%2Fperformance-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Himenon","download_url":"https://codeload.github.com/Himenon/performance-report/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166946,"owners_count":21058480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-integration","performance"],"created_at":"2024-10-10T20:59:19.276Z","updated_at":"2025-04-10T05:58:21.564Z","avatar_url":"https://github.com/Himenon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @himenon/performance-report\n\nMeasure the difference in performance.\nIn addition, Git Repository is used as the save destination of the measurement result.\nThe currently measurable performance indicators are:\n\n- [x] File size\n- [x] Execution time\n\n![Sample](./docs/himenon-perfomance-report-sample.png)\n\n## Usage\n\n[GitHub Action Sample Code](https://github.com/Himenon/performance-report/blob/main/scripts/tools/check-perf.ts)\n\n```ts\nimport { EOL } from \"os\";\nimport * as path from \"path\";\nimport * as PerformanceReport from \"../../lib\";\nimport * as GitHubActions from \"./actions\";\nimport * as Exectime from \"./exectime\";\nimport * as Config from \"./config\";\nimport { setEnv, getEnv } from \"./env\";\nconst pkg = require(\"../../package.json\");\n\nconst generateHideComment = (value: string): string =\u003e `\u003c!-- ${value} --\u003e`;\n\nexport interface Option {\n  isPullRequest: boolean;\n  isLocal: boolean;\n}\n\nexport const createPerformanceReport = async ({ isPullRequest, isLocal }: Option): Promise\u003cvoid\u003e =\u003e {\n  if (!isLocal) {\n    setEnv({ isPullRequest });\n  }\n  const { baseRef, datalakeGitHubToken } = getEnv();\n  const taskId = isPullRequest ? Config.taskId.pr : Config.taskId.merge;\n  const gitHubActions = GitHubActions.create();\n  const meta = gitHubActions.generateMeta();\n\n  const option: PerformanceReport.Option = {\n    snapshot: {\n      minimize: true,\n    },\n    filesize: {\n      applicationRoot: Config.applicationRoot,\n    },\n    exectime: {\n      averageList: [2, \"all\"],\n    },\n  };\n\n  const query: PerformanceReport.Filesize.Repository.Query = {\n    git: {\n      base: {\n        ref: baseRef,\n      },\n    },\n  };\n\n  const filesize: PerformanceReport.Filesize.InitialParams = {\n    snapshot: {\n      filename: path.join(Config.workingDirectory, pkg.name, Config.snapshot.filesize),\n      query,\n    },\n    meta,\n    groups: [\n      {\n        name: `${pkg.name}-seed`,\n        version: `${pkg.version}`,\n        items: {\n          \"package.json\": {\n            absolutePath: path.join(Config.applicationRoot, \"package.json\"),\n          },\n        },\n      },\n      {\n        name: `${pkg.name}-cjs`,\n        version: `${pkg.version}`,\n        items: {\n          \"$cjs/index.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$cjs/index.js\"),\n          },\n          \"$cjs/exectime.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$cjs/exectime.js\"),\n          },\n          \"$cjs/filesize.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$cjs/filesize.js\"),\n          },\n        },\n      },\n      {\n        name: `${pkg.name}-esm`,\n        version: `${pkg.version}`,\n        items: {\n          \"$esm/index.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$esm/index.js\"),\n          },\n          \"$esm/exectime.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$esm/exectime.js\"),\n          },\n          \"$esm/filesize.js\": {\n            absolutePath: path.join(Config.applicationRoot, \"lib/$esm/filesize.js\"),\n          },\n        },\n      },\n    ],\n  };\n\n  const exectime: PerformanceReport.Exectime.InitialParams = {\n    snapshot: {\n      filename: path.join(Config.workingDirectory, pkg.name, Config.snapshot.exectime),\n      query,\n    },\n    meta,\n    groups: [\n      {\n        name: pkg.name,\n        description: \"self repository performance report.\",\n        measurement: Exectime.generateExectimeMeasure(),\n      },\n    ],\n  };\n\n  const config: PerformanceReport.Config = {\n    reporter: {\n      filesize,\n      exectime,\n    },\n    git: Config.gitConfig(datalakeGitHubToken),\n    applicationRoot: Config.applicationRoot,\n    workingDirectory: Config.workingDirectory,\n  };\n\n  const report = await PerformanceReport.generate(config, option);\n\n  if (isPullRequest) {\n    const text = [report.markdown.exectime, report.markdown.filesize, generateHideComment(taskId)].join(EOL + EOL);\n    await gitHubActions.createOrUpdateComment(text, taskId);\n  }\n\n  if (!isPullRequest \u0026\u0026 !isLocal) {\n    await report.sync();\n  }\n\n  if (!isLocal) {\n    report.clearWorkingDirectory();\n  }\n};\n```\n\n## Development\n\n| scripts                   | description                                 |\n| :------------------------ | :------------------------------------------ |\n| `build`                   | typescript build and create proxy directory |\n| `clean`                   | clean up                                    |\n| `format:code`             | prettier                                    |\n| `format:yarn:lock`        | yarn.lock deduplicate                       |\n| `lerna:version:up`        | lerna version up                            |\n| `test`                    | execute test:depcruise, test:jest           |\n| `test:depcruise`          | dependency-cruiser's test                   |\n| `test:jest`               | jest test                                   |\n| `ts`                      | execute ts-node                             |\n| `release:github:registry` | publish github registry                     |\n| `release:npm:registry`    | publish npm registry                        |\n\n## Features\n\n- [Proxy Directory](https://himenon.github.io/docs/javascript/proxy-directory-design-pattern/)\n\n## Release\n\n- Automatic version updates are performed when merged into the `main` branch.\n\n## LICENCE\n\n[@@himenon/performance-report](https://github.com/Himenon/performance-report)・MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimenon%2Fperformance-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhimenon%2Fperformance-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimenon%2Fperformance-report/lists"}