Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'sst:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yyaskriloff authored Sep 22, 2024
2 parents 9dc03b6 + 377fb1b commit d43141f
Show file tree
Hide file tree
Showing 131 changed files with 3,575 additions and 1,080 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ Here's how you can contribute:
- Find a bug? Open an issue
- Feature request? Submit a PR

## Running Locally

1. Clone the repo
2. `bun install`
3. `cd platform && bun run build`

Now you can run the CLI locally on any of the `examples/` apps.

```bash
cd examples/aws-api
go run ../../cmd/sst <command>
```

If you want to build the CLI, you can run `go build ./cmd/sst` from the root. This will create a
`sst` binary that you can use.

---

**Join our community** [Discord](https://sst.dev/discord) | [YouTube](https://www.youtube.com/c/sst-dev) | [Twitter](https://twitter.com/SST_dev)
Binary file modified bun.lockb
Binary file not shown.
7 changes: 7 additions & 0 deletions cmd/sst/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ func CmdInit(cli *cli.Cli) error {
template = "remix"
break

case slices.ContainsFunc(hints, func(s string) bool { return (strings.HasPrefix(s, "vite.config") && fileContains(s, "@analogjs/platform")) }):
fmt.Println(" Analog detected. This will...")
fmt.Println(" - create an sst.config.ts")
fmt.Println(" - add sst to package.json")
template = "analog"
break

case slices.ContainsFunc(hints, func(s string) bool { return strings.HasPrefix(s, "angular.json") }):
fmt.Println(" Angular detected. This will...")
fmt.Println(" - create an sst.config.ts")
Expand Down
18 changes: 9 additions & 9 deletions cmd/sst/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ var root = &cli.Command{
{
Name: "target",
Description: cli.Description{
Short: "Comma seperated list of target URNs",
Long: "Comma seperated list of target URNs.",
Short: "Comma separated list of target URNs",
Long: "Comma separated list of target URNs.",
},
},
},
Expand Down Expand Up @@ -501,7 +501,7 @@ var root = &cli.Command{
"This is useful for cases when you pull some changes from a teammate and want to",
"see what will be deployed; before doing the actual deploy.",
"",
"Optionall, you can diff a specific set of resources by passing in a list of their URNs.",
"Optionally, you can diff a specific set of resources by passing in a list of their URNs.",
"",
"```bash frame=\"none\"",
"sst diff --target urn:pulumi:prod::www::sst:aws:Astro::Astro,urn:pulumi:prod::www::sst:aws:Bucket::Assets",
Expand All @@ -522,8 +522,8 @@ var root = &cli.Command{
{
Name: "target",
Description: cli.Description{
Short: "Comma seperated list of target URNs",
Long: "Comma seperated list of target URNs.",
Short: "Comma separated list of target URNs",
Long: "Comma separated list of target URNs.",
},
},
{
Expand Down Expand Up @@ -852,8 +852,8 @@ var root = &cli.Command{
Name: "target",
Type: "string",
Description: cli.Description{
Short: "Comma seperated list of target URNs",
Long: "Comma seperated list of target URNs.",
Short: "Comma separated list of target URNs",
Long: "Comma separated list of target URNs.",
},
},
},
Expand Down Expand Up @@ -991,8 +991,8 @@ var root = &cli.Command{
Name: "target",
Type: "string",
Description: cli.Description{
Short: "Comma seperated list of target URNs",
Long: "Comma seperated list of target URNs.",
Short: "Comma separated list of target URNs",
Long: "Comma separated list of target URNs.",
},
},
},
Expand Down
10 changes: 5 additions & 5 deletions cmd/sst/mosaic/multiplexer/tcell-term/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func csiEntry(r rune, p *Parser) stateFn {
return ground
default:
// Return to ground on unexpected characters
p.emit(fmt.Errorf("unexpected characted: %c", r))
p.emit(fmt.Errorf("unexpected character: %c", r))
return ground
}
}
Expand Down Expand Up @@ -462,7 +462,7 @@ func csiParam(r rune, p *Parser) stateFn {
return csiIgnore
default:
// Return to ground on unexpected characters
p.emit(fmt.Errorf("unexpected characted: %c", r))
p.emit(fmt.Errorf("unexpected character: %c", r))
return ground
}
}
Expand Down Expand Up @@ -521,7 +521,7 @@ func csiIntermediate(r rune, p *Parser) stateFn {
return ground
default:
// Return to ground on unexpected characters
p.emit(fmt.Errorf("unexpected characted: %c", r))
p.emit(fmt.Errorf("unexpected character: %c", r))
return ground
}
}
Expand Down Expand Up @@ -586,7 +586,7 @@ func dcsIntermediate(r rune, p *Parser) stateFn {
return dcsPassthrough
default:
// Return to ground on unexpected characters
p.emit(fmt.Errorf("unexpected characted: %c", r))
p.emit(fmt.Errorf("unexpected character: %c", r))
return ground
}
}
Expand Down Expand Up @@ -617,7 +617,7 @@ func dcsParam(r rune, p *Parser) stateFn {
return dcsPassthrough
default:
// Return to ground on unexpected characters
p.emit(fmt.Errorf("unexpected characted: %c", r))
p.emit(fmt.Errorf("unexpected character: %c", r))
return ground
}
}
Expand Down
18 changes: 15 additions & 3 deletions cmd/sst/mosaic/ui/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ func parseError(input string) []string {
input = regexp.MustCompile(`<ref \*\d+>\s*`).ReplaceAllString(input, "")
input = strings.TrimSpace(input)
lines := strings.Split(input, "\n")
if strings.HasPrefix(lines[0], "VisibleError") {
stripped := strings.SplitN(lines[0], ": ", 2)
return stripped[1:]

// Remove the "VisibleError: " prefix from the first line if it exists
if strings.HasPrefix(lines[0], "VisibleError: ") {
lines[0] = strings.TrimPrefix(lines[0], "VisibleError: ")

// Find the first line that starts with spaces followed by "at" and
// remove that line and all following lines
for i, line := range lines {
trimmed := strings.TrimLeft(line, " ")
if strings.HasPrefix(trimmed, "at") {
// Remove all lines starting from this point
return lines[:i]
}
}
}

return lines
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/sst/mosaic/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ func (u *UI) Event(unknown interface{}) {
if status.URN != "" {
u.println(TEXT_DANGER_BOLD.Render(" " + u.FormatURN(status.URN)))
}
u.print(TEXT_NORMAL.Render(" " + strings.Join(parseError(status.Message), "\n ")))
for _, line := range parseError(status.Message) {
u.println(TEXT_NORMAL.Render(" " + line))
}
importDiffs, ok := evt.ImportDiffs[status.URN]
if ok {
isSSTComponent := strings.Contains(status.URN, "::sst")
Expand Down
13 changes: 9 additions & 4 deletions cmd/sst/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ var CmdSecretLoad = &cli.Command{
url, _ := server.Discover(p.PathConfig(), p.App().Stage)
if url != "" {
dev.Deploy(c.Context, url)
return nil
}

ui.Success("Run \"sst deploy\" to update.")
Expand Down Expand Up @@ -349,15 +350,17 @@ var CmdSecretSet = &cli.Command{
return util.NewReadableError(err, "Could not set secret")
}
url, _ := server.Discover(p.PathConfig(), p.App().Stage)
suffix := " Run \"sst deploy\" to update."
if url != "" {
suffix = ""
dev.Deploy(c.Context, url)
}

if c.Bool("fallback") {
ui.Success(fmt.Sprintf("Set fallback value for \"%s\". Run \"sst deploy\" to update.", key))
ui.Success(fmt.Sprintf("Set fallback value for \"%s\".%s", key, suffix))
return nil
}
ui.Success(fmt.Sprintf("Set \"%s\" for stage \"%s\". Run \"sst deploy\" to update.", key, p.App().Stage))
ui.Success(fmt.Sprintf("Set \"%s\" for stage \"%s\".%s", key, p.App().Stage, suffix))
return nil
},
}
Expand Down Expand Up @@ -438,14 +441,16 @@ var CmdSecretRemove = &cli.Command{
return util.NewReadableError(err, "Could not set secret")
}
url, _ := server.Discover(p.PathConfig(), p.App().Stage)
suffix := " Run \"sst deploy\" to update."
if url != "" {
suffix = ""
dev.Deploy(c.Context, url)
}
if c.Bool("fallback") {
ui.Success(fmt.Sprintf("Removed fallback value for \"%s\"", key))
ui.Success(fmt.Sprintf("Removed fallback value for \"%s\".%s", key, suffix))
return nil
}
ui.Success(fmt.Sprintf("Removed \"%s\" for stage \"%s\"", key, p.App().Stage))
ui.Success(fmt.Sprintf("Removed \"%s\" for stage \"%s\".%s", key, p.App().Stage, suffix))
return nil
},
}
16 changes: 16 additions & 0 deletions examples/aws-analog/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
48 changes: 48 additions & 0 deletions examples/aws-analog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
/.nx/cache
/.nx/workspace-data
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

# sst
.sst
.output
4 changes: 4 additions & 0 deletions examples/aws-analog/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template", "analogjs.vscode-analog"]
}
19 changes: 19 additions & 0 deletions examples/aws-analog/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:5173/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test"
}
]
}
42 changes: 42 additions & 0 deletions examples/aws-analog/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
26 changes: 26 additions & 0 deletions examples/aws-analog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Analog App

This project was generated with [Analog](https://analogjs.org), the fullstack meta-framework for Angular.

## Setup

Run `npm install` to install the application dependencies.

## Development

Run `npm start` for a dev server. Navigate to `http://localhost:5173/`. The application automatically reloads if you change any of the source files.

## Build

Run `npm run build` to build the client/server project. The client build artifacts are located in the `dist/analog/public` directory. The server for the API build artifacts are located in the `dist/analog/server` directory.

## Test

Run `npm run test` to run unit tests with [Vitest](https://vitest.dev).

## Community

- Visit and Star the [GitHub Repo](https://github.com/analogjs/analog)
- Join the [Discord](https://chat.analogjs.org)
- Follow us on [Twitter](https://twitter.com/analogjs)
- Become a [Sponsor](https://github.com/sponsors/brandonroberts)
Loading

0 comments on commit d43141f

Please sign in to comment.