Skip to content

Commit

Permalink
Add Synapse CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
JadenSimon committed Jun 15, 2024
1 parent fa56a77 commit b352a24
Show file tree
Hide file tree
Showing 148 changed files with 75,742 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-synapse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- main
paths:
- "!.github/**"
- .github/workflows/build-synapse.yml
- src/**
pull_request:
branches:
- main
paths:
- "!.github/**"
- .github/workflows/build-synapse.yml
- src/**

jobs:
run_test:
runs-on:
- ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- run: curl -fsSL https://synap.sh/install | bash
- run: echo "SYNAPSE_INSTALL=$HOME/.synapse" >> "$GITHUB_ENV"
- run: echo "${SYNAPSE_INSTALL}/bin" >> "$GITHUB_PATH"
- run: synapse --version
- run: synapse compile && synapse build
- run: ./dist/bin/synapse
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
**/.env
**/.env.*
**/.DS_Store
*.d.zig.ts
34 changes: 34 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## Prerequisites
You'll need the latest version of Synapse installed

## Synapse CLI
The bulk of Synapse lives in `src`. Use `synapse compile` in the root of the repository to build. There is a fast and slow way to test your changes. The fast way requires a little bit of setup but results in much quicker iterations. The slow way creates an executable which is most similar to the release build of Synapse.

### Slow Way

Run `synapse compile` + `synapse build`. The executable will be placed in `dist/bin` e.g. `dist/bin/synapse` for Linux/macOS and `dist/bin/synapse.exe` for Windows.

### Fast Way

This is currently unreliable. Use the slow way for now.

<!-- First setup this bash script:
```bash
#/usr/bin/env bash
export SYNAPSE_USE_DEV_LOADER="1"
exec synapse "$SYNAPSE_INSTALL/cache/packages/linked/synapse" "$@"
```
I like to place it in `$SYNAPSE_INSTALL/app/bin/syn`.
Now instead of `synapse compile`, run `synapse compile && synapse publish --local` after every change. You can also use `synapse run compileSelf`. -->


## Integrations (aka compiler backends)

Synapse uses a plugin-like architecture for loading deployment target implementations. Packages can contribute implementations by using the `addTarget` function from `synapse:core`. See [this file](../integrations/local/src/function.ts) for a reasonably simple example.
Expand All @@ -20,3 +47,10 @@ This will use the `local` target by default. You can change the target by adding
cd test/conformance && synapse compile --target aws && synapse test
```

## The `packages` directory

The tarballs in this directory contain services (or rather, service stubs) that may eventually be used in either Synapse directly, or possibly a separate CLI entirely. These are currently closed-source for two main reasons:

1. It's difficult to open-source _live_ services (but Synapse _will_ make it easier!)
2. They may become apart of a strategy to help fund the development of Synapse

42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "synapse",
"version": "0.0.3",
"bin": "./src/cli/index.ts",
"dependencies": {
"esbuild": "^0.20.2",
"typescript": "~5.4.5"
},
"devDependencies": {
"@types/node": "^20.11.27",
"postject": "github:Cohesible/postject",
"@cohesible/auth": "file:packages/auth.tgz",
"@cohesible/quotes": "file:packages/quotes.tgz",
"@cohesible/resources": "file:packages/resources.tgz"
},
"engines": {
"node": "22.1.0"
},
"scripts": {
"compileSelf": "synapse compile --no-synth && synapse publish --local"
},
"files": [
"dist"
],
"synapse": {
"config": {
"target": "local",
"zigFiles": [
"src/zig/ast.zig",
"src/zig/fs-ext.zig",
"src/zig/util.zig"
]
},
"binaryDependencies": {
"node": "https://github.com/Cohesible/node.git",
"terraform": "https://github.com/Cohesible/terraform.git"
},
"devTools": {
"zig": "0.12.0"
}
}
}
Binary file added packages/auth.tgz
Binary file not shown.
Binary file added packages/quotes.tgz
Binary file not shown.
Binary file added packages/resources.tgz
Binary file not shown.
Loading

0 comments on commit b352a24

Please sign in to comment.