Skip to content

Commit

Permalink
remove(compute/init): assemblyscript (#1002)
Browse files Browse the repository at this point in the history
* remove(compute/init): assemblyscript

* feat(compute/build): add deprecated notice

* doc(compute): fix devhub typo

Co-authored-by: Jake Champion <[email protected]>

---------

Co-authored-by: Jake Champion <[email protected]>
  • Loading branch information
Integralist and JakeChampion authored Aug 31, 2023
1 parent a7f9991 commit 3b88605
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pkg/commands/compute/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type InitCommand struct {
}

// Languages is a list of supported language options.
var Languages = []string{"rust", "javascript", "go", "assemblyscript", "other"}
var Languages = []string{"rust", "javascript", "go", "other"}

// NewInitCommand returns a usable command registered under the parent.
func NewInitCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *InitCommand {
Expand Down
17 changes: 0 additions & 17 deletions pkg/commands/compute/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ func TestInit(t *testing.T) {
Branch: "main",
},
}
skAS := []config.StarterKit{
{
Name: "Default",
Path: "https://github.com/fastly/compute-starter-kit-assemblyscript-default",
Branch: "main",
},
}

scenarios := []struct {
name string
Expand Down Expand Up @@ -328,16 +321,6 @@ func TestInit(t *testing.T) {
manifestPath: "foo",
manifestIncludes: `name = "foo`,
},
{
name: "with AssemblyScript language",
args: args("compute init --language assemblyscript"),
configFile: config.File{
StarterKits: config.StarterKitLanguages{
AssemblyScript: skAS,
},
},
manifestIncludes: `name = "fastly-temp`,
},
{
name: "with JavaScript language",
args: args("compute init --language javascript"),
Expand Down
5 changes: 0 additions & 5 deletions pkg/commands/compute/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ func NewLanguages(kits config.StarterKitLanguages) []*Language {
DisplayName: "Go",
StarterKits: kits.Go,
}),
NewLanguage(&LanguageOptions{
Name: "assemblyscript",
DisplayName: "AssemblyScript",
StarterKits: kits.AssemblyScript,
}),
NewLanguage(&LanguageOptions{
Name: "other",
DisplayName: "Other ('bring your own' Wasm binary)",
Expand Down
5 changes: 5 additions & 0 deletions pkg/commands/compute/language_assemblyscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ type AssemblyScript struct {

// Build compiles the user's source code into a Wasm binary.
func (a *AssemblyScript) Build() error {
text.Deprecated(a.output, "The Fastly AssemblyScript SDK is being deprecated in favor of the more up-to-date and feature-rich JavaScript SDK. You can learn more about the JavaScript SDK on our Developer Hub Page - https://developer.fastly.com/learning/compute/javascript/")
if !a.verbose {
text.Break(a.output)
}

var noBuildScript bool
if a.build == "" {
a.build = AsDefaultBuildCommand
Expand Down
6 changes: 6 additions & 0 deletions pkg/text/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ func Break(w io.Writer) {
fmt.Fprintln(w)
}

// Deprecated is a wrapper for fmt.Fprintf with a bold red "DEPRECATED: " prefix.
func Deprecated(w io.Writer, format string, args ...any) {
format = strings.TrimRight(format, "\r\n") + "\n"
fmt.Fprintf(w, "\n"+Wrap(BoldRed("DEPRECATED: ")+format, DefaultTextWidth)+"\n", args...)
}

// Error is a wrapper for fmt.Fprintf with a bold red "ERROR: " prefix.
func Error(w io.Writer, format string, args ...any) {
format = strings.TrimRight(format, "\r\n") + "\n"
Expand Down

0 comments on commit 3b88605

Please sign in to comment.