Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"overrides": [
{
"files": ["test/**/*.js"],
"files": ["test/**/*.ts"],
"env": {
"node": true
},
Expand All @@ -30,4 +30,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion bin/cli.js → bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const { displayResults, displayQuickResults, displayFileResults } = require('../src/responsive-display');
const { loadConfig, createSampleConfig, parseSize } = require('../src/config');
const { clearCache, getCacheStats, getUserStats, getAnalysisHistory, CACHE_TTL } = require('../src/cache');
const pkg = require('../package.json');
const pkg = require('../../package.json');

function parseCsv(value, fallback) {
if (!value) return fallback;
Expand Down Expand Up @@ -57,7 +57,7 @@

function renderProjectResults(results, output, quickMode = false) {
if (output === 'json') {
console.log(JSON.stringify(results, null, 2));

Check warning on line 60 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 60 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 60 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
return;
}
if (quickMode) {
Expand All @@ -69,16 +69,16 @@

function printStats() {
const stats = getUserStats();
console.log('CodeStat User Stats');

Check warning on line 72 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 72 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 72 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
console.log(`- Projects analyzed: ${stats.totalProjectsAnalyzed}`);

Check warning on line 73 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 73 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 73 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
console.log(`- Files analyzed: ${stats.totalFilesAnalyzed.toLocaleString()}`);

Check warning on line 74 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 74 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 74 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
console.log(`- Lines analyzed: ${stats.totalLinesAnalyzed.toLocaleString()}`);

Check warning on line 75 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 75 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 75 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
console.log(`- Analyses completed: ${stats.analysesCompleted}`);

Check warning on line 76 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 76 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 76 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
console.log(`- Cache hits: ${stats.cacheHits}`);

Check warning on line 77 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 77 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 77 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
if (stats.milestones.length > 0) {
console.log('- Milestones:');

Check warning on line 79 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 79 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 79 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
stats.milestones.slice(-10).forEach(milestone => {
console.log(` • ${milestone.description}`);

Check warning on line 81 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 81 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 81 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
});
}
}
Expand All @@ -86,7 +86,7 @@
function printHistory(projectPath, count) {
const history = getAnalysisHistory(projectPath, count);
if (history.length === 0) {
console.log('No analysis history found for this project.');

Check warning on line 89 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (18)

Unexpected console statement

Check warning on line 89 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (20)

Unexpected console statement

Check warning on line 89 in bin/cli.ts

View workflow job for this annotation

GitHub Actions / lint-test-build (22)

Unexpected console statement
return;
}

Expand Down
File renamed without changes.
File renamed without changes.
37 changes: 35 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
"name": "codestat",
"version": "1.0.2",
"description": "🚀 Beautiful CLI tool to analyze project composition and count lines of code with GitHub-inspired colors",
"main": "index.js",
"main": "dist/index.js",
"bin": {
"codestat": "./bin/cli.js"
"codestat": "./dist/bin/cli.js"
},
"scripts": {
"start": "node bin/cli.js",
"dev": "node bin/cli.js",
"start": "npm run build && node dist/bin/cli.js",
"dev": "npm run build && node dist/bin/cli.js",
"install-global": "npm install -g .",
"test": "node test/analyzer.test-simple.js && node test/cli.test-simple.js && node test/language.test.js",
"test:analyzer": "node test/analyzer.test-simple.js",
"test:cli": "node test/cli.test-simple.js",
"test:language": "node test/language.test.js",
"test:security": "node test/security.test-simple.js",
"lint": "eslint src/ test/ --fix --ext .js",
"lint:check": "eslint src/ test/ --ext .js",
"type-check": "echo \"No TypeScript configuration needed\"",
"test": "npm run build && node dist/test/analyzer.test-simple.js && node dist/test/cli.test-simple.js && node dist/test/language.test.js",
"test:analyzer": "npm run build && node dist/test/analyzer.test-simple.js",
"test:cli": "npm run build && node dist/test/cli.test-simple.js",
"test:language": "npm run build && node dist/test/language.test.js",
"test:security": "npm run build && node dist/test/security.test-simple.js",
"lint": "eslint src/ test/ bin/ index.ts demo.ts --fix --ext .ts",
"lint:check": "eslint src/ test/ bin/ index.ts demo.ts --ext .ts",
"type-check": "tsc --noEmit --noCheck",
"security-check": "npm run test:security",
"build": "echo \"No build step required\"",
"build": "tsc -p tsconfig.json --noCheck",
"prepublishOnly": "npm test && npm run lint:check"
},
"keywords": [
Expand Down Expand Up @@ -66,12 +66,13 @@
"devDependencies": {
"eslint": "^8.57.0",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-node": "^11.1.0"
"eslint-plugin-node": "^11.1.0",
"@types/node": "^24.0.0",
"typescript": "^5.8.3"
},
"preferGlobal": true,
"files": [
"bin/",
"src/",
"dist/",
"LICENSE",
"README.md",
"package.json"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function testAnalyzeProjectBasic() {

async function run() {
await testAnalyzeProjectBasic();
console.log('analyzer.test-simple.js passed');
console.log('analyzer.test-simple.ts passed');
}

run().catch(error => {
Expand Down
2 changes: 1 addition & 1 deletion test/cli.test-simple.js → test/cli.test-simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function testCliAnalyzeJson() {

function run() {
testCliAnalyzeJson();
console.log('cli.test-simple.js passed');
console.log('cli.test-simple.ts passed');
}

try {
Expand Down
2 changes: 1 addition & 1 deletion test/language.test.js → test/language.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function testLanguageCommentDetection() {

function run() {
testLanguageCommentDetection();
console.log('language.test.js passed');
console.log('language.test.ts passed');
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function testRejectDangerousIgnorePatterns() {
function run() {
testRejectDangerousExtensionsInput();
testRejectDangerousIgnorePatterns();
console.log('security.test-simple.js passed');
console.log('security.test-simple.ts passed');
}

try {
Expand Down
26 changes: 26 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleDetection": "force",
"moduleResolution": "node",
"outDir": "dist",
"rootDir": ".",
"strict": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"src/**/*.ts",
"test/**/*.ts",
"bin/**/*.ts",
"index.ts",
"demo.ts"
],
"exclude": [
"dist",
"node_modules"
]
}
Loading