Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scaffolding): add --path for all scaffold, generate and chain commands #1518

Merged
merged 50 commits into from
Sep 13, 2021

Conversation

Pantani
Copy link
Collaborator

@Pantani Pantani commented Aug 27, 2021

closes #1365

What does this MR does?

Add the --path flag for all starport scaffolds, generate and chain commands.

How to test?

  • Scaffold a chain and a type with the path flag:
$ starport s chain github.com/cosmonaut/foo --path "$GOPATH/src/github.com/tendermint/"
$ starport s list coordinator address:string validatorID:uint --no-message --path "$GOPATH/src/github.com/tendermint/foo"
  • Works with relative paths:
$ cd $GOPATH/src/github.com/tendermint
$ starport s map map_with_index email --index foo:string,bar:int,foobar:uint,barFoo:bool --path ./test
  • And also any path inside the chain app:
$ starport s message settle-request coordinator approve:bool --path ./test/docs/static

@Pantani Pantani self-assigned this Aug 27, 2021
@Pantani Pantani marked this pull request as ready for review August 29, 2021 03:34
Copy link
Member

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pantani can you also cover this part? #1365 (comment)

to detect, we can recursively lookup for a go.mod file in parent directories. and to make sure this belongs to the chain, let's check if the go.mod file requires tendermint and cosmos-sdk repositories. then we can set the dir of where go.mod resides as the --path, otherwise we can return with an error.

lumtis
lumtis previously approved these changes Aug 30, 2021
Copy link
Contributor

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

starport/cmd/cmd.go Outdated Show resolved Hide resolved
@Pantani Pantani requested review from lumtis and ilgooz August 31, 2021 00:47
@Pantani
Copy link
Collaborator Author

Pantani commented Aug 31, 2021

@Pantani can you also cover this part? #1365 (comment)

to detect, we can recursively lookup for a go.mod file in parent directories. and to make sure this belongs to the chain, let's check if the go.mod file requires tendermint and cosmos-sdk repositories. then we can set the dir of where go.mod resides as the --path, otherwise we can return with an error.

great, nice feature!! it's done

…pp-path-flag

# Conflicts:
#	starport/services/scaffolder/oracle.go
#	starport/services/scaffolder/packet.go
starport/cmd/cmd.go Outdated Show resolved Hide resolved
starport/pkg/gomodulepath/gomodulepath.go Outdated Show resolved Hide resolved
starport/pkg/gomodulepath/gomodulepath.go Outdated Show resolved Hide resolved
starport/pkg/gomodulepath/gomodulepath.go Outdated Show resolved Hide resolved
starport/cmd/cmd.go Outdated Show resolved Hide resolved
starport/cmd/scaffold_flutter.go Outdated Show resolved Hide resolved
starport/cmd/scaffold_vue.go Outdated Show resolved Hide resolved
starport/pkg/gomodulepath/gomodulepath.go Outdated Show resolved Hide resolved
starport/services/scaffolder/init.go Outdated Show resolved Hide resolved
@Pantani Pantani requested a review from ilgooz September 8, 2021 17:01
lumtis
lumtis previously approved these changes Sep 9, 2021
starport/cmd/cmd.go Outdated Show resolved Hide resolved
starport/services/scaffolder/init.go Outdated Show resolved Hide resolved
starport/services/scaffolder/scaffolder.go Outdated Show resolved Hide resolved
lumtis
lumtis previously approved these changes Sep 10, 2021
Copy link
Contributor

@fadeev fadeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid improvement! 🔥

@ilgooz ilgooz merged commit 3fc4062 into develop Sep 13, 2021
@ilgooz ilgooz deleted the feat/standardize-app-path-flag branch September 13, 2021 06:41
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
…ignite#1518)

* add appPath flag for all scaffold, generate and chain commands

* use app path flag as a constant

* fix the wrong proto path

* add dynamic path for box templates

* add aPath parameter to AddGenesisTest method

* fix box walk path

* fix new chain path

* fix protoc generation

* improva code readbility

* fix import sort for run.go

* add dynamic search for go module in the parent directories

* fix TestParse method

* check if the the cosmos-sdk and the tendermint packages are imported

* print the relative scaffold paths

* apply comment suggestions from PR

* don't use Path structure to path the appPath var

* Apply suggestions from code review

* fix some relative paths and remove unused method context

* move ValidateGoModule method

* fix lint

* fix appPath for scaffold wasm

* remove global app path

* fix merge conflicts

* move ValidateGoMod method to cosmosanalysis package

* fix missing path flag

* remove unused error return

* fix path for genesis types test modifiers

* improve app path description and removed unused flag

* change AppPath flag to Path

* avoid generic path flag

* remove gomodulepath import from the cosmosanalysis pkg

* fix wrong app path

* remove unecessary conversion to absPath

* add integration test cases for custom app path

* move relative path method to cmd

* create ValidateApp extension method for Scaffolder object and remove newChain method

* fix wrong method call

* add test path with a folder inside the project

* refactor(scaffolder): w/ --path (ignite#1568)

Co-authored-by: İlker G. Öztürk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scaffolding: take --path intro consideration
4 participants