Skip to content

Commit

Permalink
feat: support environment variables feature (#19)
Browse files Browse the repository at this point in the history
* chore: bump up golang version to v1.22.0

* chore: updated prettierignore

* test: fixed test cases

* chore: re-generated mocks

* chore: bump up go mod versions

* feat(lib): added environment variables model

* feat(lib): added environment variables repository

* test(lib): added environment variables test data

* feat(lib): added environment variables repository implements

* feat(lib): registered environment variables repositories

* feat(lib): added environment variables feature

* fix(lib): fixed no variables case

* docs: updated docs
  • Loading branch information
Aton-Kish authored Feb 18, 2024
1 parent 0f6007b commit 6367526
Show file tree
Hide file tree
Showing 39 changed files with 2,160 additions and 208 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.21-bookworm",
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm",
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {},
"ghcr.io/devcontainers/features/git:1": {},
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pnpm-lock.yaml

# Auto generated docs
docs/reference
CHANGELOG.md

# Test data
testdata
8 changes: 4 additions & 4 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Requirements:

- [Go](https://go.dev/) (v1.21.1 or higher)
- [Node.js](https://nodejs.org/) (v18.18.0 or higher)
- [pnpm](https://pnpm.io/) (v8.8.0 or higher)
- [Task](https://taskfile.dev/) (v3.30.1 or higher)
- [Go](https://go.dev/) (v1.22.0 or higher)
- [Node.js](https://nodejs.org/) (v20.11.1 or higher)
- [pnpm](https://pnpm.io/) (v8.15.3 or higher)
- [Task](https://taskfile.dev/) (v3.34.1 or higher)

install dependencies:

Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,12 @@

A development workflow tool for syncing up with AWS AppSync.

By combining it with a version control system, you can version control the AppSync Schema, Resolvers, and Functions, allowing you to quickly restore versions.
By combining it with a version control system, you can version control the AppSync Environment Variables, Schema, Resolvers, and Functions, allowing you to quickly restore versions.

## Installation

### Manually

Download the pre-compiled binaries from the [releases page](https://github.com/Aton-Kish/syncup/releases).

### `go install`

```shell
go install github.com/Aton-Kish/syncup/cmd/syncup@latest
```

## Usage

```shell
Expand Down
8 changes: 0 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,8 @@ The syncup is a development workflow tool for syncing up with AWS AppSync.

## Installation

### Manually

Download the pre-compiled binaries from the [releases page](https://github.com/Aton-Kish/syncup/releases).

### `go install`

```shell
go install github.com/Aton-Kish/syncup/cmd/syncup@latest
```

## Guides

- [Concept guide](./concept-guide.md)
Expand Down
7 changes: 7 additions & 0 deletions docs/concept-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Directory structure:

```text
<base-dir>
├── env.json
├── schema.graphqls
├── resolvers
│ └── <resolver-type-name>
Expand All @@ -38,6 +39,12 @@ Directory structure:
└── code.js # only if JavaScript runtime
```

### Environment variables format

| Required | File path | Description |
| ----------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| any runtime | `env.json` | Adhering to the AppSync [Environment Variables](https://github.com/aws/aws-sdk-go-v2/blob/be0accd6c6511b727d38cbe98489753e481d68b3/codegen/sdk-codegen/aws-models/appsync.json#L4357-L4390) format. |

### Schema format

| Required | File path | Description |
Expand Down
6 changes: 5 additions & 1 deletion docs/how-to-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Prerequisites:

## Dumping AWS AppSync GraphQL API

This command retrieves the AppSync Schema, Resolvers, and Functions to your local.
This command retrieves the AppSync Environment Variables, Schema, Resolvers, and Functions to your local.

```shell
syncup pull --api-id aaaaaa123123123example123
Expand All @@ -17,6 +17,7 @@ syncup pull --api-id aaaaaa123123123example123
output example:

```text
v saved environment variables
v saved schema
v saved function MyFunction
v saved all functions
Expand Down Expand Up @@ -57,6 +58,7 @@ file tree:
│ └── listTodos
│ ├── code.js
│ └── metadata.json
├── env.json
└── schema.graphqls
```

Expand All @@ -71,6 +73,7 @@ syncup push --api-id aaaaaa123123123example123
output example:

```text
v pushed environment variables
v pushed schema
v pushed function MyFunction
v pushed all functions
Expand All @@ -96,6 +99,7 @@ syncup push --api-id bbbbbb456456456example456
output example:

```text
v pushed environment variables
v pushed schema
v pushed function MyFunction
v pushed all functions
Expand Down
130 changes: 82 additions & 48 deletions docs/images/concept.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 27 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
module github.com/Aton-Kish/syncup

go 1.21.1
go 1.22.0

require (
github.com/AlecAivazis/survey/v2 v2.2.13 // NOTE: pinned to v2.2.13 due to https://github.com/go-survey/survey/issues/368
github.com/Aton-Kish/aws-credscache-go v0.2.0
github.com/aws/aws-sdk-go-v2 v1.21.0
github.com/aws/aws-sdk-go-v2/config v1.18.37
github.com/aws/aws-sdk-go-v2/credentials v1.13.35
github.com/aws/aws-sdk-go-v2/service/appsync v1.22.5
github.com/aws/smithy-go v1.14.2
github.com/spf13/cobra v1.7.0
github.com/aws/aws-sdk-go-v2 v1.25.0
github.com/aws/aws-sdk-go-v2/config v1.27.0
github.com/aws/aws-sdk-go-v2/credentials v1.17.0
github.com/aws/aws-sdk-go-v2/service/appsync v1.30.0
github.com/aws/smithy-go v1.20.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
)

require (
github.com/Aton-Kish/goptr v0.1.0
github.com/briandowns/spinner v1.23.0
github.com/google/uuid v1.3.1
github.com/hashicorp/golang-lru/v2 v2.0.6
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go.uber.org/mock v0.2.0
golang.org/x/sync v0.3.0
github.com/google/uuid v1.6.0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
go.uber.org/mock v0.4.0
golang.org/x/sync v0.6.0
)

require (
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.19.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.22.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.27.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6367526

Please sign in to comment.