Skip to content

Commit

Permalink
Merge pull request #1355 from onflow/feature/stable-cadence
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Jun 20, 2024
2 parents 9f8ace5 + 600e855 commit b6c8838
Show file tree
Hide file tree
Showing 111 changed files with 7,876 additions and 748 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
continue-on-error: true
uses: snyk/actions/golang@master
with:
go-version: '1.20'
go-version: '1.22'
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Setup Release Environment
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Run tests
run: |
make ci
Expand All @@ -51,12 +51,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: generate
run: make generate
- uses: golangci/[email protected]
with:
version: v1.52.2
version: v1.59.0
only-new-issues: true
skip-pkg-cache: true
args: --timeout=3m
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ linters:
enable:
- govet
- errcheck
- varcheck
- ineffassign
- typecheck
- misspell
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ Key 0 Public Key c8a2a318b9099cc6c872a0ec3dcd9f59d17837e4ffd6cd8
Hash Algorithm SHA3_256
Code
pub contract Foo {
pub var bar: String
access(all) contract Foo {
access(all) var bar: String
init() {
self.bar = "Hello, World!"
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration for goreleaser
PACKAGE_NAME := github.com/onflow/flow-cli
GOLANG_CROSS_VERSION ?= v1.20.0
GOLANG_CROSS_VERSION ?= v1.22.0

# The tag of the current commit, otherwise empty
VERSION := $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
Expand Down Expand Up @@ -29,7 +29,7 @@ install-tools:
GO111MODULE=on go install github.com/axw/gocov/gocov@latest; \
GO111MODULE=on go install github.com/matm/gocov-html/cmd/gocov-html@latest; \
GO111MODULE=on go install github.com/sanderhahn/gozip/cmd/gozip@latest; \
GO111MODULE=on go install github.com/vektra/mockery/v2@v2.38.0;
GO111MODULE=on go install github.com/vektra/mockery/v2@v2.43.2;

.PHONY: test
test:
Expand Down
43 changes: 9 additions & 34 deletions cmd/flow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
package main

import (
"fmt"
"os"
"strings"

"github.com/onflow/flow-cli/internal/dependencymanager"

"github.com/spf13/cobra"

"github.com/onflow/flow-cli/internal/accounts"
Expand All @@ -34,9 +28,12 @@ import (
"github.com/onflow/flow-cli/internal/collections"
"github.com/onflow/flow-cli/internal/command"
"github.com/onflow/flow-cli/internal/config"
"github.com/onflow/flow-cli/internal/dependencymanager"
"github.com/onflow/flow-cli/internal/emulator"
"github.com/onflow/flow-cli/internal/events"
evm "github.com/onflow/flow-cli/internal/evm"
"github.com/onflow/flow-cli/internal/keys"
"github.com/onflow/flow-cli/internal/migrate"
"github.com/onflow/flow-cli/internal/project"
"github.com/onflow/flow-cli/internal/quick"
"github.com/onflow/flow-cli/internal/scripts"
Expand All @@ -56,34 +53,6 @@ func main() {
var cmd = &cobra.Command{
Use: "flow",
TraverseChildren: true,
// Messaging for Cadence 1.0 upgrade
PersistentPreRun: func(cmd *cobra.Command, args []string) {
outputFlag, _ := cmd.Flags().GetString("output")
// If output is set to json, do not append any message
if outputFlag != "json" {

width := 80
url := "https://cadence-lang.org/docs/cadence_migration_guide"

// Function to center text within a given width
centerText := func(text string, width int) string {
space := (width - len(text)) / 2
if space < 0 {
space = 0
}
return fmt.Sprintf("%s%s%s", strings.Repeat(" ", space), text, strings.Repeat(" ", space))
}

fmt.Fprintln(os.Stderr, strings.Repeat("+", width))
fmt.Fprintln(os.Stderr, centerText("⚠ Upgrade to Cadence 1.0", width))
fmt.Fprintln(os.Stderr, centerText("The Crescendo network upgrade, including Cadence 1.0, is coming soon.", width))
fmt.Fprintln(os.Stderr, centerText("You may need to update your existing contracts to support this change.", width))
fmt.Fprintln(os.Stderr, centerText("Please visit our migration guide here:", width))
fmt.Fprintln(os.Stderr, centerText(url, width))
fmt.Fprintln(os.Stderr, strings.Repeat("+", width))

}
},
}

// quick commands
Expand Down Expand Up @@ -119,6 +88,8 @@ func main() {
cmd.AddCommand(super.FlixCmd)
cmd.AddCommand(super.GenerateCommand)
cmd.AddCommand(dependencymanager.Cmd)
cmd.AddCommand(migrate.Cmd)
cmd.AddCommand(evm.Cmd)

command.InitFlags(cmd)
cmd.AddGroup(&cobra.Group{
Expand Down Expand Up @@ -149,6 +120,10 @@ func main() {
ID: "manager",
Title: "🔗 Dependency Manager",
})
cmd.AddGroup(&cobra.Group{
ID: "migrate",
Title: "📦 Migration to 1.0",
})

cmd.SetUsageTemplate(command.UsageTemplate)

Expand Down
Loading

0 comments on commit b6c8838

Please sign in to comment.