Skip to content

Commit e3c58fa

Browse files
authored
Merge pull request #1859 from onflow/nialexsan/remove-scaffold
Deprecate scaffold command
2 parents e60b450 + c8861ba commit e3c58fa

5 files changed

Lines changed: 1 addition & 307 deletions

File tree

CONTRIBUTING.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,6 @@ To make the new version the default version that is installed
161161

162162
- **DEPRECATED** Change `version.txt` and commit it. (This file is no longer user for versions of the Flow CLI later than v1.18.0, although it should still be maintained to support older versions of the CLI for a while)
163163

164-
## Adding a scaffold
165-
You can add your own scaffold by creating a GitHub repository containing the scaffold content and then making a PR
166-
to update the `scaffolds.json` in the Flow CLI repository. You need to add an entry to the list
167-
with the below content.
168-
169-
```json
170-
{
171-
"name": "name of the scaffold",
172-
"repo": "HTTP URL to the repository containing the scaffold",
173-
"commit": "Hash of the (latest) commit in your scaffold repository",
174-
"branch": "scaffold repository branch",
175-
"description": "user friendly description of the scaffold (what it contains, why it is used...)"
176-
}
177-
```
178-
179164

180165
# CLI Guidelines
181166
This is a design guideline used for the development of the Flow CLI. The purpose of this guideline is to achieve consistency across new features and allow composability of commands that build the fundamentals of great CLI design.

internal/prompt/prompt.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -714,75 +714,6 @@ func InstallPathPrompt(defaultPath string) string {
714714
return filepath.Clean(install)
715715
}
716716

717-
type ScaffoldItem struct {
718-
Index int
719-
Title string
720-
Category string
721-
assignedIndex int
722-
}
723-
724-
func ScaffoldPrompt(logger output.Logger, scaffoldItems []ScaffoldItem) int {
725-
const (
726-
general = ""
727-
mobile = "mobile"
728-
web = "web"
729-
unity = "unity"
730-
)
731-
outputType := map[string]string{
732-
general: "🔨 General Scaffolds",
733-
mobile: "📱 Mobile Scaffolds",
734-
web: "💻 Web Scaffolds",
735-
unity: "🏀 Unity Scaffolds",
736-
}
737-
738-
index := 0
739-
outputCategory := func(category string, items []ScaffoldItem) {
740-
logger.Info(output.Bold(output.Magenta(outputType[category])))
741-
for i := range items {
742-
if items[i].Category == category {
743-
index++
744-
logger.Info(fmt.Sprintf(" [%d] %s", index, items[i].Title))
745-
items[i].assignedIndex = index
746-
}
747-
}
748-
logger.Info("")
749-
}
750-
751-
outputCategory(general, scaffoldItems)
752-
outputCategory(web, scaffoldItems)
753-
outputCategory(mobile, scaffoldItems)
754-
outputCategory(unity, scaffoldItems)
755-
756-
prompt := promptui.Prompt{
757-
Label: "Enter the scaffold number",
758-
Validate: func(s string) error {
759-
n, err := strconv.Atoi(s)
760-
if err != nil {
761-
return fmt.Errorf("input must be a number")
762-
}
763-
764-
if n < 0 && n > len(scaffoldItems) {
765-
return fmt.Errorf("not a valid number")
766-
}
767-
return nil
768-
},
769-
}
770-
771-
input, err := prompt.Run()
772-
if err == promptui.ErrInterrupt {
773-
os.Exit(-1)
774-
}
775-
num, _ := strconv.Atoi(input)
776-
777-
for _, item := range scaffoldItems {
778-
if item.assignedIndex == num {
779-
return item.Index
780-
}
781-
}
782-
783-
return 0
784-
}
785-
786717
func GenericBoolPrompt(msg string) bool {
787718
prompt := promptui.Select{
788719
Label: msg,

internal/super/scaffolds.go

Lines changed: 0 additions & 188 deletions
This file was deleted.

internal/super/setup.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ import (
4444

4545
type flagsSetup struct {
4646
ConfigOnly bool `default:"false" flag:"config-only" info:"Only create a flow.json default config"`
47-
Scaffold bool `default:"" flag:"scaffold" info:"Interactively select a provided scaffold for project creation"`
48-
ScaffoldID int `default:"" flag:"scaffold-id" info:"Use provided scaffold ID for project creation"`
4947
}
5048

5149
var setupFlags = flagsSetup{}
@@ -73,18 +71,7 @@ func create(
7371
var targetDir string
7472
var err error
7573

76-
if setupFlags.Scaffold || setupFlags.ScaffoldID != 0 {
77-
fmt.Println("`scaffold` and `scaffold-id` are deprecated, and will be removed in a future release.")
78-
// Error if no project name is given
79-
if len(args) < 1 || args[0] == "" {
80-
return nil, fmt.Errorf("no project name provided")
81-
}
82-
83-
targetDir, err = handleScaffold(args[0], logger)
84-
if err != nil {
85-
return nil, err
86-
}
87-
} else if setupFlags.ConfigOnly {
74+
if setupFlags.ConfigOnly {
8875
if len(args) > 0 {
8976
return nil, fmt.Errorf("project name not required when using --config-only flag")
9077
}

scaffolds.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)