# @protocol.land/sync

> Sync git repos to Protocol Land

Latest version **0.8.0** (published 2025-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @protocol.land/sync
pnpm add @protocol.land/sync
yarn add @protocol.land/sync
bun add @protocol.land/sync
```

Provides the command `proland-sync`.

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2025-02-18 |
| First published | 2023-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 44.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | @7i7o |
| Maintainers | 7i7o, iamsaikranthi |
| Keywords | Protocol Land |

## Links

- npm: https://www.npmjs.com/package/@protocol.land/sync
- Repository: https://github.com/labscommunity/protocol-land-sync
- Homepage: https://github.com/labscommunity/protocol-land-sync#readme
- Issues: https://github.com/labscommunity/protocol-land-sync/issues
- npm.io page: https://npm.io/package/@protocol.land/sync

## Dependencies (7)

- [uuid](https://npm.io/package/uuid.md) ^9.0.1
- [jszip](https://npm.io/package/jszip.md) ^3.10.1
- [dotenv](https://npm.io/package/dotenv.md) ^16.4.1
- [arweave](https://npm.io/package/arweave.md) ^1.14.4
- [arbundles](https://npm.io/package/arbundles.md) ^0.9.11
- [@permaweb/aoconnect](https://npm.io/package/@permaweb/aoconnect.md) ^0.0.52
- [@amplitude/analytics-node](https://npm.io/package/@amplitude/analytics-node.md) ^1.3.4

## Recent versions

- 0.8.0 (latest) — 2025-02-18
- 0.7.0 — 2025-02-12
- 0.6.0 — 2024-11-24
- 0.5.0 — 2024-09-26
- 0.4.0 — 2024-07-31
- 0.3.1 — 2024-04-02
- 0.3.0 — 2024-03-13
- 0.2.1 — 2024-03-11
- 0.2.0 — 2024-02-01
- 0.1.4 — 2023-12-25
- 0.1.3 — 2023-12-22
- 0.1.2 — 2023-11-29
- 0.1.1 — 2023-11-24
- 0.1.0 — 2023-11-22

## README

# Protocol Land Sync

The Protocol Land Sync package simplifies the process of syncing Git repositories with Protocol Land.

## Usage

To sync a repository with Protocol Land, you can either run it manually from your local Git repository's root folder or set up a GitHub Action if your repository is hosted on GitHub.

For both methods, **you need an Arweave wallet with some $AR** to pay for the upload.

### GitHub Actions

#### From the GitHub Webpage

1. Open the repository you want to sync to Protocol Land on github.com. Then, go into:

    Settings Tab -> Secrets and variables -> Actions -> New Repository Secret

2. Add a new secret with `WALLET` for "Name," your Arweave wallet's JWK in the "Secret" field, and click the "Add secret" button.

3. Switch to the Actions tab and click "New workflow."

4. On the "Choose a workflow" page, click "set up a workflow yourself."

5. Paste this into the `.yml` file and commit the changes:

```yaml
name: Protocol Land Sync
on:
    # Run with every push to 'main' branch:
    push:
        branches:
            - 'main'
    # Run Manually:
    #workflow_dispatch:

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: 'Checkout repo (default branch)'
              uses: actions/checkout@v3
              with:
                  # fetch all history for all branches:
                  fetch-depth: 0
            - name: 'Checkout all branches'
              run: |
                  default_branch=$(git branch | grep '*' | sed 's/\* //')
                  for abranch in $(git branch -a | grep -v HEAD | grep remotes | sed "s/remotes\/origin\///g"); do git checkout $abranch ; done
                  git checkout $default_branch
                  git branch -a
            - name: 'Setup node 18'
              uses: actions/setup-node@v3
              with:
                  node-version: 18.x
            - name: 'Sync repo to Protocol Land'
              run: npx @protocol.land/sync
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                  REPO_TITLE: ${{ github.event.repository.name }}
                  REPO_DESCRIPTION: ${{ github.event.repository.description }}
                  WALLET: ${{ secrets.WALLET }}
                # ORGANIZATION_ID: 37f219ba-df6b-40f6-89c9-a28c699967fd ## if you want to sync to an organization
                # ORGANIZATION_NAME: protocol-land ## if you want to sync to an organization

```

> [!NOTE]
> This GitHub Action **will run on every push to the 'main' branch**.
> If you want to run it manually, comment the lines after `on:` and uncomment the `workflow_dispatch:` line.
>
> You can also comment the entire `'Checkout all branches'` section if you only want to sync the main branch.

#### From Your Local Git Folder

Follow `1.` and `2.` from the previous section to set up a GitHub Secret.

3. Create a file called `protocol-land-sync.yml` in a subfolder called `.github/workflows` under your repo's root (create the folder if it doesn't exist).

4. Paste the same contents as in step `5.` in the previous section.

5. Commit and push to your remote Git repo.

### Locally (Without GitHub Action)

1. Install a node package manager (`npm` or `pnpm`) to run it locally.

2. Ensure you have a `.gitignore` for all the files you don't want synced.

3. Navigate to the root folder of your repository and create a `.env` file.
   Inside the `.env` file, include the following lines:

    ```dosini
    WALLET='YOUR_WALLET_JWK_HERE'
    REPO_TITLE='Your Repo Name Here'
    REPO_DESCRIPTION='Your Repo Description Here'
    ORGANIZATION_ID='Your Organization ID Here'
    ```

    Replace `'YOUR_WALLET_JWK_HERE'` with your Arweave wallet's JWK (JSON Web Key). 

    These environment variables (`WALLET`, `REPO_TITLE`, and `REPO_DESCRIPTION`) are crucial for setting up your repository and providing a meaningful description.


4. **(optional)** Checkout locally all the branches you want synced. The tool uploads all the branches you have checked out locally with Git.
   Run this bash command to checkout all the remote branches:

    ```bash
    default_branch=$(git branch | grep '*' | sed 's/\* //') && for abranch in $(git branch -a | grep -v HEAD | grep remotes | sed "s/remotes\/origin\///g"); do git checkout $abranch ; done && git checkout $default_branch
    ```

5. From the root directory of your repository, execute the following command based on your preferred package manager:

    ```bash
    # Using npx
    npx @protocol.land/sync

    # Or using pnpx
    pnpx @protocol.land/sync
    ```

    Choose the appropriate command corresponding to the package manager installed on your system.

6. Go to [Protocol Land's page](https://protocol.land/) and log in with the Arweave wallet you used to sync your repo.

---
_Source: https://npm.io/package/@protocol.land/sync · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
