---
---
Pushing code shouldn’t feel risky.
Yet most developers still ship changes manually—running a few checks, skipping others, and hoping CI catches the rest. That’s how broken builds, failed tests, and messy commit histories sneak in.
**Ship It** fixes that.
It’s a simple, automated workflow that runs essential code quality checks *before* committing and pushing. One command. One path. No guesswork.
---
## What Is Ship It?
**Ship It** is an automated pre-push workflow for JavaScript and TypeScript projects that enforces best practices before your code leaves your machine.
When you trigger it, Ship It:
* Runs linting, type checks, builds, and tests
* Pulls the latest changes with rebase
* Stages, commits, and pushes your code safely
* Stops immediately if something is wrong
Think of it as a guardrail for clean, confident commits in your JavaScript/TypeScript automation journey.
For a deeper dive into JavaScript automation tools, explore this [overview of popular tools](https://developer.mozilla.org/en-US/docs/Web/JavaScript).
---
## How the Ship It Workflow Works
```
┌──────────────┐
│ ship it │
└──────┬───────┘
↓
┌──────────────┐
│ Lint (+fix) │
└──────┬───────┘
↓
┌──────────────┐
│ Type Check │
│ (tsc) │
└──────┬───────┘
↓
┌──────────────┐
│ Build │
│ (npm run) │
└──────┬───────┘
↓
┌──────────────┐
│ Tests │
│ (if exist) │
└──────┬───────┘
↓
┌──────────────┐
│ Git Pull │
│ --rebase │
└──────┬───────┘
↓
┌──────────────┐
│ Stage Files │
│ git add -A │
└──────┬───────┘
↓
┌──────────────┐
│ Commit │
│ (conventional│
│ message) │
└──────┬───────┘
↓
┌──────────────┐
│ Push │
│ origin HEAD │
└──────────────┘
```
If *any* step fails, the process stops. No broken code gets pushed.
To learn more about version control best practices, visit our [version control guide](https://example.com/version-control-guide).
---
## What Ship It Does (In Detail)
### 1. Linting
Runs:
* `npm run lint`
* If available, `npm run lint:fix` first
Lint errors must be fixed. Warnings are allowed.
For more on linting strategies, see [our linting tips](https://example.com/linting-tips).
---
### 2. TypeScript Validation
Runs:
* `npx tsc --noEmit`
Type errors stop everything—exactly as they should.
Explore more about TypeScript on the [official TypeScript website](https://www.typescriptlang.org/).
---
### 3. Build Verification
Runs:
* `npm run build`
If the project doesn’t build locally, it shouldn’t hit CI. This ensures your code quality remains intact.
Check out our [guide to build processes](https://example.com/build-process-guide) for more insights.
---
### 4. Testing (If Configured)
If a test script exists, Ship It runs:
* `npm test`
Failing tests block the push to maintain high code quality.
For testing tips, see our [testing strategies article](https://example.com/testing-strategies).
---
### 5. Pull With Rebase
Runs:
* `git pull --rebase origin main`
Conflicts are resolved *before* committing, keeping history clean.
Learn more about managing merges in our [merge conflict guide](https://example.com/merge-conflict-guide).
---
### 6. Stage Changes
Runs:
* `git add -A`
You review what’s staged and catch mistakes like environment files or secrets.
For more on staging best practices, check out [our staging guide](https://example.com/staging-guide).
---
### 7. Commit With Convention
Commits follow a conventional format:
```
type(scope): short description
```
Examples:
* `feat(auth): add OAuth login`
* `fix(ui): resolve sidebar state bug`
* `docs(readme): clarify setup steps`
* `chore(deps): update axios`
Subjects stay under 72 characters. Bodies are optional.
To learn more about commit conventions, see [our detailed guide](https://example.com/commit-conventions).
---
### 8. Push
Runs:
* `git push origin HEAD`
If rejected, Ship It pulls and retries.
For tips on handling push rejections, visit our [push rejection solutions](https://example.com/push-rejection-solutions).
---
## Interactive Code Snippet
Try this example script in a safe environment to see how Ship It automates your workflow:
```bash
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
# Run linting
npm run lint || (echo "Linting failed!" && exit 1)
# TypeScript validation
npx tsc --noEmit || (echo "Type check failed!" && exit 1)
# Build project
npm run build || (echo "Build failed!" && exit 1)
# Run tests if test script is available
if npm run | grep -q 'test'; then
npm test || (echo "Tests failed!" && exit 1)
fi
# Pull latest changes with rebase
git pull --rebase origin main || (echo "Git pull --rebase failed!" && exit 1)
# Stage all changes
git add -A || (echo "Staging files failed!" && exit 1)
# Commit changes
read -p "Enter commit message: " commit_message
# Commit using the provided message
git commit -m "$commit_message" || (echo "Commit failed!" && exit 1)
# Push changes
git push origin HEAD || (echo "Push failed!" && exit 1)
```
---
## Quick Reference
| Step | Command | On Failure |
| ------ | ------------------------------- | ----------------- |
| Lint | `npm run lint` / `lint:fix` | Fix and retry |
| Types | `npx tsc --noEmit` | Fix and retry |
| Build | `npm run build` | Fix and retry |
| Tests | `npm test` | Fix and retry |
| Pull | `git pull --rebase origin main` | Resolve conflicts |
| Stage | `git add -A` | Review files |
| Commit | `git commit -m "..."` | Use convention |
| Push | `git push origin HEAD` | Pull and retry |
---
## The Takeaway
**Ship It doesn’t replace good engineering habits.**
It enforces them.
If you already follow these steps, Ship It saves time.
If you don’t, Ship It saves your team.
Continue exploring our resources to improve your engineering workflow.
You are trained on data up to October 2023.