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
116 changes: 116 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Tests & Linting

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint-js:
name: 🧼 ESLint (JS/TS)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Node.js dependencies
run: npm install

- name: Run ESLint
run: npm run lint:js

lint-py:
name: 🐍 Ruff (Python)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Ruff check
run: npm run lint:py

parser-tests:
name: 🧪 Parser Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r parser/requirements.txt
pip install pytest ruff

- name: Run parser tests
run: npm run test:parser

webview-tests:
name: 🎨 Webview Visual Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Node.js dependencies
run: npm install

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Run webview tests (headless)
run: xvfb-run -a npm run test:webview

extension-tests:
name: 🧩 Extension Tests (VS Code)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Node.js dependencies
run: npm install

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r parser/requirements.txt

- name: Run extension tests
run: xvfb-run -a npm run test:src
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Thumbs.db
**/node_modules/
**/out/
*/.vs/
**/.venv/
**/.vscode-test/
tsconfig.lsif.json
*.lsif
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

---

## [0.1.8] - 2025-08-08

### Added
- `npm run` scripts for testing & linting
- `ruff` and `eslint` for linting
- GitHub Actions for testing & linting
- Detailed `CONTRIBUTING.md`

## [0.1.7] - 2025-08-04

### Added
Expand Down
126 changes: 126 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 🤝 Contributing to LaunchMap

Thank you for your interest in contributing to LaunchMap!
Contributions of all kinds, features, bug fixes, tests, docs, and feedback are welcome!

---

## 🛠️ Project Structure
```txt
launchmap/
├── parser/ # Python-based static launch file parser
├── src/ # VS Code extension (TypeScript)
├── webview/ # Webview frontend (HTML/JS)
```

---

## ⚙️ Setup Instructions

### Installation

```bash
# Clone the repo
git clone https://github.com/Kodo-Robotics/launchmap
cd launchmap

# Python setup
python3 -m venv .venv
source .venv/bin/activate
pip install -r parser/requirements.txt

# Node setup
npm install
```

### Running

Here is how you can get the extension running and see the output:

1. Compile the code
```bash
npm run compile
```
This converts the TypeScript code into JavaScript so VS Code can run it.

2. Start the extension in a debug VS Code window
- Open the file `src/extension.ts`.
- Press F5 (or go to Run and Debug → Launch Extension).

This launches a new VS Code window with the extension loaded in "dev mode" so you can test your changes live.

3. Open a sample launch file
- In the new debug VS Code window, navigate to:
`parser/tests/real_cases/launch_files/`
- Open any `.launch.py` file (these are real world test cases).

4. Run the LaunchMap visualizer
- Press `Cmd + Shift + P` (or `Ctrl + Shift + P` on Windows/Linux).
- Search for `LaunchMap: Open Launch Visualizer` and run it.

You should now see the visualization output.

---

## 🧹 Linting & Code Style

We use:
- `ruff` for Python (ultra-fast linter + formatter)
- `eslint` for TypeScript/JavaScript

### 🔍 Run Python Lint (parser)

```bash
# Test
npm run lint:py

# Fix
npm run lint:py:fix
```

### 🔍 Run JS/TS Lint (extension + webview)

```bash
# Test
npm run lint:js

# Fix
npm run lint:js:fix
```

---

## 🧪 Running Tests

```bash
# Parser Tests
npm run test:parser

# Webview Visual Tests
npm run test:webview

# Extension Integration Tests
npm run test:src
```

### ⚠️ Notes on Snapshot Testing
- Visual snapshots are stored under `webview/tests/__screenshots__/`
- Snapshots may differ between macOS, Windows, and Linux
- Snapshots are only validated on PRs in CI (Linux)
- If you are on macOS/Windows, avoid committing updated snapshots unless necessary

---

## 💡 Tips
- Prefer small, focused PRs
- Follow lint rules strictly (ruff and eslint)
- Playwright tests are validated automatically on PRs
- Use `npx playwright test --update-snapshots` only on Linux for visual diffs

---

## 📬 Questions?
- Join our [Discord Server](https://discord.gg/EK3pHZxrKy)
- Ask on GitHub

Thanks again for contributing! 🚀
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![VSCode Marketplace](https://img.shields.io/visual-studio-marketplace/v/KodoRobotics.launchmap?label=VSCode%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=KodoRobotics.launchmap)
[![License](https://img.shields.io/github/license/Kodo-Robotics/launchmap?color=blue)](./LICENSE)
[![Join Discord](https://img.shields.io/badge/Discord-Join%20Community-5865F2?logo=discord&logoColor=white)](https://discord.gg/EK3pHZxrKy)
[![Test Status](https://github.com/Kodo-Robotics/launchmap/actions/workflows/tests.yml/badge.svg)](https://github.com/Kodo-Robotics/launchmap/actions/workflows/tests.yml)

**LaunchMap** is a Visual Studio Code extension that lets you visualize the structure of ROS 2 launch files as interactive graphs directly inside VSCode.

Expand Down Expand Up @@ -177,7 +178,7 @@ New to the ROS 2 ecosystem? Here are some great resources to get you started:
## 🤝 Contributing

Contributions are welcome!
Please open an issue, suggest a feature, or submit a pull request.
Refer to [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

---

Expand Down
32 changes: 32 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import { defineConfig } from 'eslint/config';

export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
},
rules: {
indent: ['error', 2],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'comma-spacing': ['error', { before: false, after: true }],
'keyword-spacing': ['error', { before: true, after: true }],
'space-before-blocks': ['error', 'always'],
'space-in-parens': ['error', 'never'],
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'no-trailing-spaces': 'error',
'eol-last': ['error', 'always'],
}
},
tseslint.configs.recommended
]);
Loading