Skip to content

Commit 2004609

Browse files
create makefiles for the project
1 parent 24d04d0 commit 2004609

4 files changed

Lines changed: 517 additions & 3 deletions

File tree

‎nodejs/FlightRadar24/index.d.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ export class FlightTrackerConfig {
227227

228228
/**
229229
* Constructor of FlightTrackerConfig class.
230-
*
231-
* @param {object} [data] - Optional data to initialize the config
232230
*/
233-
constructor(data?: object);
231+
constructor(data: object);
234232
}
235233

236234
/**

‎nodejs/Makefile‎

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# Makefile for FlightRadarAPI npm package
2+
3+
# Variables
4+
PACKAGE_NAME = flightradarapi
5+
NODE_MODULES = node_modules
6+
DIST_DIR = dist
7+
COVERAGE_DIR = coverage
8+
9+
# Colors for output
10+
GREEN = \033[0;32m
11+
YELLOW = \033[0;33m
12+
RED = \033[0;31m
13+
NC = \033[0m # No Color
14+
15+
# Default target
16+
.PHONY: help
17+
help:
18+
@echo "$(GREEN)FlightRadarAPI npm package Makefile$(NC)"
19+
@echo ""
20+
@echo "Available targets:"
21+
@echo " $(YELLOW)install$(NC) - Install dependencies"
22+
@echo " $(YELLOW)test$(NC) - Run tests"
23+
@echo " $(YELLOW)lint$(NC) - Run linter"
24+
@echo " $(YELLOW)lint-fix$(NC) - Run linter and fix issues"
25+
@echo " $(YELLOW)clean$(NC) - Clean build artifacts"
26+
@echo " $(YELLOW)build$(NC) - Build the package"
27+
@echo " $(YELLOW)validate$(NC) - Validate package before publishing"
28+
@echo " $(YELLOW)publish$(NC) - Publish to npm registry"
29+
@echo " $(YELLOW)publish-dry$(NC) - Dry run publish (test without uploading)"
30+
@echo " $(YELLOW)version-patch$(NC) - Bump patch version"
31+
@echo " $(YELLOW)version-minor$(NC) - Bump minor version"
32+
@echo " $(YELLOW)version-major$(NC) - Bump major version"
33+
@echo " $(YELLOW)check-deps$(NC) - Check for outdated dependencies"
34+
@echo " $(YELLOW)update-deps$(NC) - Update dependencies"
35+
@echo " $(YELLOW)security$(NC) - Run security audit"
36+
@echo " $(YELLOW)all$(NC) - Run full build pipeline (install, lint, test, validate)"
37+
38+
# Install dependencies
39+
.PHONY: install
40+
install:
41+
@echo "$(GREEN)Installing dependencies...$(NC)"
42+
npm install
43+
@echo "$(GREEN)Dependencies installed successfully!$(NC)"
44+
45+
# Run tests
46+
.PHONY: test
47+
test:
48+
@echo "$(GREEN)Running tests...$(NC)"
49+
npm test
50+
@echo "$(GREEN)Tests completed!$(NC)"
51+
52+
# Run linter
53+
.PHONY: lint
54+
lint:
55+
@echo "$(GREEN)Running linter...$(NC)"
56+
npm run lint
57+
@echo "$(GREEN)Linting completed!$(NC)"
58+
59+
# Run linter with auto-fix
60+
.PHONY: lint-fix
61+
lint-fix:
62+
@echo "$(GREEN)Running linter with auto-fix...$(NC)"
63+
npx eslint . --fix
64+
@echo "$(GREEN)Linting and fixing completed!$(NC)"
65+
66+
# Clean build artifacts
67+
.PHONY: clean
68+
clean:
69+
@echo "$(GREEN)Cleaning build artifacts...$(NC)"
70+
rm -rf $(NODE_MODULES)
71+
rm -rf $(DIST_DIR)
72+
rm -rf $(COVERAGE_DIR)
73+
rm -f package-lock.json
74+
rm -f *.tgz
75+
@echo "$(GREEN)Cleanup completed!$(NC)"
76+
77+
# Build package (prepare for publishing)
78+
.PHONY: build
79+
build: install lint test
80+
@echo "$(GREEN)Building package...$(NC)"
81+
npm pack
82+
@echo "$(GREEN)Package built successfully!$(NC)"
83+
84+
# Validate package before publishing
85+
.PHONY: validate
86+
validate:
87+
@echo "$(GREEN)Validating package...$(NC)"
88+
npm pack --dry-run
89+
@echo "$(GREEN)Package validation completed!$(NC)"
90+
91+
# Publish to npm registry
92+
.PHONY: publish
93+
publish: validate
94+
@echo "$(YELLOW)Are you sure you want to publish to npm? [y/N]$(NC)" && read ans && [ $${ans:-N} = y ]
95+
@echo "$(GREEN)Publishing to npm...$(NC)"
96+
npm publish
97+
@echo "$(GREEN)Package published successfully!$(NC)"
98+
99+
# Dry run publish (test without uploading)
100+
.PHONY: publish-dry
101+
publish-dry:
102+
@echo "$(GREEN)Running publish dry run...$(NC)"
103+
npm publish --dry-run
104+
@echo "$(GREEN)Publish dry run completed!$(NC)"
105+
106+
# Version bumping
107+
.PHONY: version-patch
108+
version-patch:
109+
@echo "$(GREEN)Bumping patch version...$(NC)"
110+
npm version patch
111+
@echo "$(GREEN)Patch version bumped!$(NC)"
112+
113+
.PHONY: version-minor
114+
version-minor:
115+
@echo "$(GREEN)Bumping minor version...$(NC)"
116+
npm version minor
117+
@echo "$(GREEN)Minor version bumped!$(NC)"
118+
119+
.PHONY: version-major
120+
version-major:
121+
@echo "$(GREEN)Bumping major version...$(NC)"
122+
npm version major
123+
@echo "$(GREEN)Major version bumped!$(NC)"
124+
125+
# Check for outdated dependencies
126+
.PHONY: check-deps
127+
check-deps:
128+
@echo "$(GREEN)Checking for outdated dependencies...$(NC)"
129+
npm outdated
130+
131+
# Update dependencies
132+
.PHONY: update-deps
133+
update-deps:
134+
@echo "$(GREEN)Updating dependencies...$(NC)"
135+
npm update
136+
@echo "$(GREEN)Dependencies updated!$(NC)"
137+
138+
# Security audit
139+
.PHONY: security
140+
security:
141+
@echo "$(GREEN)Running security audit...$(NC)"
142+
npm audit
143+
@echo "$(GREEN)Security audit completed!$(NC)"
144+
145+
# Fix security vulnerabilities
146+
.PHONY: security-fix
147+
security-fix:
148+
@echo "$(GREEN)Fixing security vulnerabilities...$(NC)"
149+
npm audit fix
150+
@echo "$(GREEN)Security vulnerabilities fixed!$(NC)"
151+
152+
# Full build pipeline
153+
.PHONY: all
154+
all: install lint test validate
155+
@echo "$(GREEN)Full build pipeline completed successfully!$(NC)"
156+
157+
# Development workflow targets
158+
.PHONY: dev-setup
159+
dev-setup: install
160+
@echo "$(GREEN)Development environment setup completed!$(NC)"
161+
162+
.PHONY: pre-commit
163+
pre-commit: lint test
164+
@echo "$(GREEN)Pre-commit checks passed!$(NC)"
165+
166+
.PHONY: pre-publish
167+
pre-publish: all security
168+
@echo "$(GREEN)Pre-publish checks completed!$(NC)"
169+
170+
# CI/CD targets
171+
.PHONY: ci
172+
ci: install lint test validate
173+
@echo "$(GREEN)CI pipeline completed!$(NC)"
174+
175+
# Show package info
176+
.PHONY: info
177+
info:
178+
@echo "$(GREEN)Package Information:$(NC)"
179+
@npm list --depth=0
180+
@echo ""
181+
@echo "$(GREEN)Package Size:$(NC)"
182+
@npm pack --dry-run | grep "npm notice package size"
183+
184+
# Login to npm (for CI/CD)
185+
.PHONY: npm-login
186+
npm-login:
187+
@echo "$(GREEN)Logging in to npm...$(NC)"
188+
npm login
189+
190+
# Logout from npm
191+
.PHONY: npm-logout
192+
npm-logout:
193+
@echo "$(GREEN)Logging out from npm...$(NC)"
194+
npm logout
195+
196+
# Quick release workflow
197+
.PHONY: release-patch
198+
release-patch: pre-publish version-patch publish
199+
@echo "$(GREEN)Patch release completed!$(NC)"
200+
201+
.PHONY: release-minor
202+
release-minor: pre-publish version-minor publish
203+
@echo "$(GREEN)Minor release completed!$(NC)"
204+
205+
.PHONY: release-major
206+
release-major: pre-publish version-major publish
207+
@echo "$(GREEN)Major release completed!$(NC)"

0 commit comments

Comments
 (0)