Skip to content

Migrate CodeStat from JavaScript sources to TypeScript compilation output#5

Merged
AperturePlus merged 3 commits into
mainfrom
copilot/replace-js-with-ts
Apr 20, 2026
Merged

Migrate CodeStat from JavaScript sources to TypeScript compilation output#5
AperturePlus merged 3 commits into
mainfrom
copilot/replace-js-with-ts

Conversation

Copilot AI commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

This PR addresses “用 ts 替代 js” by moving the project from .js source files to .ts source files while preserving current runtime behavior. The package now runs from compiled dist/ output instead of direct source execution.

  • Source migration

    • Renamed runtime, CLI, entry, demo, and test files from .js to .ts across src/, bin/, test/, and repository root.
    • Kept existing CommonJS module shape (require / module.exports) to minimize behavioral drift during migration.
  • TypeScript build integration

    • Added tsconfig.json with CommonJS output targeting dist/.
    • Enabled JSON import support and module detection suitable for current file style.
    • Compiles all migrated code paths (src, bin, test, root entry files).
  • Package/runtime wiring

    • Updated package.json main and bin to point to compiled artifacts:
      • main: dist/index.js
      • bin: dist/bin/cli.js
    • Updated scripts to execute compiled files under dist/ and lint .ts sources.
    • Updated publish file list to ship dist/ output.
  • CLI packaging path fix

    • Adjusted CLI package metadata import path to resolve correctly after compilation layout (dist/bin).
  • Minor consistency updates

    • Updated test pass log labels to reflect .ts filenames.
{
  "main": "dist/index.js",
  "bin": { "codestat": "./dist/bin/cli.js" },
  "scripts": {
    "build": "tsc -p tsconfig.json --noCheck",
    "test": "npm run build && node dist/test/analyzer.test-simple.js && node dist/test/cli.test-simple.js && node dist/test/language.test.js"
  }
}

Copilot AI and others added 3 commits April 20, 2026 14:57
Agent-Logs-Url: https://github.com/Hybriant/codestat/sessions/321eaebd-e317-45cb-9224-7c8407a84952

Co-authored-by: AperturePlus <146049978+AperturePlus@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hybriant/codestat/sessions/321eaebd-e317-45cb-9224-7c8407a84952

Co-authored-by: AperturePlus <146049978+AperturePlus@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hybriant/codestat/sessions/321eaebd-e317-45cb-9224-7c8407a84952

Co-authored-by: AperturePlus <146049978+AperturePlus@users.noreply.github.com>
@AperturePlus AperturePlus marked this pull request as ready for review April 20, 2026 15:12
@AperturePlus AperturePlus merged commit ee5e18a into main Apr 20, 2026
3 checks passed
@AperturePlus AperturePlus deleted the copilot/replace-js-with-ts branch April 20, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants