Skip to content

Commit 4498092

Browse files
committed
Add justfile and format code
- Add comprehensive justfile with setup_local_dev and run_tests recipes - Include additional recipes for testing, linting, building, and CI - Format code with Prettier (line length adjustments in inputs.ts) - Rebuild dist with formatted code
1 parent eaf69c2 commit 4498092

5 files changed

Lines changed: 132 additions & 6 deletions

File tree

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34995,7 +34995,9 @@ const core = __importStar(__nccwpck_require__(7484));
3499534995
* Get and validate action inputs
3499634996
*/
3499734997
function getInputs() {
34998-
const apiUrl = core.getInput('api_url', { required: false }) || process.env.VERSIONER_API_URL || 'https://api.versioner.io';
34998+
const apiUrl = core.getInput('api_url', { required: false }) ||
34999+
process.env.VERSIONER_API_URL ||
35000+
'https://api.versioner.io';
3499935001
const apiKey = core.getInput('api_key', { required: false }) || process.env.VERSIONER_API_KEY || '';
3500035002
const productName = core.getInput('product_name', { required: false }) || '';
3500135003
const version = core.getInput('version', { required: true });

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/inputs.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

justfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# List available commands
2+
default:
3+
just --list
4+
5+
# ====================================
6+
# === Local Development Setup ===
7+
# ====================================
8+
9+
setup_local_dev:
10+
# Check Node.js version
11+
@echo "Checking Node.js version..."
12+
@node --version || echo "⚠️ Node.js not found. Please install Node.js 18 or later"
13+
14+
# Install dependencies
15+
@echo "Installing npm dependencies..."
16+
npm install
17+
18+
@echo ""
19+
@echo "✅ Local development setup complete!"
20+
@echo ""
21+
@echo "📝 Next steps:"
22+
@echo " 1. Run 'just run_tests' to verify everything works"
23+
@echo " 2. Run 'just build' to build the action"
24+
25+
# ====================================
26+
# === Testing ===
27+
# ====================================
28+
29+
# Run all tests
30+
run_tests:
31+
@echo "Running tests..."
32+
npm test
33+
34+
# Run tests in watch mode
35+
test_watch:
36+
@echo "Running tests in watch mode..."
37+
npm test -- --watch
38+
39+
# Run tests with coverage
40+
test_coverage:
41+
@echo "Running tests with coverage..."
42+
npm test -- --coverage
43+
44+
# ====================================
45+
# === Code Quality ===
46+
# ====================================
47+
48+
# Lint code
49+
lint:
50+
@echo "Running ESLint..."
51+
npm run lint
52+
53+
# Format code
54+
format:
55+
@echo "Formatting code with Prettier..."
56+
npm run format
57+
58+
# Run all checks (lint + test + build)
59+
check:
60+
@echo "Running all checks..."
61+
npm run all
62+
63+
# ====================================
64+
# === Build ===
65+
# ====================================
66+
67+
# Build the action
68+
build:
69+
@echo "Building GitHub Action..."
70+
npm run build
71+
72+
# Clean build artifacts
73+
clean:
74+
@echo "Cleaning build artifacts..."
75+
rm -rf dist
76+
@echo "✅ Clean complete"
77+
78+
# Clean everything including node_modules
79+
clean_all:
80+
@echo "Cleaning everything..."
81+
rm -rf dist
82+
rm -rf node_modules
83+
@echo "✅ Deep clean complete. Run 'npm install' to reinstall dependencies"
84+
85+
# ====================================
86+
# === Dependencies ===
87+
# ====================================
88+
89+
# Update dependencies
90+
update_deps:
91+
@echo "Updating dependencies..."
92+
npm update
93+
@echo "✅ Dependencies updated"
94+
95+
# Install a new dependency
96+
add_dep package:
97+
@echo "Installing {{package}}..."
98+
npm install {{package}}
99+
100+
# Install a new dev dependency
101+
add_dev_dep package:
102+
@echo "Installing {{package}} as dev dependency..."
103+
npm install --save-dev {{package}}
104+
105+
# ====================================
106+
# === Git Helpers ===
107+
# ====================================
108+
109+
# Run full CI pipeline locally (format, lint, build, test)
110+
ci:
111+
@echo "Running full CI pipeline..."
112+
just format
113+
just lint
114+
just build
115+
just run_tests
116+
@echo ""
117+
@echo "✅ CI pipeline complete!"
118+
@echo "📝 Ready to commit and push"

src/inputs.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import { ActionInputs } from './types'
55
* Get and validate action inputs
66
*/
77
export function getInputs(): ActionInputs {
8-
const apiUrl = core.getInput('api_url', { required: false }) || process.env.VERSIONER_API_URL || 'https://api.versioner.io'
9-
const apiKey = core.getInput('api_key', { required: false }) || process.env.VERSIONER_API_KEY || ''
8+
const apiUrl =
9+
core.getInput('api_url', { required: false }) ||
10+
process.env.VERSIONER_API_URL ||
11+
'https://api.versioner.io'
12+
const apiKey =
13+
core.getInput('api_key', { required: false }) || process.env.VERSIONER_API_KEY || ''
1014
const productName = core.getInput('product_name', { required: false }) || ''
1115
const version = core.getInput('version', { required: true })
1216
const environment = core.getInput('environment', { required: false }) || ''
@@ -17,7 +21,9 @@ export function getInputs(): ActionInputs {
1721

1822
// Validate API key is provided
1923
if (!apiKey) {
20-
throw new Error(`api_key is required (provide via input or VERSIONER_API_KEY environment variable)`)
24+
throw new Error(
25+
`api_key is required (provide via input or VERSIONER_API_KEY environment variable)`
26+
)
2127
}
2228

2329
// Validate API URL format

0 commit comments

Comments
 (0)