From aa33d7f418de6192f77898cf9f7790d4a4fda2d5 Mon Sep 17 00:00:00 2001 From: Futrime Date: Fri, 2 Feb 2024 21:47:02 +0800 Subject: [PATCH] feat: remove source field --- CHANGELOG.md | 4 ++++ docs/tooth_json_file_reference.md | 7 ++----- docs/tutorials/create_a_lip_tooth.md | 1 - internal/cmd/cmdlipshow/cmdlipshow.go | 1 - internal/cmd/cmdliptoothinit/cmdliptoothinit.go | 6 ------ internal/tooth/jsonshema.go | 3 --- internal/tooth/metadata.go | 1 - internal/tooth/migration/v1tov2/v1tov2.go | 2 -- internal/tooth/rawmetadata.go | 1 - schemas/tooth.v2.schema.json | 3 --- 10 files changed, 6 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8fe789..3836d0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + +- `source` field in `tooth.json`. + ## [0.19.0] - 2024-01-20 ### Added diff --git a/docs/tooth_json_file_reference.md b/docs/tooth_json_file_reference.md index abbf2fd..3b22774 100644 --- a/docs/tooth_json_file_reference.md +++ b/docs/tooth_json_file_reference.md @@ -28,8 +28,7 @@ A tooth.json includes directives as shown in the following example. These are de "tags": [ "example" ], - "avatar_url": "avatar.png", - "source": "github.com/lippkg/example" + "avatar_url": "avatar.png" }, "asset_url": "https://github.com/tooth-hub/example/releases/download/v1.0.0/example-1.0.0.zip", "commands": { @@ -166,7 +165,6 @@ Provide information about your tooth in the form of a JSON object with the follo - `author`: (required) the author of your tooth. - `tags`: (required) an array of tags of your tooth. - `avatar_url`: the URL of the tooth's avatar. If not set, the default avatar will be used. If a relative path is provided, it will be regarded as a path relative to **the source repository path**. -- `source`: the source repository of your tooth. If not set, the tooth repository path will be used. ### Examples @@ -179,8 +177,7 @@ Provide information about your tooth in the form of a JSON object with the follo "tags": [ "example" ], - "avartar_url": "", - "source": "github.com/lippkg/example" + "avartar_url": "" } } ``` diff --git a/docs/tutorials/create_a_lip_tooth.md b/docs/tutorials/create_a_lip_tooth.md index a2bc7ad..7a15ee4 100644 --- a/docs/tutorials/create_a_lip_tooth.md +++ b/docs/tutorials/create_a_lip_tooth.md @@ -106,7 +106,6 @@ You can create a tooth.json like this: "name": "Example World", "description": "An example world", "author": "Example User", - "source": "github.com/lippkg/example", "tags": [ "ll", "llbds", "bds" ] diff --git a/internal/cmd/cmdlipshow/cmdlipshow.go b/internal/cmd/cmdlipshow/cmdlipshow.go index 99ca709..f430cbc 100644 --- a/internal/cmd/cmdlipshow/cmdlipshow.go +++ b/internal/cmd/cmdlipshow/cmdlipshow.go @@ -145,7 +145,6 @@ func show(ctx *context.Context, toothRepoPath string, {"Name", metadata.Info().Name}, {"Description", metadata.Info().Description}, {"Author", metadata.Info().Author}, - {"Source", metadata.Info().Source}, {"Tags", strings.Join(metadata.Info().Tags, ", ")}, {"Version", metadata.Version().String()}, }...) diff --git a/internal/cmd/cmdliptoothinit/cmdliptoothinit.go b/internal/cmd/cmdliptoothinit/cmdliptoothinit.go index 8b09fa8..777027a 100644 --- a/internal/cmd/cmdliptoothinit/cmdliptoothinit.go +++ b/internal/cmd/cmdliptoothinit/cmdliptoothinit.go @@ -36,7 +36,6 @@ var metadataTemplate = tooth.RawMetadata{ Name: "", Description: "", Author: "", - Source: "", Tags: []string{}, }, } @@ -118,11 +117,6 @@ func initTooth(ctx *context.Context) error { ans = scanner.Text() rawMetadata.Info.Author = ans - log.Info("What is the source code repo path (leave empty if identical to tooth repo path)?") - scanner.Scan() - ans = scanner.Text() - rawMetadata.Info.Source = ans - metadata, err := tooth.MakeMetadataFromRaw(rawMetadata) if err != nil { return fmt.Errorf("failed to make metadata: %w", err) diff --git a/internal/tooth/jsonshema.go b/internal/tooth/jsonshema.go index 9901568..cfa397a 100644 --- a/internal/tooth/jsonshema.go +++ b/internal/tooth/jsonshema.go @@ -35,9 +35,6 @@ const metadataJSONSchema = `{ }, "avatar_url": { "type": "string" - }, - "source": { - "type": "string" } }, "required": [ diff --git a/internal/tooth/metadata.go b/internal/tooth/metadata.go index 8687412..36a1870 100644 --- a/internal/tooth/metadata.go +++ b/internal/tooth/metadata.go @@ -25,7 +25,6 @@ type Info struct { Description string Author string Tags []string - Source string } type Commands struct { PreInstall []string diff --git a/internal/tooth/migration/v1tov2/v1tov2.go b/internal/tooth/migration/v1tov2/v1tov2.go index fab20fd..57c32b7 100644 --- a/internal/tooth/migration/v1tov2/v1tov2.go +++ b/internal/tooth/migration/v1tov2/v1tov2.go @@ -166,7 +166,6 @@ type RawMetadataInfo struct { Description string `json:"description"` Author string `json:"author"` Tags []string `json:"tags"` - Source string `json:"source,omitempty"` } type RawMetadataCommands struct { @@ -228,7 +227,6 @@ func Migrate(jsonBytes []byte) ([]byte, error) { Name: v1RawMetadata.Information.Name, Description: v1RawMetadata.Information.Description, Author: v1RawMetadata.Information.Author, - Source: "", Tags: make([]string, 0), }, Commands: RawMetadataCommands{ diff --git a/internal/tooth/rawmetadata.go b/internal/tooth/rawmetadata.go index 77a7a65..f1bbba8 100644 --- a/internal/tooth/rawmetadata.go +++ b/internal/tooth/rawmetadata.go @@ -22,7 +22,6 @@ type RawMetadataInfo struct { Description string `json:"description"` Author string `json:"author"` Tags []string `json:"tags"` - Source string `json:"source,omitempty"` } type RawMetadataCommands struct { diff --git a/schemas/tooth.v2.schema.json b/schemas/tooth.v2.schema.json index 225a92f..4633238 100644 --- a/schemas/tooth.v2.schema.json +++ b/schemas/tooth.v2.schema.json @@ -33,9 +33,6 @@ }, "avatar_url": { "type": "string" - }, - "source": { - "type": "string" } }, "required": [